[clang] [clang] Ensure correct copying of records with authenticated fields (PR #136783)
Oliver Hunt via cfe-commits
cfe-commits at lists.llvm.org
Wed Apr 23 16:21:38 PDT 2025
================
@@ -2801,6 +2801,10 @@ static bool isTriviallyCopyableTypeImpl(const QualType &type,
if (type.hasNonTrivialObjCLifetime())
return false;
+ QualType::PrimitiveCopyKind PCK = type.isNonTrivialToPrimitiveCopy();
+ if (PCK != QualType::PCK_Trivial && PCK != QualType::PCK_VolatileTrivial)
----------------
ojhunt wrote:
I did a bunch of spelunking, this specific change predates `QualType::hasAddressDiscriminatedPointerAuth`. Given that exists now we can make this code much less pessimistic:
* We use hasAddressDiscriminatedPointerAuth to exclude primitive types with address discrimination
* And if we have a record type we check `Decl::isNonTrivialToPrimitiveCopy` which covers transitive inclusion of address discrimination
https://github.com/llvm/llvm-project/pull/136783
More information about the cfe-commits
mailing list