From 6cf3d21e004e99cb7d8f8314b3b6103f2e8a5482 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 17 Apr 2018 09:03:13 +0200 Subject: [libclang] Statically link clazy into libclang This enables libclang to emit clazy diagnostics, too. Change-Id: I47acc9f2d74f61de2b4161cc61785edd45012f82 Reviewed-by: Ivan Donchevskii --- tools/libclang/CIndex.cpp | 4 ++++ tools/libclang/CMakeLists.txt | 1 + 2 files changed, 5 insertions(+) diff --git a/tools/libclang/CIndex.cpp b/tools/libclang/CIndex.cpp index f682d6de01..8d288b5dd5 100644 --- a/tools/libclang/CIndex.cpp +++ b/tools/libclang/CIndex.cpp @@ -8679,4 +8679,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 4440637820..6798d2ee8b 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() -- cgit v1.2.3