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>2019-04-04 06:32:19 +0000
commitf16c0ba7e94c6b34d516bb79ac22482fb4d96765 (patch)
tree1e187cd3b24b41934023b37f28c46bf9beab2088
parent5bc2854d75179b6fe8069ced87b8b86b0243ebf8 (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: I70da78852e1343d3aef4228f4c1093d126311948 Reviewed-by: Orgad Shaneh <orgads@gmail.com>
-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 89a3aa3ced..433fb0d2a8 100644
--- a/tools/driver/CMakeLists.txt
+++ b/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/tools/driver/driver.cpp b/tools/driver/driver.cpp
index 51143e3d8c..14ee14884c 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;