mgorny created this revision.
mgorny added a reviewer: beanz.
mgorny added a subscriber: cfe-commits.
Herald added a subscriber: klimek.
Use the new llvm_canonicalize_cmake_booleans() function to canonicalize
booleans for lit tests. Replace the duplicate ENABLE_CLANG* variables
used to hold canonicalized values with in-place canonicalization. Use
implicit logic in Python code to avoid overrelying on exact 0/1 values.
https://reviews.llvm.org/D28529
Files:
CMakeLists.txt
test/ARCMT/lit.local.cfg
test/Analysis/lit.local.cfg
test/CMakeLists.txt
test/Rewriter/lit.local.cfg
test/Tooling/lit.local.cfg
test/lit.cfg
test/lit.site.cfg.in
Index: test/lit.site.cfg.in
===================================================================
--- test/lit.site.cfg.in
+++ test/lit.site.cfg.in
@@ -14,13 +14,13 @@
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
-config.have_zlib = "@HAVE_LIBZ@"
-config.clang_arcmt = @ENABLE_CLANG_ARCMT@
+config.have_zlib = @HAVE_LIBZ@
+config.clang_arcmt = @CLANG_ENABLE_ARCMT@
config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
-config.clang_staticanalyzer = @ENABLE_CLANG_STATIC_ANALYZER@
-config.clang_examples = @ENABLE_CLANG_EXAMPLES@
+config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
+config.clang_examples = @CLANG_BUILD_EXAMPLES@
config.enable_shared = @ENABLE_SHARED@
-config.enable_backtrace = "@ENABLE_BACKTRACES@"
+config.enable_backtrace = @ENABLE_BACKTRACES@
config.host_arch = "@HOST_ARCH@"
# Support substitution of the tools and libs dirs with user parameters. This is
Index: test/lit.cfg
===================================================================
--- test/lit.cfg
+++ test/lit.cfg
@@ -202,7 +202,7 @@
# Plugins (loadable modules)
# TODO: This should be supplied by Makefile or autoconf.
if sys.platform in ['win32', 'cygwin']:
- has_plugins = (config.enable_shared == 1)
+ has_plugins = config.enable_shared
else:
has_plugins = True
@@ -353,7 +353,7 @@
config.available_features.add('default-cxx-stdlib-set')
# Enabled/disabled features
-if config.clang_staticanalyzer != 0:
+if config.clang_staticanalyzer:
config.available_features.add("staticanalyzer")
# As of 2011.08, crash-recovery tests still do not pass on FreeBSD.
@@ -474,10 +474,10 @@
else:
config.available_features.add("not_ubsan")
-if config.enable_backtrace == "1":
+if config.enable_backtrace:
config.available_features.add("backtrace")
-if config.have_zlib == "1":
+if config.have_zlib:
config.available_features.add("zlib")
else:
config.available_features.add("nozlib")
Index: test/Tooling/lit.local.cfg
===================================================================
--- test/Tooling/lit.local.cfg
+++ test/Tooling/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_staticanalyzer == 0:
+if not config.root.clang_staticanalyzer:
config.unsupported = True
Index: test/Rewriter/lit.local.cfg
===================================================================
--- test/Rewriter/lit.local.cfg
+++ test/Rewriter/lit.local.cfg
@@ -1,3 +1,3 @@
# The Objective-C rewriters are currently grouped with ARCMT.
-if config.root.clang_arcmt == 0:
+if not config.root.clang_arcmt:
config.unsupported = True
Index: test/CMakeLists.txt
===================================================================
--- test/CMakeLists.txt
+++ test/CMakeLists.txt
@@ -18,6 +18,12 @@
endif()
endif()
+llvm_canonicalize_cmake_booleans(
+ CLANG_BUILD_EXAMPLES
+ CLANG_ENABLE_ARCMT
+ CLANG_ENABLE_STATIC_ANALYZER
+ ENABLE_BACKTRACES)
+
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.in
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg
@@ -55,15 +61,15 @@
)
endif ()
-if (ENABLE_CLANG_EXAMPLES)
+if (CLANG_BUILD_EXAMPLES)
list(APPEND CLANG_TEST_DEPS
AnnotateFunctions
clang-interpreter
PrintFunctionNames
)
endif ()
-if (ENABLE_CLANG_STATIC_ANALYZER AND ENABLE_CLANG_EXAMPLES)
+if (CLANG_ENABLE_STATIC_ANALYZER AND CLANG_BUILD_EXAMPLES)
list(APPEND CLANG_TEST_DEPS
SampleAnalyzerPlugin
)
Index: test/Analysis/lit.local.cfg
===================================================================
--- test/Analysis/lit.local.cfg
+++ test/Analysis/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_staticanalyzer == 0:
+if not config.root.clang_staticanalyzer:
config.unsupported = True
Index: test/ARCMT/lit.local.cfg
===================================================================
--- test/ARCMT/lit.local.cfg
+++ test/ARCMT/lit.local.cfg
@@ -1,2 +1,2 @@
-if config.root.clang_arcmt == 0:
+if not config.root.clang_arcmt:
config.unsupported = True
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -364,18 +364,7 @@
"Build the Clang tools. If OFF, just generate build targets." ON)
option(CLANG_ENABLE_ARCMT "Build ARCMT." ON)
-if (CLANG_ENABLE_ARCMT)
- set(ENABLE_CLANG_ARCMT "1")
-else()
- set(ENABLE_CLANG_ARCMT "0")
-endif()
-
option(CLANG_ENABLE_STATIC_ANALYZER "Build static analyzer." ON)
-if (CLANG_ENABLE_STATIC_ANALYZER)
- set(ENABLE_CLANG_STATIC_ANALYZER "1")
-else()
- set(ENABLE_CLANG_STATIC_ANALYZER "0")
-endif()
if (NOT CLANG_ENABLE_STATIC_ANALYZER AND CLANG_ENABLE_ARCMT)
message(FATAL_ERROR "Cannot disable static analyzer while enabling ARCMT")
@@ -415,11 +404,6 @@
add_subdirectory(runtime)
option(CLANG_BUILD_EXAMPLES "Build CLANG example programs by default." OFF)
-if (CLANG_BUILD_EXAMPLES)
- set(ENABLE_CLANG_EXAMPLES "1")
-else()
- set(ENABLE_CLANG_EXAMPLES "0")
-endif()
add_subdirectory(examples)
if(APPLE)
_______________________________________________
cfe-commits mailing list
[email protected]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits