]> granicus.if.org Git - clang/commitdiff
Link include-fixer into libclang if clang-tools-extra is checked out.
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 17 Nov 2016 15:22:36 +0000 (15:22 +0000)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 17 Nov 2016 15:22:36 +0000 (15:22 +0000)
include-fixer only slightly bloats the size of libclang, but since
libclang has no explicit plugin mechanism it's the only way of getting
this to work. Clang-tidy is already there and so far there weren't many
complaints ;)

This is designed to be easy to remove again if libclang ever grows
proper plugin support.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@287229 91177308-0d34-0410-b5e6-96231b3b80d8

tools/libclang/CIndex.cpp
tools/libclang/CMakeLists.txt

index b90da16701d7af85cfb947770d3a785898d58fdb..9a61560ff62f0f29d36c1cdf4a2d441c5325acf2 100644 (file)
@@ -8120,4 +8120,10 @@ cxindex::Logger::~Logger() {
 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;
 #endif
index 630be124660dff3a69c91e660e8b40daf9220e28..2dd6703076360c1eba982068fd2fb4169820f17b 100644 (file)
@@ -50,6 +50,7 @@ endif ()
 if (TARGET clangTidyPlugin)
   add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
   list(APPEND LIBS clangTidyPlugin)
+  list(APPEND LIBS clangIncludeFixerPlugin)
 endif ()
 
 find_library(DL_LIBRARY_PATH dl)