2016-04-16 14:54:46 +08:00
|
|
|
@LIT_SITE_CFG_IN_HEADER@
|
|
|
|
|
2013-08-09 08:44:59 +08:00
|
|
|
import sys
|
|
|
|
|
2020-04-14 04:53:06 +08:00
|
|
|
config.llvm_src_root = path(r"@LLVM_SOURCE_DIR@")
|
|
|
|
config.llvm_obj_root = path(r"@LLVM_BINARY_DIR@")
|
|
|
|
config.llvm_tools_dir = path(r"@LLVM_TOOLS_DIR@")
|
|
|
|
config.llvm_libs_dir = path(r"@LLVM_LIBS_DIR@")
|
|
|
|
config.llvm_shlib_dir = path(r"@SHLIBDIR@")
|
2014-01-08 19:38:47 +08:00
|
|
|
config.llvm_plugin_ext = "@LLVM_PLUGIN_EXT@"
|
2020-04-14 04:53:06 +08:00
|
|
|
config.lit_tools_dir = path(r"@LLVM_LIT_TOOLS_DIR@")
|
|
|
|
config.clang_obj_root = path(r"@CLANG_BINARY_DIR@")
|
|
|
|
config.clang_src_dir = path(r"@CLANG_SOURCE_DIR@")
|
|
|
|
config.clang_tools_dir = path(r"@CLANG_TOOLS_DIR@")
|
2014-03-11 12:34:17 +08:00
|
|
|
config.host_triple = "@LLVM_HOST_TRIPLE@"
|
2009-11-03 15:25:53 +08:00
|
|
|
config.target_triple = "@TARGET_TRIPLE@"
|
2017-10-11 01:53:45 +08:00
|
|
|
config.host_cxx = "@CMAKE_CXX_COMPILER@"
|
2013-03-26 16:28:18 +08:00
|
|
|
config.llvm_use_sanitizer = "@LLVM_USE_SANITIZER@"
|
2020-03-03 16:45:14 +08:00
|
|
|
config.have_zlib = @HAVE_LIBZ@
|
2017-01-25 21:11:45 +08:00
|
|
|
config.clang_arcmt = @CLANG_ENABLE_ARCMT@
|
2016-09-29 15:43:08 +08:00
|
|
|
config.clang_default_cxx_stdlib = "@CLANG_DEFAULT_CXX_STDLIB@"
|
2017-01-25 21:11:45 +08:00
|
|
|
config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
|
2019-03-26 01:47:45 +08:00
|
|
|
config.clang_staticanalyzer_z3 = "@LLVM_WITH_Z3@"
|
2017-01-25 21:11:45 +08:00
|
|
|
config.clang_examples = @CLANG_BUILD_EXAMPLES@
|
2014-01-09 04:06:24 +08:00
|
|
|
config.enable_shared = @ENABLE_SHARED@
|
2017-01-25 21:11:45 +08:00
|
|
|
config.enable_backtrace = @ENABLE_BACKTRACES@
|
2019-06-20 01:41:30 +08:00
|
|
|
config.enable_experimental_new_pass_manager = @ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER@
|
Improve behavior in the case of stack exhaustion.
Summary:
Clang performs various recursive operations (such as template instantiation),
and may use non-trivial amounts of stack space in each recursive step (for
instance, due to recursive AST walks). While we try to keep the stack space
used by such steps to a minimum and we have explicit limits on the number of
such steps we perform, it's impractical to guarantee that we won't blow out the
stack on deeply recursive template instantiations on complex ASTs, even with
only a moderately high instantiation depth limit.
The user experience in these cases is generally terrible: we crash with
no hint of what went wrong. Under this patch, we attempt to do better:
* Detect when the stack is nearly exhausted, and produce a warning with a
nice template instantiation backtrace, telling the user that we might
run slowly or crash.
* For cases where we're forced to trigger recursive template
instantiation in arbitrarily-deeply-nested contexts, check whether
we're nearly out of stack space and allocate a new stack (by spawning
a new thread) after producing the warning.
Reviewers: rnk, aaron.ballman
Subscribers: mgorny, cfe-commits
Tags: #clang
Differential Revision: https://reviews.llvm.org/D66361
llvm-svn: 369940
2019-08-27 02:18:07 +08:00
|
|
|
config.enable_threads = @LLVM_ENABLE_THREADS@
|
2013-09-13 19:02:31 +08:00
|
|
|
config.host_arch = "@HOST_ARCH@"
|
2017-08-19 08:57:38 +08:00
|
|
|
config.python_executable = "@PYTHON_EXECUTABLE@"
|
2018-08-15 05:15:57 +08:00
|
|
|
config.use_z3_solver = lit_config.params.get('USE_Z3_SOLVER', "@USE_Z3_SOLVER@")
|
2019-05-17 14:07:37 +08:00
|
|
|
config.has_plugins = @LLVM_ENABLE_PLUGINS@
|
2009-09-17 06:30:48 +08:00
|
|
|
|
2009-11-08 07:53:32 +08:00
|
|
|
# Support substitution of the tools and libs dirs with user parameters. This is
|
|
|
|
# used when we can't determine the tool dir at configuration time.
|
|
|
|
try:
|
2013-12-19 02:25:13 +08:00
|
|
|
config.clang_tools_dir = config.clang_tools_dir % lit_config.params
|
2013-08-09 22:43:04 +08:00
|
|
|
config.llvm_tools_dir = config.llvm_tools_dir % lit_config.params
|
2014-01-08 19:38:47 +08:00
|
|
|
config.llvm_shlib_dir = config.llvm_shlib_dir % lit_config.params
|
2013-08-09 22:43:04 +08:00
|
|
|
config.llvm_libs_dir = config.llvm_libs_dir % lit_config.params
|
2013-08-09 08:44:59 +08:00
|
|
|
except KeyError:
|
|
|
|
e = sys.exc_info()[1]
|
2009-11-08 07:53:32 +08:00
|
|
|
key, = e.args
|
2013-08-09 22:43:04 +08:00
|
|
|
lit_config.fatal("unable to find %r parameter, use '--param=%s=VALUE'" % (key,key))
|
2009-11-08 07:53:32 +08:00
|
|
|
|
2018-08-31 08:24:36 +08:00
|
|
|
import lit.llvm
|
2018-08-31 06:11:16 +08:00
|
|
|
lit.llvm.initialize(lit_config, config)
|
2017-09-19 06:26:48 +08:00
|
|
|
|
2020-02-17 20:42:00 +08:00
|
|
|
if not "@CLANG_DEFAULT_LINKER@":
|
2020-02-26 17:37:04 +08:00
|
|
|
config.available_features.add('platform-linker')
|
2020-02-17 20:42:00 +08:00
|
|
|
|
2009-09-17 06:30:48 +08:00
|
|
|
# Let the main config do the real work.
|
2020-04-03 03:51:58 +08:00
|
|
|
lit_config.load_config(
|
|
|
|
config, os.path.join(config.clang_src_dir, "test/lit.cfg.py"))
|