[clang] [clang][PAC] Fix builtins that claim address discriminated types are bitwise compatible (PR #154490)
via cfe-commits
cfe-commits at lists.llvm.org
Wed Aug 20 01:35:58 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/ptrauth-type-traits.cpp clang/include/clang/AST/ASTContext.h clang/lib/AST/ASTContext.cpp clang/lib/AST/DeclCXX.cpp clang/lib/AST/Type.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 d5944c19b..6a9869597 100644
--- a/clang/include/clang/AST/ASTContext.h
+++ b/clang/include/clang/AST/ASTContext.h
@@ -654,8 +654,7 @@ public:
bool containsNonRelocatablePointerAuth(QualType T) {
if (!isPointerAuthenticationAvailable())
return false;
- return findPointerAuthContent(T) !=
- PointerAuthContent::None;
+ return findPointerAuthContent(T) != PointerAuthContent::None;
}
private:
diff --git a/clang/lib/AST/ASTContext.cpp b/clang/lib/AST/ASTContext.cpp
index 69c1489ee..081b6a5b3 100644
--- a/clang/lib/AST/ASTContext.cpp
+++ b/clang/lib/AST/ASTContext.cpp
@@ -1723,7 +1723,8 @@ static bool primaryBaseHaseAddressDiscriminatedVTableAuthentication(
return AddressDiscrimination == AuthAttr::AddressDiscrimination;
}
-ASTContext::PointerAuthContent ASTContext::findPointerAuthContent(QualType T) const {
+ASTContext::PointerAuthContent
+ASTContext::findPointerAuthContent(QualType T) const {
assert(isPointerAuthenticationAvailable());
T = T.getCanonicalType();
diff --git a/clang/lib/AST/DeclCXX.cpp b/clang/lib/AST/DeclCXX.cpp
index 5b032cb44..ceafc6ed6 100644
--- a/clang/lib/AST/DeclCXX.cpp
+++ b/clang/lib/AST/DeclCXX.cpp
@@ -1438,7 +1438,8 @@ void CXXRecordDecl::addedMember(Decl *D) {
data().StructuralIfLiteral = false;
}
- if (!data().HasTrivialSpecialMembers && T.hasAddressDiscriminatedPointerAuth()) {
+ if (!data().HasTrivialSpecialMembers &&
+ T.hasAddressDiscriminatedPointerAuth()) {
// Address discriminated fields mean that a class is no longer
// standard layout.
data().HasTrivialSpecialMembers = true;
diff --git a/clang/lib/AST/Type.cpp b/clang/lib/AST/Type.cpp
index 1071a3721..15222deb2 100644
--- a/clang/lib/AST/Type.cpp
+++ b/clang/lib/AST/Type.cpp
@@ -2773,7 +2773,8 @@ bool QualType::isCXX98PODType(const ASTContext &Context) const {
QualType CanonicalType = getTypePtr()->CanonicalType;
// Any type that is, or contains, address discriminated data is non-POD
- if (CanonicalType.hasAddressDiscriminatedPointerAuth())// Context.containsAddressDiscriminatedPointerAuth(*this))
+ if (CanonicalType
+ .hasAddressDiscriminatedPointerAuth()) // Context.containsAddressDiscriminatedPointerAuth(*this))
return false;
switch (CanonicalType->getTypeClass()) {
@@ -2835,7 +2836,8 @@ bool QualType::isTrivialType(const ASTContext &Context) const {
return false;
// Any type that is, or contains, address discriminated data is non-POD
- if (CanonicalType.hasAddressDiscriminatedPointerAuth()) // Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
+ if (CanonicalType
+ .hasAddressDiscriminatedPointerAuth()) // Context.containsAddressDiscriminatedPointerAuth(CanonicalType))
return false;
// C++0x [basic.types]p9:
@@ -3189,7 +3191,8 @@ bool QualType::isCXX11PODType(const ASTContext &Context) const {
return false;
// Any type that is, or contains, address discriminated data is non-POD
- if (getCanonicalType().hasAddressDiscriminatedPointerAuth()) // Context.containsAddressDiscriminatedPointerAuth(*this))
+ if (getCanonicalType()
+ .hasAddressDiscriminatedPointerAuth()) // Context.containsAddressDiscriminatedPointerAuth(*this))
return false;
// As an extension, Clang treats vector types as Scalar types.
``````````
</details>
https://github.com/llvm/llvm-project/pull/154490
More information about the cfe-commits
mailing list