[llvm-branch-commits] [clang] [Clang] Add pointer field protection feature. (PR #172119)

Oliver Hunt via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Sat Dec 20 23:33:59 PST 2025


================
@@ -15227,3 +15227,91 @@ bool ASTContext::useAbbreviatedThunkName(GlobalDecl VirtualMethodDecl,
   ThunksToBeAbbreviated[VirtualMethodDecl] = std::move(SimplifiedThunkNames);
   return Result;
 }
+
+bool ASTContext::arePFPFieldsTriviallyCopyable(const RecordDecl *RD) const {
+  bool IsPAuthSupported =
+      getTargetInfo().getTriple().getArch() == llvm::Triple::aarch64;
+  if (!IsPAuthSupported)
+    return true;
+  if (getLangOpts().PointerFieldProtectionTagged)
+    return !isa<CXXRecordDecl>(RD) ||
----------------
ojhunt wrote:

should this possible be an isPOD check? What are the actual semantics required to trivially copyable fields?

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


More information about the llvm-branch-commits mailing list