[llvm] r326936 - Fix cmake's multi-config generators after r326738

Daniel Sanders via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 7 11:32:37 PST 2018


Author: dsanders
Date: Wed Mar  7 11:32:36 2018
New Revision: 326936

URL: http://llvm.org/viewvc/llvm-project?rev=326936&view=rev
Log:
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.


Modified:
    llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
    llvm/trunk/include/llvm/ADT/Statistic.h
    llvm/trunk/include/llvm/Config/llvm-config.h.cmake

Modified: llvm/trunk/cmake/modules/HandleLLVMOptions.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/cmake/modules/HandleLLVMOptions.cmake?rev=326936&r1=326935&r2=326936&view=diff
==============================================================================
--- llvm/trunk/cmake/modules/HandleLLVMOptions.cmake (original)
+++ llvm/trunk/cmake/modules/HandleLLVMOptions.cmake Wed Mar  7 11:32:36 2018
@@ -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)

Modified: llvm/trunk/include/llvm/ADT/Statistic.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/ADT/Statistic.h?rev=326936&r1=326935&r2=326936&view=diff
==============================================================================
--- llvm/trunk/include/llvm/ADT/Statistic.h (original)
+++ llvm/trunk/include/llvm/ADT/Statistic.h Wed Mar  7 11:32:36 2018
@@ -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;

Modified: llvm/trunk/include/llvm/Config/llvm-config.h.cmake
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Config/llvm-config.h.cmake?rev=326936&r1=326935&r2=326936&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Config/llvm-config.h.cmake (original)
+++ llvm/trunk/include/llvm/Config/llvm-config.h.cmake Wed Mar  7 11:32:36 2018
@@ -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




More information about the llvm-commits mailing list