[llvm] [RISCV] Detect duplicate extensions in parseNormalizedArchString. (PR #91416)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Tue May 7 20:08:35 PDT 2024


================
@@ -492,7 +492,9 @@ RISCVISAInfo::parseNormalizedArchString(StringRef Arch) {
                                "'" + Twine(ExtName[0]) +
                                    "' must be followed by a letter");
 
-    ISAInfo->addExtension(ExtName, {MajorVersion, MinorVersion});
+    if (!ISAInfo->addExtension(ExtName, {MajorVersion, MinorVersion}))
+      return createStringError(errc::invalid_argument,
+                               "duplicate extension '" + ExtName + "'");
----------------
topperc wrote:

> Could we inform the user which version was ultimately chosen?

We don't chose a version, we fail the parsing.

https://github.com/llvm/llvm-project/pull/91416


More information about the llvm-commits mailing list