r287229 - Link include-fixer into libclang if clang-tools-extra is checked out.

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Thu Nov 17 07:22:37 PST 2016


Author: d0k
Date: Thu Nov 17 09:22:36 2016
New Revision: 287229

URL: http://llvm.org/viewvc/llvm-project?rev=287229&view=rev
Log:
Link include-fixer into libclang if clang-tools-extra is checked out.

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.

Modified:
    cfe/trunk/tools/libclang/CIndex.cpp
    cfe/trunk/tools/libclang/CMakeLists.txt

Modified: cfe/trunk/tools/libclang/CIndex.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CIndex.cpp?rev=287229&r1=287228&r2=287229&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp (original)
+++ cfe/trunk/tools/libclang/CIndex.cpp Thu Nov 17 09:22:36 2016
@@ -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

Modified: cfe/trunk/tools/libclang/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/tools/libclang/CMakeLists.txt?rev=287229&r1=287228&r2=287229&view=diff
==============================================================================
--- cfe/trunk/tools/libclang/CMakeLists.txt (original)
+++ cfe/trunk/tools/libclang/CMakeLists.txt Thu Nov 17 09:22:36 2016
@@ -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)




More information about the cfe-commits mailing list