[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
Wed Dec 6 15:59:22 PST 2017


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

Make LLVM_ENABLE_DUMP independent of LLVM_ENABLE_ASSERTIONS, and move
the LLVM_ENABLE_DUMP define from config.h to llvm-config.h.

This patch was originally motivated by a desire to better control
LLVM_ENABLE_DUMP defaults based on the current build type -- much like
LLVM_ENABLE_ASSERTIONS handles it -- as well as clean up the locations
in the code.  Unfortunately, many locations only tested for NDEBUG, so
the cleanup caused a problem.

Also, the complexities of handling multiple build types, especially
for multi-config generators like Xcode and MSVC, made it really
difficult to effectively control LLVM_ENABLE_DUMP at that granularity.
The only way to do this would involve adding a command line option
(via either a -D or -I options), but that defeats the purpose of
moving LLVM_ENABLE_DUMP to a header file in the first place -- it was
originally set via a cmake add_definitions directive.


https://reviews.llvm.org/D38406

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


Index: include/llvm/Config/llvm-config.h.cmake
===================================================================
--- include/llvm/Config/llvm-config.h.cmake
+++ include/llvm/Config/llvm-config.h.cmake
@@ -14,6 +14,9 @@
 #ifndef LLVM_CONFIG_H
 #define LLVM_CONFIG_H
 
+/* Define if LLVM_ENABLE_DUMP is enabled */
+#cmakedefine LLVM_ENABLE_DUMP
+
 /* Define if we link Polly to the tools */
 #cmakedefine LINK_POLLY_INTO_TOOLS
 
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
@@ -393,10 +393,6 @@
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
 endif()
 
-if( LLVM_ENABLE_ASSERTIONS )
-  set(LLVM_ENABLE_DUMP ON)
-endif()
-
 option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)
 
 set(LLVM_ABI_BREAKING_CHECKS "WITH_ASSERTS" CACHE STRING


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38406.125835.patch
Type: text/x-patch
Size: 1301 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171206/7c4bbbd9/attachment.bin>


More information about the llvm-commits mailing list