[llvm] d8e9a1a - [CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable assertions in `libc++`

Argyrios Kyrtzidis via llvm-commits llvm-commits at lists.llvm.org
Fri Feb 10 17:51:40 PST 2023


Author: Argyrios Kyrtzidis
Date: 2023-02-10T17:51:33-08:00
New Revision: d8e9a1a12557cd5e80c3d713d9cbbba0f7406882

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

LOG: [CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable assertions in `libc++`

Follow-up to https://reviews.llvm.org/D142279 for also enabling `libc++` assertions.
This is particularly useful to recover the assertion checks we had with `llvm::Optional`, before moving to `std::optional`.

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

Added: 
    

Modified: 
    llvm/cmake/modules/HandleLLVMOptions.cmake

Removed: 
    


################################################################################
diff  --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake
index 083d4f93938a6..f5d30916b465a 100644
--- a/llvm/cmake/modules/HandleLLVMOptions.cmake
+++ b/llvm/cmake/modules/HandleLLVMOptions.cmake
@@ -83,6 +83,8 @@ if( LLVM_ENABLE_ASSERTIONS )
   endif()
   # Enable assertions in libstdc++.
   add_compile_definitions(_GLIBCXX_ASSERTIONS)
+  # Enable assertions in libc++.
+  add_compile_definitions(_LIBCPP_ENABLE_ASSERTIONS)
 endif()
 
 if(LLVM_ENABLE_EXPENSIVE_CHECKS)


        


More information about the llvm-commits mailing list