[PATCH] D38406: [dump] Remove NDEBUG from test to enable dump methods [NFC]

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Dec 4 19:30:09 PST 2017


hintonda updated this revision to Diff 125465.
hintonda added a comment.

- Allow rerunning cmake with different values for build type or LLVM_ENABLE_ASSERTIONS.


https://reviews.llvm.org/D38406

Files:
  CMakeLists.txt
  include/llvm/Config/config.h.cmake


Index: include/llvm/Config/config.h.cmake
===================================================================
--- include/llvm/Config/config.h.cmake
+++ include/llvm/Config/config.h.cmake
@@ -359,9 +359,6 @@
 /* Has gcc/MSVC atomic intrinsics */
 #cmakedefine01 LLVM_HAS_ATOMICS
 
-/* Define if LLVM_ENABLE_DUMP is enabled */
-#cmakedefine LLVM_ENABLE_DUMP
-
 /* Host triple LLVM will be executed on */
 #cmakedefine LLVM_HOST_TRIPLE "${LLVM_HOST_TRIPLE}"
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -385,16 +385,20 @@
 option(LLVM_ENABLE_PEDANTIC "Compile with pedantic enabled." ON)
 option(LLVM_ENABLE_WERROR "Fail and stop if a warning is triggered." OFF)
 
-option(LLVM_ENABLE_DUMP "Enable dump functions in release builds" OFF)
-
 if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" OFF)
+  set(LLVM_ENABLE_DUMP OFF)
 else()
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
+  set(LLVM_ENABLE_DUMP ON)
 endif()
 
-if( LLVM_ENABLE_ASSERTIONS )
-  set(LLVM_ENABLE_DUMP ON)
+if( LLVM_ENABLE_ASSERTIONS OR LLVM_ENABLE_DUMP)
+  set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DLLVM_ENABLE_DUMP")
+  set(CMAKE_CXX_FLAGS_MINSIZEREL "${CMAKE_CXX_FLAGS_MINSIZEREL} -DLLVM_ENABLE_DUMP")
+else()
+  list(REMOVE_ITEM CMAKE_CXX_FLAGS_RELEASE "-DLLVM_ENABLE_DUMP")
+  list(REMOVE_ITEM CMAKE_CXX_FLAGS_MINSIZEREL "-DLLVM_ENABLE_DUMP")
 endif()
 
 option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38406.125465.patch
Type: text/x-patch
Size: 1566 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171205/11d609cf/attachment-0001.bin>


More information about the llvm-commits mailing list