From 7c441b4017f51401cdc54ea048fb644c1e63780d Mon Sep 17 00:00:00 2001 From: Peter Collingbourne Date: Fri, 10 Oct 2025 16:12:20 -0700 Subject: =?UTF-8?q?[=F0=9D=98=80=F0=9D=97=BD=F0=9D=97=BF]=20changes=20intr?= =?UTF-8?q?oduced=20through=20rebase?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Created using spr 1.3.6-beta.1 [skip ci] --- libcxx/CMakeLists.txt | 6 +++++- libcxx/docs/CodingGuidelines.rst | 11 ++++++----- libcxx/include/__config | 15 +-------------- libcxx/include/string | 4 ++-- 4 files changed, 14 insertions(+), 22 deletions(-) diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt index a119850cd808..3a87029b5298 100644 --- a/libcxx/CMakeLists.txt +++ b/libcxx/CMakeLists.txt @@ -201,7 +201,11 @@ set(LIBCXX_LIBRARY_VERSION "${LIBCXX_ABI_VERSION}.0" CACHE STRING For example, -DLIBCXX_LIBRARY_VERSION=x.y will result in the library being named libc++.x.y.dylib, along with the usual symlinks pointing to that. On Apple platforms, this also controls the linker's 'current_version' property.") -set(LIBCXX_ABI_NAMESPACE "__${LIBCXX_ABI_VERSION}" CACHE STRING "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.") +set(default_abi_namespace "__${LIBCXX_ABI_VERSION}") +if(NOT LIBCXX_PFP STREQUAL "none") + set(default_abi_namespace "${default_abi_namespace}_pfp_${LIBCXX_PFP}") +endif() +set(LIBCXX_ABI_NAMESPACE "${default_abi_namespace}" CACHE STRING "The inline ABI namespace used by libc++. It defaults to __n where `n` is the current ABI version.") if (NOT LIBCXX_ABI_NAMESPACE MATCHES "__.*") message(FATAL_ERROR "LIBCXX_ABI_NAMESPACE must be a reserved identifier, got '${LIBCXX_ABI_NAMESPACE}'.") endif() diff --git a/libcxx/docs/CodingGuidelines.rst b/libcxx/docs/CodingGuidelines.rst index 0a1ab136c460..9253456b7358 100644 --- a/libcxx/docs/CodingGuidelines.rst +++ b/libcxx/docs/CodingGuidelines.rst @@ -200,11 +200,12 @@ Pointer field protection ======================== To improve the effectiveness of Clang's `pointer field protection -`_ 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. +`_ feature, commonly +used vocabulary types, or internal base classes or fields thereof, +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 and their internal base classes or fields should +be marked with this attribute if they contain pointer fields. For the time being, PFP is an experimental feature, so our criteria for marking types with ``_LIBCPP_PFP`` may change. diff --git a/libcxx/include/__config b/libcxx/include/__config index 933f5ff93161..4dd513e09276 100644 --- a/libcxx/include/__config +++ b/libcxx/include/__config @@ -484,21 +484,8 @@ typedef __char32_t char32_t; # define _LIBCPP_EXCEPTIONS_SIG e # endif -# if !_LIBCPP_HAS_EXCEPTIONS -# define _LIBCPP_EXCEPTIONS_SIG n -# else -# define _LIBCPP_EXCEPTIONS_SIG e -# endif - -# if defined(__POINTER_FIELD_PROTECTION__) -# define _LIBCPP_PFP_SIG p -# else -# define _LIBCPP_PFP_SIG -# endif - # define _LIBCPP_ODR_SIGNATURE \ - _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_EXCEPTIONS_SIG), _LIBCPP_PFP_SIG), \ - _LIBCPP_VERSION) + _LIBCPP_CONCAT(_LIBCPP_CONCAT(_LIBCPP_HARDENING_SIG, _LIBCPP_EXCEPTIONS_SIG), _LIBCPP_VERSION) // This macro marks a symbol as being hidden from libc++'s ABI. This is achieved // on two levels: diff --git a/libcxx/include/string b/libcxx/include/string index 363f27a51648..fbed735829f7 100644 --- a/libcxx/include/string +++ b/libcxx/include/string @@ -825,7 +825,7 @@ private: # ifdef _LIBCPP_ABI_ALTERNATE_STRING_LAYOUT - struct __long { + struct _LIBCPP_PFP __long { __long() = default; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size) @@ -879,7 +879,7 @@ private: // previous definition that did not use bit fields. This is because on // some platforms bit fields have a default size rather than the actual // size used, e.g., it is 4 bytes on AIX. See D128285 for details. - struct __long { + struct _LIBCPP_PFP __long { __long() = default; _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 __long(__alloc_result __alloc, size_type __size) -- cgit v1.2.3