summaryrefslogtreecommitdiffstats
path: root/clang/tools/libclang
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2016-03-03 08:58:18 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2016-03-03 08:58:18 +0000
commitc1ffdab3fb48cc8b6a5aff95d4015b2a0c97f3cc (patch)
tree6e95c3510eaf0e62a12ffcf2dc206a262414945d /clang/tools/libclang
parent8f5eb56df37566187e9132fb905d7fcbd9fd4732 (diff)
downloadbcm5719-llvm-c1ffdab3fb48cc8b6a5aff95d4015b2a0c97f3cc.tar.gz
bcm5719-llvm-c1ffdab3fb48cc8b6a5aff95d4015b2a0c97f3cc.zip
[libclang] Link clang-tidy plugin into libclang if present.
This is a sad workaround for the lack of plugin support in libclang. Depends on D17807, a tools-extra change that also contains the test case. This is designed to be easy to remove again if libclang ever grows proper plugin support. Differential Revision: http://reviews.llvm.org/D17808 llvm-svn: 262596
Diffstat (limited to 'clang/tools/libclang')
-rw-r--r--clang/tools/libclang/CIndex.cpp7
-rw-r--r--clang/tools/libclang/CMakeLists.txt5
2 files changed, 12 insertions, 0 deletions
diff --git a/clang/tools/libclang/CIndex.cpp b/clang/tools/libclang/CIndex.cpp
index 59e34b84c09..5741eeaf831 100644
--- a/clang/tools/libclang/CIndex.cpp
+++ b/clang/tools/libclang/CIndex.cpp
@@ -7933,3 +7933,10 @@ cxindex::Logger::~Logger() {
OS << "--------------------------------------------------\n";
}
}
+
+#ifdef CLANG_TOOL_EXTRA_BUILD
+// 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;
+#endif
diff --git a/clang/tools/libclang/CMakeLists.txt b/clang/tools/libclang/CMakeLists.txt
index 741e02ab3b2..5af5930043b 100644
--- a/clang/tools/libclang/CMakeLists.txt
+++ b/clang/tools/libclang/CMakeLists.txt
@@ -47,6 +47,11 @@ if (CLANG_ENABLE_ARCMT)
list(APPEND LIBS clangARCMigrate)
endif ()
+if (CLANG_TOOL_EXTRA_BUILD)
+ add_definitions(-DCLANG_TOOL_EXTRA_BUILD)
+ list(APPEND LIBS clangTidyPlugin)
+endif ()
+
find_library(DL_LIBRARY_PATH dl)
if (DL_LIBRARY_PATH)
list(APPEND LIBS dl)
OpenPOWER on IntegriCloud