[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
Tue Dec 5 01:41:55 PST 2017
hintonda updated this revision to Diff 125481.
hintonda added a comment.
Change LLVM_ENABLE_ASSERTIONS and LLVM_ENABLE_DUMP to non-cached
variables so we can determine if they were passed on the command line
and set defaults if not defined.
Only add/clear -DLLVM_ENABLE_DUMP in config specific
CMAKE_CXX_FLAGS_<config> variable corresponding to the current
CMAKE_BUILD_TYPE.
This configuration allows users to re-run cmake with different
CMAKE_BUILD_TYPE, LLVM_ENABLE_ASSERTIONS, or LLVM_ENABLE_DUMP and
update the appropriate CMAKE_CXX_FLAGS_<config> variable.
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,24 @@
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)
-else()
- option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
+if( NOT DEFINED LLVM_ENABLE_ASSERTIONS)
+ if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
+ set(LLVM_ENABLE_ASSERTIONS OFF)
+ else()
+ set(LLVM_ENABLE_ASSERTIONS ON)
+ endif()
endif()
-if( LLVM_ENABLE_ASSERTIONS )
- set(LLVM_ENABLE_DUMP ON)
+if( NOT uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
+ string(REGEX REPLACE " *-DLLVM_ENABLE_DUMP *" " "
+ CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}
+ "${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}}" )
+ if (LLVM_ENABLE_ASSERTIONS OR LLVM_ENABLE_DUMP)
+ set(CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}
+ "${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}} -DLLVM_ENABLE_DUMP")
+ endif()
+ set(CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}
+ "${CMAKE_CXX_FLAGS_${uppercase_CMAKE_BUILD_TYPE}}" CACHE STRING "" FORCE)
endif()
option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38406.125481.patch
Type: text/x-patch
Size: 1901 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171205/0d77b84e/attachment.bin>
More information about the llvm-commits
mailing list