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

Oliver Hunt via llvm-branch-commits llvm-branch-commits at lists.llvm.org
Wed May 14 17:27:28 PDT 2025


================
@@ -544,6 +544,7 @@ TYPE_TRAIT_2(__is_pointer_interconvertible_base_of, IsPointerInterconvertibleBas
 #include "clang/Basic/TransformTypeTraits.def"
 
 // Clang-only C++ Type Traits
+TYPE_TRAIT_1(__has_non_relocatable_fields, HasNonRelocatableFields, KEYCXX)
----------------
ojhunt wrote:

I do not like this -- there are existing functions for handling whether an object is trivially copying, relocatable, etc that should just be updated to correctly report the traits of impacted types. See the various Sema functions querying `isAddressDiscriminated()`. That function currently only cares about pointer auth, but it would not be unreasonable to have it consider other properties, like PDP.

In fact a lot of the behavior you're wanting in this feature is essentially covered by the PointerAuthQualfier. It would perhaps be reasonable to generalize that to something akin to SecurePointerQualifier that could be either a PAQ or PFP qualifier. Then most of the current semantic queries made to support pointer auth could just be a single shared implementation.

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


More information about the llvm-branch-commits mailing list