2012-06-30 18:14:27 +08:00
|
|
|
# Test runner infrastructure for Clang. This configures the Clang test trees
|
|
|
|
# for use by Lit, and delegates to LLVM's lit test handlers.
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2013-12-17 12:14:17 +08:00
|
|
|
if (CMAKE_CFG_INTDIR STREQUAL ".")
|
|
|
|
set(LLVM_BUILD_MODE ".")
|
|
|
|
else ()
|
|
|
|
set(LLVM_BUILD_MODE "%(build_mode)s")
|
|
|
|
endif ()
|
|
|
|
|
2014-01-19 21:00:01 +08:00
|
|
|
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
|
2013-12-17 12:14:17 +08:00
|
|
|
|
2017-01-25 21:11:45 +08:00
|
|
|
llvm_canonicalize_cmake_booleans(
|
|
|
|
CLANG_BUILD_EXAMPLES
|
|
|
|
CLANG_ENABLE_ARCMT
|
|
|
|
CLANG_ENABLE_STATIC_ANALYZER
|
[Clang][Driver] Re-use the calling process instead of creating a new process for the cc1 invocation
With this patch, the clang tool will now call the -cc1 invocation directly inside the same process. Previously, the -cc1 invocation was creating, and waiting for, a new process.
This patch therefore reduces the number of created processes during a build, thus it reduces build times on platforms where process creation can be costly (Windows) and/or impacted by a antivirus.
It also makes debugging a bit easier, as there's no need to attach to the secondary -cc1 process anymore, breakpoints will be hit inside the same process.
Crashes or signaling inside the -cc1 invocation will have the same side-effect as before, and will be reported through the same means.
This behavior can be controlled at compile-time through the CLANG_SPAWN_CC1 cmake flag, which defaults to OFF. Setting it to ON will revert to the previous behavior, where any -cc1 invocation will create/fork a secondary process.
At run-time, it is also possible to tweak the CLANG_SPAWN_CC1 environment variable. Setting it and will override the compile-time setting. A value of 0 calls -cc1 inside the calling process; a value of 1 will create a secondary process, as before.
Differential Revision: https://reviews.llvm.org/D69825
2020-01-13 23:40:04 +08:00
|
|
|
CLANG_SPAWN_CC1
|
2017-01-25 21:31:53 +08:00
|
|
|
ENABLE_BACKTRACES
|
2019-06-20 01:41:30 +08:00
|
|
|
ENABLE_EXPERIMENTAL_NEW_PASS_MANAGER
|
2020-05-01 04:07:13 +08:00
|
|
|
LLVM_ENABLE_ZLIB
|
2019-05-17 14:07:37 +08:00
|
|
|
LLVM_ENABLE_PER_TARGET_RUNTIME_DIR
|
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
|
|
|
LLVM_ENABLE_PLUGINS
|
|
|
|
LLVM_ENABLE_THREADS)
|
2017-01-25 21:11:45 +08:00
|
|
|
|
2012-06-29 08:39:23 +08:00
|
|
|
configure_lit_site_cfg(
|
2017-09-22 01:38:13 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/lit.cfg.py
|
2020-04-03 03:51:58 +08:00
|
|
|
PATHS
|
|
|
|
"LLVM_SOURCE_DIR"
|
|
|
|
"LLVM_BINARY_DIR"
|
|
|
|
"LLVM_TOOLS_DIR"
|
|
|
|
"LLVM_LIBS_DIR"
|
|
|
|
"SHLIBDIR"
|
|
|
|
"LLVM_LIT_TOOLS_DIR"
|
|
|
|
"CLANG_BINARY_DIR"
|
|
|
|
"CLANG_SOURCE_DIR"
|
|
|
|
"CLANG_TOOLS_DIR"
|
2012-06-29 08:39:23 +08:00
|
|
|
)
|
2009-11-08 07:53:32 +08:00
|
|
|
|
2012-06-29 08:39:23 +08:00
|
|
|
configure_lit_site_cfg(
|
2017-09-22 01:38:13 +08:00
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.site.cfg.py.in
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}/Unit/lit.site.cfg.py
|
|
|
|
MAIN_CONFIG
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/Unit/lit.cfg.py
|
2020-04-03 03:51:58 +08:00
|
|
|
PATHS
|
|
|
|
"LLVM_SOURCE_DIR"
|
|
|
|
"LLVM_BINARY_DIR"
|
|
|
|
"LLVM_TOOLS_DIR"
|
|
|
|
"LLVM_LIBS_DIR"
|
|
|
|
"CLANG_BINARY_DIR"
|
|
|
|
"SHLIBDIR"
|
2012-06-29 08:39:23 +08:00
|
|
|
)
|
2011-02-03 17:01:12 +08:00
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
option(CLANG_TEST_USE_VG "Run Clang tests under Valgrind" OFF)
|
|
|
|
if(CLANG_TEST_USE_VG)
|
|
|
|
set(CLANG_TEST_EXTRA_ARGS ${CLANG_TEST_EXTRA_ARGS} "--vg")
|
|
|
|
endif ()
|
2009-06-06 00:00:31 +08:00
|
|
|
|
2013-12-20 00:05:39 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2020-09-29 04:26:02 +08:00
|
|
|
apinotes-test
|
2019-05-02 03:34:00 +08:00
|
|
|
c-index-test
|
|
|
|
clang
|
|
|
|
clang-resource-headers
|
2016-06-01 21:47:26 +08:00
|
|
|
clang-format
|
2014-01-19 16:54:48 +08:00
|
|
|
clang-tblgen
|
clang-offload-bundler - offload files bundling/unbundling tool
Summary:
One of the goals of programming models that support offloading (e.g. OpenMP) is to enable users to offload with little effort, by annotating the code with a few pragmas. I'd also like to save users the trouble of changing their existent applications' build system. So having the compiler always return a single file instead of one for the host and each target even if the user is doing separate compilation is desirable.
This diff proposes a tool named clang-offload-bundler (happy to change the name if required) that is used to bundle files associated with the same user source file but different targets, or to unbundle a file into separate files associated with different targets.
This tool supports the driver support for OpenMP under review in http://reviews.llvm.org/D9888. The tool is used there to enable separate compilation, so that the very first action on input files that are not source files is a "unbundling action" and the very last non-linking action is a "bundling action".
The format of the bundled files is currently very simple: text formats are concatenated with comments that have a magic string and target identifying triple in between, and binary formats have a header that contains the triple and the offset and size of the code for host and each target.
The goal is to improve this tool in the future to deal with archive files so that each individual file in the archive is properly dealt with. We see that archives are very commonly used in current applications to combine separate compilation results. So I'm convinced users would enjoy this feature.
This tool can be used like this:
`clang-offload-bundler -targets=triple1,triple2 -type=ii -inputs=a.triple1.ii,a.triple2.ii -outputs=a.ii`
or
`clang-offload-bundler -targets=triple1,triple2 -type=ii -outputs=a.triple1.ii,a.triple2.ii -inputs=a.ii -unbundle`
I implemented the tool under clang/tools. Please let me know if something like this should live somewhere else.
This patch is prerequisite for http://reviews.llvm.org/D9888.
Reviewers: hfinkel, rsmith, echristo, chandlerc, tra, jlebar, ABataev, Hahnfeld
Subscribers: whchung, caomhin, andreybokhanko, arpith-jacob, carlo.bertolli, mehdi_amini, guansong, Hahnfeld, cfe-commits
Differential Revision: https://reviews.llvm.org/D13909
llvm-svn: 279632
2016-08-24 23:21:05 +08:00
|
|
|
clang-offload-bundler
|
Testbed and skeleton of a new expression parser
Recommitted after formal approval.
LLVM's JIT is now the foundation of dynamic-compilation features for many languages. Clang also has low-level support for dynamic compilation (ASTImporter and ExternalASTSource, notably). How the compiler is set up for dynamic parsing is generally left up to individual clients, for example LLDB's C/C++/Objective-C expression parser and the ROOT project.
Although this arrangement offers external clients the flexibility to implement dynamic features as they see fit, the lack of an in-tree client means that subtle bugs can be introduced that cause regressions in the external clients but aren't caught by tests (or users) until much later. LLDB for example regularly encounters complicated ODR violation scenarios where it is not immediately clear who is at fault.
Other external clients (notably, Cling) rely on similar functionality, and another goal is to break this functionality up into composable parts so that any client can be built easily on top of Clang without requiring extensive additional code.
I propose that the parts required to build a simple expression parser be added to Clang. Initially, I aim to have the following features:
A piece that looks up external declarations from a variety of sources (e.g., from previous dynamic compilations, from modules, or from DWARF) and uses clear conflict resolution rules to reconcile differences, with easily understood errors. This functionality will be supported by in-tree tests.
A piece that works hand in hand with the LLVM JIT to resolve the locations of external declarations so that e.g. variables can be redeclared and (for high-performance applications like DTrace) external variables can be accessed directly from the registers where they reside.
This commit adds a tester that parses a sequence of source files and then uses them as source data for an expression. External references are resolved using an ExternalASTSource that responds to name queries using an ASTImporter. This is the setup that LLDB uses, and the motivating reason for MinimalImport in ASTImporter. When complete, this tester will implement the first of the above goals.
Differential Revision: https://reviews.llvm.org/D27180
llvm-svn: 290367
2016-12-23 04:03:14 +08:00
|
|
|
clang-import-test
|
2017-07-01 00:36:09 +08:00
|
|
|
clang-rename
|
2017-09-14 18:06:52 +08:00
|
|
|
clang-refactor
|
2017-07-21 21:12:01 +08:00
|
|
|
clang-diff
|
2019-06-13 05:32:49 +08:00
|
|
|
clang-scan-deps
|
2019-05-02 03:34:00 +08:00
|
|
|
diagtool
|
2018-06-22 05:45:24 +08:00
|
|
|
hmaptool
|
2013-02-08 15:28:25 +08:00
|
|
|
)
|
2016-06-01 21:47:26 +08:00
|
|
|
|
|
|
|
if(CLANG_ENABLE_STATIC_ANALYZER)
|
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2019-05-02 07:32:38 +08:00
|
|
|
clang-check
|
[analyzer][CrossTU][NFC] Generalize to external definitions instead of external functions
Summary: This is just changing naming and documentation to be general about external definitions that can be imported for cross translation unit analysis. There is at least a plan to add VarDecls: D46421
Reviewers: NoQ, xazax.hun, martong, a.sidorin, george.karpenkov, serge-sans-paille
Reviewed By: xazax.hun, martong
Subscribers: mgorny, whisperity, baloghadamsoftware, szepet, rnkovacs, mikhail.ramalho, Szelethus, donat.nagy, dkrupp, cfe-commits
Differential Revision: https://reviews.llvm.org/D56441
llvm-svn: 350852
2019-01-11 01:44:04 +08:00
|
|
|
clang-extdef-mapping
|
2016-06-01 21:47:26 +08:00
|
|
|
)
|
|
|
|
endif()
|
2014-06-01 10:02:23 +08:00
|
|
|
|
2014-07-15 06:17:16 +08:00
|
|
|
if (CLANG_ENABLE_ARCMT)
|
|
|
|
list(APPEND CLANG_TEST_DEPS
|
|
|
|
arcmt-test
|
|
|
|
c-arcmt-test
|
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2017-01-25 21:11:45 +08:00
|
|
|
if (CLANG_BUILD_EXAMPLES)
|
2014-06-01 10:02:23 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2020-03-25 21:49:02 +08:00
|
|
|
Attribute
|
2016-03-21 19:03:39 +08:00
|
|
|
AnnotateFunctions
|
2020-11-20 21:50:39 +08:00
|
|
|
CallSuperAttr
|
2014-06-01 10:02:23 +08:00
|
|
|
clang-interpreter
|
|
|
|
PrintFunctionNames
|
2014-07-15 06:17:22 +08:00
|
|
|
)
|
|
|
|
endif ()
|
|
|
|
|
2013-02-08 15:28:25 +08:00
|
|
|
set(CLANG_TEST_PARAMS
|
2018-08-14 07:12:43 +08:00
|
|
|
USE_Z3_SOLVER=0
|
2013-02-08 15:28:25 +08:00
|
|
|
)
|
2009-11-23 05:55:22 +08:00
|
|
|
|
2013-02-08 15:28:25 +08:00
|
|
|
if( NOT CLANG_BUILT_STANDALONE )
|
|
|
|
list(APPEND CLANG_TEST_DEPS
|
check-clang: Introduce get_llvm_config_props in clang/test/lit.cfg.
In trunk, we can use features as below:
aarch64-registered-target
hexagon-registered-target
msp430-registered-target
r600-registered-target
systemz-registered-target
xcore-registered-target
Each of them, as below, implies corresponding subtargets:
arm-registered-target -- arm, thumb
mips-registered-target -- mips, mips64, mips64el, mipsel
nvptx-registered-target -- nvptx, nvptx64
sparc-registered-target -- sparc, sparcv9
x86-registered-target -- x86, x86-64
They will be renamed:
cppbackend-registered-target -- was "cpp". Unused in trunk.
powerpc-registered-target -- was "ppc32", "ppc64" and "ppc64le".
The feature "asserts" is also taken from llvm-config.
llvm-svn: 196347
2013-12-04 11:40:56 +08:00
|
|
|
llvm-config
|
2015-09-14 20:41:53 +08:00
|
|
|
FileCheck count not
|
2015-10-16 17:38:42 +08:00
|
|
|
llc
|
2018-06-27 07:18:59 +08:00
|
|
|
llvm-as
|
2015-10-16 17:38:42 +08:00
|
|
|
llvm-bcanalyzer
|
2017-01-27 05:09:48 +08:00
|
|
|
llvm-cat
|
2019-05-17 05:13:59 +08:00
|
|
|
llvm-cxxfilt
|
2017-01-19 08:04:44 +08:00
|
|
|
llvm-dis
|
2019-06-21 18:26:20 +08:00
|
|
|
llvm-dwarfdump
|
2019-10-09 04:23:24 +08:00
|
|
|
llvm-ifs
|
2018-02-15 06:41:15 +08:00
|
|
|
llvm-lto2
|
2017-01-27 07:51:50 +08:00
|
|
|
llvm-modextract
|
2016-06-22 09:03:15 +08:00
|
|
|
llvm-nm
|
2019-08-27 03:48:43 +08:00
|
|
|
llvm-objcopy
|
2015-10-16 17:38:42 +08:00
|
|
|
llvm-objdump
|
|
|
|
llvm-profdata
|
2019-07-02 05:57:31 +08:00
|
|
|
llvm-readelf
|
2015-10-16 17:38:42 +08:00
|
|
|
llvm-readobj
|
|
|
|
llvm-symbolizer
|
|
|
|
opt
|
2012-07-03 05:37:04 +08:00
|
|
|
)
|
2016-06-03 00:35:24 +08:00
|
|
|
|
|
|
|
if(TARGET llvm-lto)
|
2016-06-03 02:49:42 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS llvm-lto)
|
2016-06-03 00:35:24 +08:00
|
|
|
endif()
|
2009-11-03 15:25:53 +08:00
|
|
|
endif()
|
2012-06-30 18:14:27 +08:00
|
|
|
|
2018-08-14 07:12:43 +08:00
|
|
|
if (CLANG_ENABLE_STATIC_ANALYZER)
|
2019-06-02 23:53:43 +08:00
|
|
|
if (LLVM_ENABLE_PLUGINS)
|
2019-06-03 01:56:26 +08:00
|
|
|
list(APPEND CLANG_TEST_DEPS
|
2019-06-02 23:53:43 +08:00
|
|
|
SampleAnalyzerPlugin
|
|
|
|
CheckerDependencyHandlingAnalyzerPlugin
|
|
|
|
CheckerOptionHandlingAnalyzerPlugin
|
|
|
|
)
|
2018-08-14 07:12:43 +08:00
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
2019-11-12 19:47:54 +08:00
|
|
|
# Copy gen_ast_dump_json_test.py to the clang build dir. This allows invoking
|
|
|
|
# it without having to pass the --clang= argument
|
2019-12-18 01:09:18 +08:00
|
|
|
configure_file(AST/gen_ast_dump_json_test.py
|
|
|
|
${CLANG_BINARY_DIR}/bin/gen_ast_dump_json_test.py COPYONLY)
|
2019-11-12 19:47:54 +08:00
|
|
|
|
2019-05-16 21:22:04 +08:00
|
|
|
add_custom_target(clang-test-depends DEPENDS ${CLANG_TEST_DEPS})
|
|
|
|
set_target_properties(clang-test-depends PROPERTIES FOLDER "Clang tests")
|
|
|
|
|
|
|
|
add_lit_testsuite(check-clang "Running the Clang regression tests"
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
#LIT ${LLVM_LIT}
|
|
|
|
PARAMS ${CLANG_TEST_PARAMS}
|
|
|
|
DEPENDS ${CLANG_TEST_DEPS}
|
|
|
|
ARGS ${CLANG_TEST_EXTRA_ARGS}
|
|
|
|
)
|
|
|
|
set_target_properties(check-clang PROPERTIES FOLDER "Clang tests")
|
|
|
|
|
2016-07-06 01:54:40 +08:00
|
|
|
add_lit_testsuites(CLANG ${CMAKE_CURRENT_SOURCE_DIR}
|
|
|
|
PARAMS ${CLANG_TEST_PARAMS}
|
|
|
|
DEPENDS ${CLANG_TEST_DEPS}
|
|
|
|
)
|
|
|
|
|
2012-06-30 18:14:27 +08:00
|
|
|
# Add a legacy target spelling: clang-test
|
2012-07-03 05:46:03 +08:00
|
|
|
add_custom_target(clang-test)
|
|
|
|
add_dependencies(clang-test check-clang)
|
2012-06-30 18:14:27 +08:00
|
|
|
set_target_properties(clang-test PROPERTIES FOLDER "Clang tests")
|
2017-12-13 00:48:35 +08:00
|
|
|
|
|
|
|
# FIXME: This logic can be removed once all buildbots have moved
|
|
|
|
# debuginfo-test from clang/test to llvm/projects or monorepo.
|
2017-12-13 03:47:40 +08:00
|
|
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests)
|
2017-12-13 00:48:35 +08:00
|
|
|
message(WARNING "Including debuginfo-tests in clang/test is deprecated. Move to llvm/projects or use monorepo.")
|
2017-12-13 03:47:40 +08:00
|
|
|
if(EXISTS ${CMAKE_CURRENT_SOURCE_DIR}/debuginfo-tests/CMakeLists.txt)
|
2017-12-13 00:48:35 +08:00
|
|
|
add_subdirectory(debuginfo-tests)
|
|
|
|
endif()
|
|
|
|
endif()
|