diff options
author | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2018-04-17 08:57:16 +0200 |
---|---|---|
committer | Nikolai Kosjar <nikolai.kosjar@qt.io> | 2019-06-06 13:27:04 +0000 |
commit | daf5c3305335589cb50197b09e39cd0ce0289667 (patch) | |
tree | d07fabcada64aa0febf22e720e912fd9350a746b | |
parent | e0bc4bfc05486d4e5b8dae29ad062e4d21735c14 (diff) |
[clang] Statically link tools into clang executable
This enables running tidy/clazy from the "clang" executable (driver) and
thus avoids separate extra invocations for the tools resulting in a
speed up.
Cherry picked from commit
clang.git/f16c0ba7e94c6b34d516bb79ac22482fb4d96765.
Change-Id: I35950d24aff8d3c87df55afb96cf550d2d1b1397
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
-rw-r--r-- | clang/tools/driver/CMakeLists.txt | 3 | ||||
-rw-r--r-- | clang/tools/driver/driver.cpp | 15 |
2 files changed, 18 insertions, 0 deletions
diff --git a/clang/tools/driver/CMakeLists.txt b/clang/tools/driver/CMakeLists.txt index 89a3aa3ced85..433fb0d2a85e 100644 --- a/clang/tools/driver/CMakeLists.txt +++ b/clang/tools/driver/CMakeLists.txt @@ -47,6 +47,9 @@ target_link_libraries(clang clangFrontend clangFrontendTool clangSerialization + clangTidyPlugin + clangIncludeFixerPlugin + clazyPlugin ) if(WIN32 AND NOT CYGWIN) diff --git a/clang/tools/driver/driver.cpp b/clang/tools/driver/driver.cpp index 51143e3d8cb7..14ee14884c1a 100644 --- a/clang/tools/driver/driver.cpp +++ b/clang/tools/driver/driver.cpp @@ -512,3 +512,18 @@ int main(int argc_, const char **argv_) { // failing command. return Res; } + +// This anchor is used to force the linker to link the clang-tidy plugin. +extern volatile int ClangTidyPluginAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED ClangTidyPluginAnchorDestination = + ClangTidyPluginAnchorSource; + +// This anchor is used to force the linker to link the clang-include-fixer +// plugin. +extern volatile int ClangIncludeFixerPluginAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED ClangIncludeFixerPluginAnchorDestination = + ClangIncludeFixerPluginAnchorSource; + +// This anchor is used to force the linker to link the clazy plugin. +extern volatile int ClazyPluginAnchorSource; +static int LLVM_ATTRIBUTE_UNUSED ClazyPluginAnchorDestination = ClazyPluginAnchorSource; |