[clang] [clang] Refactor target attribute mangling. (PR #81893)

Erich Keane via cfe-commits cfe-commits at lists.llvm.org
Wed Feb 28 06:41:23 PST 2024


================
@@ -857,6 +864,36 @@ void AArch64TargetCodeGenInfo::checkFunctionCallABI(
           << Callee->getDeclName();
 }
 
+void AArch64ABIInfo::appendAttributeMangling(TargetClonesAttr *Attr,
+                                             unsigned Index,
+                                             raw_ostream &Out) const {
+  appendAttributeMangling(Attr->getFeatureStr(Index), Out);
+}
+
+void AArch64ABIInfo::appendAttributeMangling(StringRef AttrStr,
+                                             raw_ostream &Out) const {
+  if (AttrStr == "default") {
+    Out << ".default";
+    return;
+  }
+
+  Out << "._";
+  SmallVector<StringRef, 8> Features;
+  AttrStr.split(Features, "+");
+  for (auto &Feat : Features)
+    Feat = Feat.trim();
+
+  // TODO Lexicographical order won't break the ABI if priorities change.
----------------
erichkeane wrote:

Usually we do a 'FIXME' if we are going to let this sit a while (allows folks to use 'TODO' for personal use).

Also, I don't really get what this is saying, so if this is going to stick around, we probably need to clarify it for future visitors.

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


More information about the cfe-commits mailing list