[libcxx-commits] [libcxx] [libcxxabi] [libc++][libc++abi] Build with -fsized-deallocation (PR #96217)

via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 20 10:33:33 PDT 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-libcxx

Author: Louis Dionne (ldionne)

<details>
<summary>Changes</summary>

This patch makes libc++ and libc++abi build with -fsized-deallocation. That flag is enabled by default in recent versions of Clang, so this patch will make these runtimes forward-compatible with ToT Clang.

---
Full diff: https://github.com/llvm/llvm-project/pull/96217.diff


2 Files Affected:

- (modified) libcxx/CMakeLists.txt (+4) 
- (modified) libcxxabi/CMakeLists.txt (+4) 


``````````diff
diff --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index 4b927017f8c2a..f0946b6022280 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -553,6 +553,10 @@ function(cxx_add_basic_build_flags target)
     target_add_compile_flags_if_supported(${target} PRIVATE -fvisibility=hidden)
   endif()
 
+  # Build with -fsized-deallocation, which is default in recent versions of Clang.
+  # TODO(LLVM 21): This can be dropped once we only support Clang >= 19.
+  target_compile_options(${target} PRIVATE -fsized-deallocation)
+
   # Let the library headers know they are currently being used to build the
   # library.
   target_compile_definitions(${target} PRIVATE -D_LIBCPP_BUILDING_LIBRARY)
diff --git a/libcxxabi/CMakeLists.txt b/libcxxabi/CMakeLists.txt
index 52ba52f3439fb..d45b104b41e32 100644
--- a/libcxxabi/CMakeLists.txt
+++ b/libcxxabi/CMakeLists.txt
@@ -247,6 +247,10 @@ endif()
 add_compile_flags("${LIBCXXABI_ADDITIONAL_COMPILE_FLAGS}")
 add_library_flags("${LIBCXXABI_ADDITIONAL_LIBRARIES}")
 
+# Build with -fsized-deallocation, which is default in recent versions of Clang.
+# TODO(LLVM 21): This can be dropped once we only support Clang >= 19.
+add_compile_flags(-fsized-deallocation)
+
 # Configure compiler. Must happen after setting the target flags.
 include(config-ix)
 

``````````

</details>


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


More information about the libcxx-commits mailing list