[PATCH] D38511: [cmake] Add LLVM_DEBUG variable which can be used to replace NDEBUG

Don Hinton via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 14:01:09 PDT 2017


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

- s/LLVM_DEBUG/LLVM_ENABLE_DEBUG/


https://reviews.llvm.org/D38511

Files:
  CMakeLists.txt
  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 CMAKE_BUILD_TYPE is Debug and/or NDEBUG is undefined */
+#cmakedefine LLVM_ENABLE_DEBUG
+
 /* Define if we link Polly to the tools */
 #cmakedefine LINK_POLLY_INTO_TOOLS
 
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -388,16 +388,18 @@
 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)
+  option(LLVM_FORCE_ENABLE_DUMP "Enable dump functions in release builds" OFF)
 else()
   option(LLVM_ENABLE_ASSERTIONS "Enable assertions" ON)
+  option(LLVM_FORCE_ENABLE_DUMP "Enable dump functions in release builds" ON)
+  set(LLVM_ENABLE_DEBUG ON)
 endif()
 
-if( LLVM_ENABLE_ASSERTIONS )
+if( LLVM_ENABLE_ASSERTIONS OR LLVM_FORCE_ENABLE_DUMP )
   set(LLVM_ENABLE_DUMP ON)
+  set(LLVM_ENABLE_DEBUG ON)
 endif()
 
 option(LLVM_ENABLE_EXPENSIVE_CHECKS "Enable expensive checks" OFF)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D38511.117578.patch
Type: text/x-patch
Size: 1421 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171003/cca19135/attachment.bin>


More information about the llvm-commits mailing list