Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 2910163

Browse filesBrowse files
committed
[cmake] Add LLVM_BUILD_DEBUG to llvm-config.h
Some LLVM libraries may conditionally define some class members depending on whether LLVM build type == Debug. However, relying on `NDEBUG` for this may create situations in which the consumer of a header in a downstream project has a different definition for `NDEBUG`, resulting in an ODR violation. The use of `LLVM_BUILD_DEBUG` should be preferred in these cases.
1 parent ec44c74 commit 2910163
Copy full SHA for 2910163

File tree

Expand file treeCollapse file tree

2 files changed

+8
-0
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+8
-0
lines changed

‎llvm/CMakeLists.txt

Copy file name to clipboardExpand all lines: llvm/CMakeLists.txt
+5Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -492,6 +492,11 @@ set(LLVM_LIBRARY_DIR ${LLVM_LIBRARY_OUTPUT_INTDIR}) # --libdir
492492
set(LLVM_MAIN_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR} ) # --src-root
493493
set(LLVM_MAIN_INCLUDE_DIR ${LLVM_MAIN_SRC_DIR}/include ) # --includedir
494494
set(LLVM_BINARY_DIR ${CMAKE_CURRENT_BINARY_DIR} ) # --prefix
495+
if( uppercase_CMAKE_BUILD_TYPE STREQUAL "DEBUG" )
496+
set(LLVM_BUILD_DEBUG ON)
497+
else()
498+
set(LLVM_BUILD_DEBUG OFF)
499+
endif()
495500

496501

497502
# Note: LLVM_CMAKE_DIR does not include generated files

‎llvm/include/llvm/Config/llvm-config.h.cmake

Copy file name to clipboardExpand all lines: llvm/include/llvm/Config/llvm-config.h.cmake
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,9 @@
104104
/* Define to 1 if you have the <sysexits.h> header file. */
105105
#cmakedefine HAVE_SYSEXITS_H ${HAVE_SYSEXITS_H}
106106

107+
/* Define if this LLVM build is a Debug build */
108+
#cmakedefine LLVM_BUILD_DEBUG
109+
107110
/* Define if building libLLVM shared library */
108111
#cmakedefine LLVM_BUILD_LLVM_DYLIB
109112

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.