[llvm-branch-commits] [libc++] Annotate classes with _LIBCPP_PFP to enable pointer field protection (PR #151652)
Nikolas Klauser via llvm-branch-commits
llvm-branch-commits at lists.llvm.org
Thu Oct 9 23:57:29 PDT 2025
================
@@ -195,3 +195,16 @@ prevent compilers from generating said debug information. Aliases inside type tr
should be annotated for the same reason.
This is enforced by the clang-tidy check ``libcpp-nodebug-on-aliases``.
+
+Pointer field protection
+========================
+
+To improve the effectiveness of Clang's `pointer field protection
+<https://clang.llvm.org/docs/StructureProtection.html>`_ feature,
+commonly used vocabulary types with pointer fields are marked with the
+``_LIBCPP_PFP`` attribute, to give Clang permission to use PFP to protect
+their pointer fields. Newly added vocabulary types should be marked with
+this attribute if they contain pointer fields.
----------------
philnik777 wrote:
If these are the criteria, why isn't `string` annotated?
https://github.com/llvm/llvm-project/pull/151652
More information about the llvm-branch-commits
mailing list