[CMake] Use `LLVM_ENABLE_ASSERTIONS` to enable assertions in `libc++`
authorArgyrios Kyrtzidis <kyrtzidis@apple.com>
Wed, 8 Feb 2023 23:34:44 +0000 (15:34 -0800)
committerArgyrios Kyrtzidis <kyrtzidis@apple.com>
Sat, 11 Feb 2023 01:51:33 +0000 (17:51 -0800)
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

llvm/cmake/modules/HandleLLVMOptions.cmake

index 083d4f93938a6ad3e92dcb67991277e6b306812c..f5d30916b465ae1e58659c1368624f387c7c5692 100644 (file)
@@ -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)