[libcxx-commits] [libcxx] 1ba514c - [libc++][hardening][NFC] Remove the `LIBCXX_DEBUG_BUILD` CMake variable.

via libcxx-commits libcxx-commits at lists.llvm.org
Wed Jul 12 10:16:08 PDT 2023


Author: varconst
Date: 2023-07-12T10:16:00-07:00
New Revision: 1ba514c2cb65a34d994c6976ac584ae70e0165ed

URL: https://github.com/llvm/llvm-project/commit/1ba514c2cb65a34d994c6976ac584ae70e0165ed
DIFF: https://github.com/llvm/llvm-project/commit/1ba514c2cb65a34d994c6976ac584ae70e0165ed.diff

LOG: [libc++][hardening][NFC] Remove the `LIBCXX_DEBUG_BUILD` CMake variable.

It's no longer necessary to define `_DEBUG` because we use our own
internal assertion mechanism in libc++.

Differential Revision: https://reviews.llvm.org/D155038

Added: 
    

Modified: 
    libcxx/CMakeLists.txt

Removed: 
    


################################################################################
diff  --git a/libcxx/CMakeLists.txt b/libcxx/CMakeLists.txt
index e67e0db6bab6fb..8ae2a7afbe4768 100644
--- a/libcxx/CMakeLists.txt
+++ b/libcxx/CMakeLists.txt
@@ -480,13 +480,6 @@ if (LIBCXX_GENERATE_COVERAGE)
   set(CMAKE_BUILD_TYPE "COVERAGE" CACHE STRING "" FORCE)
 endif()
 
-string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
-if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
-  set(LIBCXX_DEBUG_BUILD ON)
-else()
-  set(LIBCXX_DEBUG_BUILD OFF)
-endif()
-
 #===============================================================================
 # Setup Compiler Flags
 #===============================================================================
@@ -595,13 +588,6 @@ if (LIBCXX_BUILD_EXTERNAL_THREAD_LIBRARY AND LIBCXX_ENABLE_SHARED)
   endif()
 endif()
 
-# Assertion flags =============================================================
-define_if(LIBCXX_DEBUG_BUILD -D_DEBUG)
-if (LIBCXX_ENABLE_ASSERTIONS AND NOT LIBCXX_DEBUG_BUILD)
-  # MSVC doesn't like _DEBUG on release builds. See PR 4379.
-  define_if_not(MSVC -D_DEBUG)
-endif()
-
 # Modules flags ===============================================================
 # FIXME The libc++ sources are fundamentally non-modular. They need special
 # versions of the headers in order to provide C++03 and legacy ABI definitions.
@@ -614,6 +600,8 @@ function(cxx_add_module_flags target)
   endif()
 endfunction()
 
+string(TOUPPER "${CMAKE_BUILD_TYPE}" uppercase_CMAKE_BUILD_TYPE)
+
 # Sanitizer flags =============================================================
 
 function(get_sanitizer_flags OUT_VAR  USE_SANITIZER)
@@ -721,7 +709,7 @@ function(cxx_link_system_libraries target)
   endif()
 
   if (MSVC)
-    if (LIBCXX_DEBUG_BUILD)
+    if (uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG")
       set(LIB_SUFFIX "d")
     else()
       set(LIB_SUFFIX "")


        


More information about the libcxx-commits mailing list