[clang] [Clang][ARM] support arm target attribute, and warning for bad typo (PR #74812)

via cfe-commits cfe-commits at lists.llvm.org
Thu Dec 7 22:49:22 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 28a78e2a4a2c358900aaac1a1eb9efce17a7f5a5 8a84eaf11bb76aba7db5243390f246d40b3f9630 -- clang/test/CodeGen/arm-targetattr.c clang/lib/Basic/Targets/AArch64.cpp clang/lib/Basic/Targets/ARM.cpp clang/lib/Basic/Targets/ARM.h clang/lib/Sema/SemaDeclAttr.cpp clang/test/Sema/arm-branch-protection-attr-warn.c clang/test/Sema/arm-branch-protection.c clang/test/Sema/attr-target.c
``````````

</details>

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

``````````diff
diff --git a/clang/lib/Basic/Targets/ARM.cpp b/clang/lib/Basic/Targets/ARM.cpp
index 3a7081c34e..7ed64f4f44 100644
--- a/clang/lib/Basic/Targets/ARM.cpp
+++ b/clang/lib/Basic/Targets/ARM.cpp
@@ -653,7 +653,7 @@ ParsedTargetAttr ARMTargetInfo::parseTargetAttr(StringRef Features) const {
   SmallVector<StringRef, 1> AttrFeatures;
   Features.split(AttrFeatures, ",");
   bool FoundArch = false;
- 
+
   auto SplitAndAddFeatures = [](StringRef FeatString,
                                 std::vector<std::string> &Features) {
     SmallVector<StringRef, 8> SplitFeatures;
@@ -668,12 +668,12 @@ ParsedTargetAttr ARMTargetInfo::parseTargetAttr(StringRef Features) const {
         Features.push_back(Feature.str());
     }
   };
- 
+
   for (auto &Feature : AttrFeatures) {
     Feature = Feature.trim();
     if (Feature.startswith("fpmath="))
       continue;
- 
+
     if (Feature.startswith("branch-protection=")) {
       Ret.BranchProtection = Feature.split('=').second.trim();
       continue;
@@ -685,7 +685,7 @@ ParsedTargetAttr ARMTargetInfo::parseTargetAttr(StringRef Features) const {
       FoundArch = true;
       std::pair<StringRef, StringRef> Split =
           Feature.split("=").second.trim().split("+");
-      if (Split.first == "") 
+      if (Split.first == "")
         continue;
       llvm::ARM::ArchKind ArchKind = llvm::ARM::parseArch(Split.first);
 
diff --git a/clang/lib/Basic/Targets/ARM.h b/clang/lib/Basic/Targets/ARM.h
index 81c7379a2e..a14d10c522 100644
--- a/clang/lib/Basic/Targets/ARM.h
+++ b/clang/lib/Basic/Targets/ARM.h
@@ -135,7 +135,7 @@ public:
                  StringRef CPU,
                  const std::vector<std::string> &FeaturesVec) const override;
   ParsedTargetAttr parseTargetAttr(StringRef Str) const override;
-  bool supportsTargetAttributeTune() const override { return false;  }
+  bool supportsTargetAttributeTune() const override { return false; }
 
   bool isValidFeatureName(StringRef Feature) const override {
     // We pass soft-float-abi in as a -target-feature, but the backend figures

``````````

</details>


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


More information about the cfe-commits mailing list