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

Louis Dionne via libcxx-commits libcxx-commits at lists.llvm.org
Thu Jun 20 10:58:46 PDT 2024


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

>From ab0d43565ee865e26176c93aa87a848b70e03118 Mon Sep 17 00:00:00 2001
From: Louis Dionne <ldionne.2 at gmail.com>
Date: Thu, 20 Jun 2024 13:31:09 -0400
Subject: [PATCH] [libc++] Build with -fsized-deallocation

This patch makes libc++ build with -fsized-deallocation. That flag is
enabled by default in recent versions of Clang, so this patch will make
libc++ forward-compatible with ToT Clang.
---
 libcxx/CMakeLists.txt | 4 ++++
 1 file changed, 4 insertions(+)

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)



More information about the libcxx-commits mailing list