diff --git a/llvm/utils/gn/build/BUILD.gn b/llvm/utils/gn/build/BUILD.gn index e29cdb678a361f..3c0b905991b50f 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 4dcdc962b7d116..eb8ac55e48e01b 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 5f8058699d7293..32480e51a4c270 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 {