[clang] [llvm] [Clang][ARM][AArch64] Alway emit protection attributes for functions. (PR #82819)

via llvm-commits llvm-commits at lists.llvm.org
Tue Mar 19 16:31:55 PDT 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 d4fb50d3e5fdf4aba4981371af53aa8fbbd6bf20 5973486010ffe387789e8129d53a2b9d0cc4ca69 -- clang/test/Frontend/arm-branch-protection-lto.c clang/include/clang/Basic/TargetInfo.h clang/lib/CodeGen/Targets/AArch64.cpp clang/lib/CodeGen/Targets/ARM.cpp clang/test/CodeGen/aarch64-branch-protection-attr.c clang/test/CodeGen/aarch64-sign-return-address.c clang/test/CodeGen/aarch64-targetattr.c clang/test/CodeGen/arm-branch-protection-attr-1.c clang/test/CodeGen/arm-branch-protection-attr-2.c llvm/lib/CodeGen/SelectionDAG/SelectionDAGBuilder.cpp llvm/lib/IR/Verifier.cpp llvm/lib/Target/AArch64/AArch64AsmPrinter.cpp llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp llvm/lib/Target/ARM/ARMMachineFunctionInfo.cpp llvm/lib/Transforms/IPO/LowerTypeTests.cpp
``````````

</details>

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

``````````diff
diff --git a/llvm/lib/IR/Verifier.cpp b/llvm/lib/IR/Verifier.cpp
index 5e673c72fc..c5746ea764 100644
--- a/llvm/lib/IR/Verifier.cpp
+++ b/llvm/lib/IR/Verifier.cpp
@@ -2324,7 +2324,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
       CheckFailed("invalid value for 'sign-return-address-key' attribute: " + S,
                   V);
     if (auto AA = Attrs.getFnAttr("sign-return-address"); !AA.isValid()) {
-      CheckFailed("invalid value for 'sign-return-address-key' present without sign-return-address ");
+      CheckFailed("invalid value for 'sign-return-address-key' present without "
+                  "sign-return-address ");
     }
   }
 
@@ -2345,8 +2346,8 @@ void Verifier::verifyFunctionAttrs(FunctionType *FT, AttributeList Attrs,
   if (auto A = Attrs.getFnAttr("guarded-control-stack"); A.isValid()) {
     StringRef S = A.getValueAsString();
     if (S != "")
-      CheckFailed(
-          "invalid value for 'guarded-control-stack' attribute: " + S, V);
+      CheckFailed("invalid value for 'guarded-control-stack' attribute: " + S,
+                  V);
   }
 
   if (auto A = Attrs.getFnAttr("vector-function-abi-variant"); A.isValid()) {
diff --git a/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
index 4869dbb1f6..eac3429e9e 100644
--- a/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
+++ b/llvm/lib/Target/AArch64/AArch64MachineFunctionInfo.cpp
@@ -80,10 +80,8 @@ AArch64FunctionInfo::AArch64FunctionInfo(const Function &F,
   IsMTETagged = F.hasFnAttribute(Attribute::SanitizeMemTag);
 
   // BTI/PAuthLR are set on the function attribute.
-  BranchTargetEnforcement =
-      F.hasFnAttribute("branch-target-enforcement");
-  BranchProtectionPAuthLR =
-      F.hasFnAttribute("branch-protection-pauth-lr");
+  BranchTargetEnforcement = F.hasFnAttribute("branch-target-enforcement");
+  BranchProtectionPAuthLR = F.hasFnAttribute("branch-protection-pauth-lr");
 
   // The default stack probe size is 4096 if the function has no
   // stack-probe-size attribute. This is a safe default because it is the

``````````

</details>


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


More information about the llvm-commits mailing list