[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)
via cfe-commits
cfe-commits at lists.llvm.org
Thu Jun 12 17:27:38 PDT 2025
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 HEAD~1 HEAD --extensions cpp,h -- clang/test/SemaCXX/trivially-relocatable-ptrauth.cpp clang/include/clang/AST/ASTContext.h clang/lib/AST/ASTContext.cpp clang/lib/Sema/SemaTypeTraits.cpp clang/test/SemaCXX/cxx2c-trivially-relocatable.cpp clang/test/SemaCXX/ptrauth-triviality.cpp
``````````
</details>
<details>
<summary>
View the diff from clang-format here.
</summary>
``````````diff
diff --git a/clang/include/clang/AST/ASTContext.h b/clang/include/clang/AST/ASTContext.h
index acbadcd3e..05baf4e15 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -637,10 +637,10 @@ public:
bool containsAddressDiscriminatedPointerAuth(QualType T);
private:
-
// A simple helper function to short circuit pointer auth checks.
bool isPointerAuthenticationAvailable() const {
- return LangOpts.PointerAuthCalls || LangOpts.PointerAuthIntrinsics || LangOpts.PointerAuthVTPtrAddressDiscrimination;
+ return LangOpts.PointerAuthCalls || LangOpts.PointerAuthIntrinsics ||
+ LangOpts.PointerAuthVTPtrAddressDiscrimination;
}
llvm::DenseMap<const CXXRecordDecl *, CXXRecordDeclRelocationInfo>
diff --git a/clang/lib/Sema/SemaTypeTraits.cpp b/clang/lib/Sema/SemaTypeTraits.cpp
index 9263099fe..a0b989fc3 100644
--- a/clang/lib/Sema/SemaTypeTraits.cpp
+++ b/clang/lib/Sema/SemaTypeTraits.cpp
@@ -201,8 +201,8 @@ static bool IsEligibleForTrivialRelocation(Sema &SemaRef,
// A union contains values with address discriminated pointer auth
// cannot be relocated.
- if (IsUnion &&
- SemaRef.Context.containsAddressDiscriminatedPointerAuth(Field->getType()))
+ if (IsUnion && SemaRef.Context.containsAddressDiscriminatedPointerAuth(
+ Field->getType()))
return false;
}
return !D->hasDeletedDestructor();
``````````
</details>
https://github.com/llvm/llvm-project/pull/143969
More information about the cfe-commits
mailing list