[clang] [RISCV] Enable target attribute when invoked through clang driver (PR #74889)

via cfe-commits cfe-commits at lists.llvm.org
Fri Dec 8 13:30:44 PST 2023


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 05420a17547e495f5748e9662150d6eb931e2c28 65707b837a8bb7283896d2c9d4933a17e02a20b9 -- clang/lib/Basic/Targets/RISCV.cpp clang/test/CodeGen/RISCV/riscv-func-attr-target.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Basic/Targets/RISCV.cpp b/clang/lib/Basic/Targets/RISCV.cpp
index 184176c05d..1cce8fe5b2 100644
--- a/clang/lib/Basic/Targets/RISCV.cpp
+++ b/clang/lib/Basic/Targets/RISCV.cpp
@@ -309,12 +309,12 @@ bool RISCVTargetInfo::initFeatureMap(
   // negatives, and non-extension features.  We need to preserve the later
   // for correctness and want to preserve the former for consistency.
   for (auto &Feature : NewFeaturesVec) {
-     StringRef ExtName = Feature;
-     assert(ExtName.size() > 1 && (ExtName[0] == '+' || ExtName[0] == '-'));
-     ExtName = ExtName.drop_front(1); // Drop '+' or '-'
-     if (!llvm::is_contained(ImpliedFeatures, ("+" + ExtName).str()) &&
-         !llvm::is_contained(ImpliedFeatures, ("-" + ExtName).str()))
-       ImpliedFeatures.push_back(Feature);
+    StringRef ExtName = Feature;
+    assert(ExtName.size() > 1 && (ExtName[0] == '+' || ExtName[0] == '-'));
+    ExtName = ExtName.drop_front(1); // Drop '+' or '-'
+    if (!llvm::is_contained(ImpliedFeatures, ("+" + ExtName).str()) &&
+        !llvm::is_contained(ImpliedFeatures, ("-" + ExtName).str()))
+      ImpliedFeatures.push_back(Feature);
   }
   return TargetInfo::initFeatureMap(Features, Diags, CPU, ImpliedFeatures);
 }

``````````

</details>


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


More information about the cfe-commits mailing list