[llvm] a1caa30 - [gn build] Add support for expensive checks

Arthur Eubanks via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 18 09:53:57 PDT 2020


Author: Arthur Eubanks
Date: 2020-08-18T09:53:39-07:00
New Revision: a1caa302970de86b15d360212b526be8f1d59641

URL: https://github.com/llvm/llvm-project/commit/a1caa302970de86b15d360212b526be8f1d59641
DIFF: https://github.com/llvm/llvm-project/commit/a1caa302970de86b15d360212b526be8f1d59641.diff

LOG: [gn build] Add support for expensive checks

Reviewed By: hans, MaskRay

Differential Revision: https://reviews.llvm.org/D86007

Added: 
    

Modified: 
    llvm/utils/gn/build/BUILD.gn
    llvm/utils/gn/build/buildflags.gni
    llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn

Removed: 
    


################################################################################
diff  --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn
index e29cdb678a36..3c0b905991b5 100644
--- a/llvm/utils/gn/build/BUILD.gn
+++ b/llvm/utils/gn/build/BUILD.gn
@@ -34,6 +34,10 @@ config("compiler_defaults") {
     defines += [ "NDEBUG" ]
   }
 
+  if (llvm_enable_expensive_checks) {
+    defines += [ "EXPENSIVE_CHECKS" ]
+  }
+
   asmflags = target_flags
   cflags = target_flags
   ldflags = target_flags + target_ldflags

diff  --git a/llvm/utils/gn/build/buildflags.gni b/llvm/utils/gn/build/buildflags.gni
index 4dcdc962b7d1..eb8ac55e48e0 100644
--- a/llvm/utils/gn/build/buildflags.gni
+++ b/llvm/utils/gn/build/buildflags.gni
@@ -10,4 +10,7 @@ declare_args() {
 
   # Whether to enable assertions.
   llvm_enable_assertions = true
+
+  # Whether to enable expensive checks.
+  llvm_enable_expensive_checks = false
 }

diff  --git a/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn b/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
index 5f8058699d72..32480e51a4c2 100644
--- a/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/compiler-rt/test/BUILD.gn
@@ -1,6 +1,7 @@
 import("//compiler-rt/target.gni")
 import("//compiler-rt/test/test.gni")
 import("//llvm/triples.gni")
+import("//llvm/utils/gn/build/buildflags.gni")
 import("//llvm/utils/gn/build/libs/zlib/enable.gni")
 import("//llvm/utils/gn/build/toolchain/compiler.gni")
 import("//llvm/utils/gn/build/write_cmake_config.gni")
@@ -51,12 +52,17 @@ write_cmake_config("lit_common_configured") {
     "SANITIZER_CAN_USE_CXXABI_PYBOOL=True",
     "COMPILER_RT_HAS_LLD_PYBOOL=True",
     "COMPILER_RT_HAS_GWP_ASAN_PYBOOL=False",
-    "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=False",
     "HAVE_RPC_XDR_H=0",
     "ANDROID_NDK_VERSION=19",
     "ANDROID_SERIAL_FOR_TESTING=$android_serial_for_testing",
   ]
 
+  if (llvm_enable_expensive_checks) {
+    values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=True" ]
+  } else {
+    values += [ "LLVM_ENABLE_EXPENSIVE_CHECKS_PYBOOL=False" ]
+  }
+
   if (host_cpu == "x64") {
     values += [ "HOST_ARCH=x86_64" ]
   } else {


        


More information about the llvm-commits mailing list