[PATCH] D145949: [RISCV] Consistently error for arch strings with trailing _
Alex Bradbury via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 14 12:13:14 PDT 2023
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGcb743dd83715: [RISCV] Consistently error for arch strings with trailing _ (authored by asb).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D145949/new/
https://reviews.llvm.org/D145949
Files:
llvm/lib/Support/RISCVISAInfo.cpp
llvm/unittests/Support/RISCVISAInfoTest.cpp
Index: llvm/unittests/Support/RISCVISAInfoTest.cpp
===================================================================
--- llvm/unittests/Support/RISCVISAInfoTest.cpp
+++ llvm/unittests/Support/RISCVISAInfoTest.cpp
@@ -317,16 +317,12 @@
EXPECT_EQ(
toString(RISCVISAInfo::parseArchString("rv64i__m", true).takeError()),
"invalid standard user-level extension '_'");
- EXPECT_EQ(
- toString(RISCVISAInfo::parseArchString("rv32ezicsr_", true).takeError()),
- "extension name missing after separator '_'");
-
- // FIXME: Trailing underscores after single letter extensions are accepted,
- // which is inconsistent.
- ASSERT_THAT_EXPECTED(RISCVISAInfo::parseArchString("rv32i_", true),
- Succeeded());
- ASSERT_THAT_EXPECTED(RISCVISAInfo::parseArchString("rv64im_", true),
- Succeeded());
+
+ for (StringRef Input :
+ {"rv32ezicsr__zifencei", "rv32i_", "rv32izicsr_", "rv64im_"}) {
+ EXPECT_EQ(toString(RISCVISAInfo::parseArchString(Input, true).takeError()),
+ "extension name missing after separator '_'");
+ }
}
TEST(ParseArchString, RejectsDuplicateExtensionNames) {
Index: llvm/lib/Support/RISCVISAInfo.cpp
===================================================================
--- llvm/lib/Support/RISCVISAInfo.cpp
+++ llvm/lib/Support/RISCVISAInfo.cpp
@@ -629,6 +629,10 @@
break;
}
+ if (Arch.back() == '_')
+ return createStringError(errc::invalid_argument,
+ "extension name missing after separator '_'");
+
// Skip rvxxx
StringRef Exts = Arch.substr(5);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D145949.505212.patch
Type: text/x-patch
Size: 1610 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20230314/110773c6/attachment.bin>
More information about the llvm-commits
mailing list