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

via cfe-commits cfe-commits at lists.llvm.org
Thu Feb 15 10:20:17 PST 2024


github-actions[bot] wrote:

<!--LLVM CODE FORMAT COMMENT: {clang-format}-->


:warning: C/C++ code formatter, clang-format found issues in your code. :warning:

<details>
<summary>
You can test this locally with the following command:
</summary>

``````````bash
git-clang-format --diff 8bda8cfae6aa3c32cca7997ab64771e6a78f3e61 81ff9395020405dfb123ac6872839432583e067f -- clang/include/clang/Basic/TargetInfo.h clang/lib/Basic/TargetInfo.cpp clang/lib/Basic/Targets/AArch64.cpp clang/lib/Basic/Targets/AArch64.h clang/lib/CodeGen/CodeGenModule.cpp
``````````

</details>

<details>
<summary>
View the diff from clang-format here.
</summary>

``````````diff
diff --git a/clang/lib/Basic/TargetInfo.cpp b/clang/lib/Basic/TargetInfo.cpp
index c17fd4949e..70fe0b6dbc 100644
--- a/clang/lib/Basic/TargetInfo.cpp
+++ b/clang/lib/Basic/TargetInfo.cpp
@@ -568,22 +568,22 @@ std::string TargetInfo::getManglingSuffixFromStr(StringRef AttrStr) const {
            "Features should always have a prefix.");
     return multiVersionSortPriority(LHS.substr(1)) >
            multiVersionSortPriority(RHS.substr(1));
-   });
-
-   bool IsFirst = true;
-   if (!Info.CPU.empty()) {
-     IsFirst = false;
-     ManglingSuffix.append(Twine("arch_", Info.CPU).str());
-   }
-
-   for (StringRef Feat : Info.Features) {
-     if (!IsFirst)
-       ManglingSuffix.append("_");
-     IsFirst = false;
-     ManglingSuffix.append(Feat.substr(1).str());
-   }
-
-   return ManglingSuffix;
+  });
+
+  bool IsFirst = true;
+  if (!Info.CPU.empty()) {
+    IsFirst = false;
+    ManglingSuffix.append(Twine("arch_", Info.CPU).str());
+  }
+
+  for (StringRef Feat : Info.Features) {
+    if (!IsFirst)
+      ManglingSuffix.append("_");
+    IsFirst = false;
+    ManglingSuffix.append(Feat.substr(1).str());
+  }
+
+  return ManglingSuffix;
 }
 
 ParsedTargetAttr TargetInfo::parseTargetAttr(StringRef Features) const {

``````````

</details>


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


More information about the cfe-commits mailing list