diff options
author | Daniel Sanders <daniel_l_sanders@apple.com> | 2018-03-07 19:32:36 +0000 |
---|---|---|
committer | Daniel Sanders <daniel_l_sanders@apple.com> | 2018-03-07 19:32:36 +0000 |
commit | 6cf299cf01e4a83844126f7faf17cbeb78e88da9 (patch) | |
tree | 81560c08daf2c4f8219e752b0bb289a9c2d66ed8 | |
parent | 65e64917e3a51326102eef2fffddfa63e46bab97 (diff) | |
download | bcm5719-llvm-6cf299cf01e4a83844126f7faf17cbeb78e88da9.tar.gz bcm5719-llvm-6cf299cf01e4a83844126f7faf17cbeb78e88da9.zip |
Fix cmake's multi-config generators after r326738
LLVM_ENABLE_STATS isn't known at configure-time in these generators so we must
defer it to build-time.
llvm-svn: 326936
-rw-r--r-- | llvm/cmake/modules/HandleLLVMOptions.cmake | 4 | ||||
-rw-r--r-- | llvm/include/llvm/ADT/Statistic.h | 7 | ||||
-rw-r--r-- | llvm/include/llvm/Config/llvm-config.h.cmake | 2 |
3 files changed, 9 insertions, 4 deletions
diff --git a/llvm/cmake/modules/HandleLLVMOptions.cmake b/llvm/cmake/modules/HandleLLVMOptions.cmake index f508db2040c..86ce0bbcfd0 100644 --- a/llvm/cmake/modules/HandleLLVMOptions.cmake +++ b/llvm/cmake/modules/HandleLLVMOptions.cmake @@ -882,6 +882,4 @@ function(get_compile_definitions) endfunction() get_compile_definitions() -# The default for LLVM_ENABLE_STATS depends on whether NDEBUG is defined or not. -# LLVM_ENABLE_ASSERTIONS controls that so re-use it as the default. -option(LLVM_ENABLE_STATS "Enable statistics collection" ${LLVM_ENABLE_ASSERTIONS}) +option(LLVM_FORCE_ENABLE_STATS "Enable statistics collection for builds that wouldn't normally enable it" OFF) diff --git a/llvm/include/llvm/ADT/Statistic.h b/llvm/include/llvm/ADT/Statistic.h index 71d7db846e9..1cb6ac79002 100644 --- a/llvm/include/llvm/ADT/Statistic.h +++ b/llvm/include/llvm/ADT/Statistic.h @@ -32,6 +32,13 @@ #include <memory> #include <vector> +// Determine whether statistics should be enabled. We must do it here rather +// than in CMake because multi-config generators cannot determine this at +// configure time. +#if !defined(NDEBUG) || LLVM_FORCE_ENABLE_STATS +#define LLVM_ENABLE_STATS 1 +#endif + namespace llvm { class raw_ostream; diff --git a/llvm/include/llvm/Config/llvm-config.h.cmake b/llvm/include/llvm/Config/llvm-config.h.cmake index 6b1cb0b0d30..58cc9f99d99 100644 --- a/llvm/include/llvm/Config/llvm-config.h.cmake +++ b/llvm/include/llvm/Config/llvm-config.h.cmake @@ -80,6 +80,6 @@ /* Whether LLVM records statistics for use with GetStatistics(), * PrintStatistics() or PrintStatisticsJSON() */ -#cmakedefine01 LLVM_ENABLE_STATS +#cmakedefine01 LLVM_FORCE_ENABLE_STATS #endif |