[clang] [clang][AArch64] multilib: fix deduction of "-march=" option (PR #81474)

Michael Platings via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 02:38:54 PST 2024


Dominik =?utf-8?q?Wójt?= <dominik.wojt at arm.com>
Message-ID:
In-Reply-To: <llvm.org/llvm/llvm-project/pull/81474 at github.com>


================
@@ -191,7 +191,11 @@ static void getAArch64MultilibFlags(const Driver &D,
   for (const auto &Ext : AArch64::Extensions)
     if (FeatureSet.contains(Ext.NegFeature))
       MArch.push_back(("no" + Ext.Name).str());
-  MArch.insert(MArch.begin(), ("-march=" + Triple.getArchName()).str());
+  StringRef ArchName;
+  for (const auto &ArchInfo : AArch64::ArchInfos)
+    if (FeatureSet.contains(ArchInfo->ArchFeature))
+      ArchName = ArchInfo->Name;
----------------
mplatings wrote:

What happens if no match is found? What happens if multiple matches are found? I suggest some error checking is needed here, even if it's just asserts.

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


More information about the cfe-commits mailing list