[clang] [clang] Fix PointerAuth semantics of cpp_trivially_relocatable (PR #143969)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Mon Jun 16 00:34:38 PDT 2025
================
@@ -629,25 +629,46 @@ class ASTContext : public RefCountedBase<ASTContext> {
void setRelocationInfoForCXXRecord(const CXXRecordDecl *,
CXXRecordDeclRelocationInfo);
- /// Examines a given type, and returns whether the T itself
+ /// Examines a given type, and returns whether the type itself
/// is address discriminated, or any transitively embedded types
/// contain data that is address discriminated. This includes
/// implicitly authenticated values like vtable pointers, as well as
/// explicitly qualified fields.
- bool containsAddressDiscriminatedPointerAuth(QualType T);
- // A simple helper function to short circuit pointer auth checks.
+ bool containsAddressDiscriminatedPointerAuth(QualType T) {
+ if (!isPointerAuthenticationAvailable())
+ return false;
+ return findPointerAuthContent(T) != PointerAuthContent::None;
+ }
----------------
ojhunt wrote:
Ah right, this is used for the union check - in a union it does not matter what the source of the address discrimination is, a union containing anything address discriminated isn't valid. In principle with this change the only thing that would get here is a vtable pointer but it seems reasonable to be safe.
https://github.com/llvm/llvm-project/pull/143969
More information about the cfe-commits
mailing list