This revision was automatically updated to reflect the committed changes.
Closed by commit rL262596: [libclang] Link clang-tidy plugin into libclang if 
present. (authored by d0k).

Changed prior to commit:
  http://reviews.llvm.org/D17808?vs=49616&id=49719#toc

Repository:
  rL LLVM

http://reviews.llvm.org/D17808

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

Index: cfe/trunk/tools/libclang/CMakeLists.txt
===================================================================
--- cfe/trunk/tools/libclang/CMakeLists.txt
+++ cfe/trunk/tools/libclang/CMakeLists.txt
@@ -47,6 +47,11 @@
   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)
Index: cfe/trunk/tools/libclang/CIndex.cpp
===================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -7933,3 +7933,10 @@
     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


Index: cfe/trunk/tools/libclang/CMakeLists.txt
===================================================================
--- cfe/trunk/tools/libclang/CMakeLists.txt
+++ cfe/trunk/tools/libclang/CMakeLists.txt
@@ -47,6 +47,11 @@
   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)
Index: cfe/trunk/tools/libclang/CIndex.cpp
===================================================================
--- cfe/trunk/tools/libclang/CIndex.cpp
+++ cfe/trunk/tools/libclang/CIndex.cpp
@@ -7933,3 +7933,10 @@
     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
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to