aboutsummaryrefslogtreecommitdiffstats
path: root/dist
diff options
context:
space:
mode:
authorIvan Donchevskii <ivan.donchevskii@qt.io>2018-03-14 11:51:02 +0100
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-04-11 07:26:27 +0000
commitd6bb6c501809fbf59fa574c3b97615d445c300e6 (patch)
tree34d0efb8e7227b9a1c99f18fccff28727fd41450 /dist
parent54e82eca80b080d6cc771ca22006ba00bc469ead (diff)
Clang: Link clang driver with clang-tidy/clazy libraries
There's no easy way to build clang-tidy .dll and load it dynamically. The same for clazy. Required for the tools based on clang executable which want extra diagnostics from clang plugins. Change-Id: I425d10c1a87e3051a44b9ffd13eb2968110101af Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
Diffstat (limited to 'dist')
-rw-r--r--dist/clang/patches/220_Link-clang-tools.patch37
1 files changed, 37 insertions, 0 deletions
diff --git a/dist/clang/patches/220_Link-clang-tools.patch b/dist/clang/patches/220_Link-clang-tools.patch
new file mode 100644
index 0000000000..c9e0889f33
--- /dev/null
+++ b/dist/clang/patches/220_Link-clang-tools.patch
@@ -0,0 +1,37 @@
+diff --git a/tools/driver/CMakeLists.txt b/tools/driver/CMakeLists.txt
+index 901b6d62e4..178e7a1882 100644
+--- a/tools/driver/CMakeLists.txt
++++ b/tools/driver/CMakeLists.txt
+@@ -43,6 +43,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 9f37c428ff..475c5f84c0 100644
+--- a/tools/driver/driver.cpp
++++ b/tools/driver/driver.cpp
+@@ -517,3 +517,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;