summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNikolai Kosjar <nikolai.kosjar@qt.io>2018-04-17 09:03:13 +0200
committerIvan Donchevskii <ivan.donchevskii@qt.io>2018-10-02 06:29:26 +0000
commita59ff75e679c7e595f6bf0d16e5ed1eee01b0f45 (patch)
tree227f50cfa87c27abf63ed10707b737a8f4e4b289
parent0513b409d5e34b2d2a28ae21b6d620cc52de0e57 (diff)
[libclang] Statically link clazy into libclang
This enables libclang to emit clazy diagnostics, too. This is a cherry pick from commit 6cf3d21e004e99cb7d8f8314b3b6103f2e8a5482 Change-Id: I47acc9f2d74f61de2b4161cc61785edd45012f82 Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
-rw-r--r--tools/libclang/CIndex.cpp4
-rw-r--r--tools/libclang/CMakeLists.txt1
2 files changed, 5 insertions, 0 deletions
diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp
index 499d9abf9a..58d565fa82 100644
--- a/tools/libclang/CIndex.cpp
+++ b/tools/libclang/CIndex.cpp
@@ -8739,4 +8739,8 @@ static int LLVM_ATTRIBUTE_UNUSED ClangTidyPluginAnchorDestination =
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;
#endif
diff --git a/tools/libclang/CMakeLists.txt b/tools/libclang/CMakeLists.txt
index e539c8308e..adb5d3ad7b 100644
--- a/tools/libclang/CMakeLists.txt
+++ b/tools/libclang/CMakeLists.txt
@@ -51,6 +51,7 @@ if (TARGET clangTidyPlugin)
add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
list(APPEND LIBS clangTidyPlugin)
list(APPEND LIBS clangIncludeFixerPlugin)
+ list(APPEND LIBS clazyPlugin)
if(LLVM_ENABLE_MODULES)
list(APPEND LLVM_COMPILE_FLAGS "-fmodules-ignore-macro=CLANG_TOOL_EXTRA_BUILD")
endif()