summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2018-04-17 08:57:16 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-10-02 06:29:34 +0000
commit81c24c7c262318ba53ee00661288a0381ea3fca8 (patch)
tree52408198468b394f394689d97b5b57a6e0227535
parenta59ff75e679c7e595f6bf0d16e5ed1eee01b0f45 (diff)
[Driver] 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. This is a cherry pick from commit 7f349701d3ea0c47be3a43e265699dddd3fd55cf Change-Id: Ib14314443d68ee3346198915d109b3594bdbc647 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
-rw-r--r--tools/driver/CMakeLists.txt3
-rw-r--r--tools/driver/driver.cpp15
2 files changed, 18 insertions, 0 deletions
diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
index 15b0519e41..c697d535ea 100644
--- a/tools/driver/CMakeLists.txt
+++ b/tools/driver/CMakeLists.txt
@@ -46,6 +46,9 @@ target_link_libraries(clang
clangDriver
clangFrontend
clangFrontendTool
+ clangTidyPlugin
+ clangIncludeFixerPlugin
+ clazyPlugin
)
if(WIN32 AND NOT CYGWIN)
diff --git a/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 0455ba029c..e3ecfa81c3 100644
--- a/tools/driver/driver.cpp
+++ b/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;