[clang] [NFC][Clang][Docs] Update Pointer Authentication documentation (PR #152596)
Aaron Ballman via cfe-commits
cfe-commits at lists.llvm.org
Mon Aug 11 04:55:31 PDT 2025
================
@@ -327,6 +464,54 @@ a discriminator determined as follows:
is ``ptrauth_blend_discriminator(&x, discriminator)``; see
`ptrauth_blend_discriminator`_.
+Non-triviality from address diversity
++++++++++++++++++++++++++++++++++++++
+
+Address diversity must impose additional restrictions in order to allow the
+implementation to correctly copy values. In C++, a type qualified with address
+diversity is treated like a class type with non-trivial copy/move constructors
+and assignment operators, with the usual effect on containing classes and
+unions. C does not have a standard concept of non-triviality, and so we must
+describe the basic rules here, with the intention of imitating the emergent
+rules of C++:
+
+- A type may be **non-trivial to copy**.
+
+- A type may also be **illegal to copy**. Types that are illegal to copy are
+ always non-trivial to copy.
+
+- A type may also be **address-sensitive**.
+
+- A type qualified with a ``ptrauth`` qualifier that requires address diversity
+ is non-trivial to copy and address-sensitive.
+
+- An array type is illegal to copy, non-trivial to copy, or address-sensitive
+ if its element type is illegal to copy, non-trivial to copy, or
+ address-sensitive, respectively.
+
+- A struct type is illegal to copy, non-trivial to copy, or address-sensitive
+ if it has a field whose type is illegal to copy, non-trivial to copy, or
+ address-sensitive, respectively.
+
+- A union type is both illegal and non-trivial to copy if it has a field whose
+ type is non-trivial or illegal to copy.
+
+- A union type is address-sensitive if it has a field whose type is
----------------
AaronBallman wrote:
Should we say anything about lambdas (or blocks) which capture something that's illegal to copy, etc?
https://github.com/llvm/llvm-project/pull/152596
More information about the cfe-commits
mailing list