gn build: Fix check-clang-tools after r362702.
authorNico Weber <nicolasweber@gmx.de>
Tue, 30 Jul 2019 18:16:55 +0000 (18:16 +0000)
committerNico Weber <nicolasweber@gmx.de>
Tue, 30 Jul 2019 18:16:55 +0000 (18:16 +0000)
r362702 added a test that requires clang-tidy to be linked
into libclang, so add that to the gn build.

Differential Revision: https://reviews.llvm.org/D65462

llvm-svn: 367340

llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn [new file with mode: 0644]
llvm/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn
llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn

diff --git a/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn
new file mode 100644 (file)
index 0000000..ce46175
--- /dev/null
@@ -0,0 +1,18 @@
+static_library("plugin") {
+  output_name = "clangIncludeFixerPlugin"
+  configs += [ "//llvm/utils/gn/build:clang_code" ]
+  deps = [
+    "//clang-tools-extra/clang-include-fixer",
+    "//clang/lib/AST",
+    "//clang/lib/Basic",
+    "//clang/lib/Frontend",
+    "//clang/lib/Parse",
+    "//clang/lib/Sema",
+    "//clang/lib/Tooling",
+    "//llvm/utils/gn/build/libs/pthread",
+  ]
+
+  sources = [
+    "IncludeFixerPlugin.cpp",
+  ]
+}
index 1d033e8..476ef11 100644 (file)
@@ -1,3 +1,5 @@
+import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+
 static_library("plugin") {
   output_name = "clangTidyPlugin"
   configs += [ "//llvm/utils/gn/build:clang_code" ]
@@ -12,10 +14,12 @@ static_library("plugin") {
     "//clang-tools-extra/clang-tidy/fuchsia",
     "//clang-tools-extra/clang-tidy/google",
     "//clang-tools-extra/clang-tidy/hicpp",
+    "//clang-tools-extra/clang-tidy/linuxkernel",
     "//clang-tools-extra/clang-tidy/llvm",
     "//clang-tools-extra/clang-tidy/misc",
     "//clang-tools-extra/clang-tidy/modernize",
     "//clang-tools-extra/clang-tidy/objc",
+    "//clang-tools-extra/clang-tidy/openmp",
     "//clang-tools-extra/clang-tidy/performance",
     "//clang-tools-extra/clang-tidy/portability",
     "//clang-tools-extra/clang-tidy/readability",
index 5675884..86e1453 100644 (file)
@@ -39,8 +39,22 @@ target(libclang_target_type, "libclang") {
     deps += [ "//clang/lib/ARCMigrate" ]
   }
 
+  defines = []
+
+  # FIXME: Once the GN build has a way to select which bits to build,
+  # only include this dependency if clang-tools-extra is part of the build.
+  # FIXME: libclang depending on anything in clang-tools-extra seems like
+  # a layering violation.
+  if (true) {
+    defines += [ "CLANG_TOOL_EXTRA_BUILD" ]
+    deps += [
+      "//clang-tools-extra/clang-include-fixer/plugin",
+      "//clang-tools-extra/clang-tidy/plugin",
+    ]
+  }
+
   if (host_os == "win") {
-    defines = [ "_CINDEX_LIB_" ]
+    defines += [ "_CINDEX_LIB_" ]
   }
 
   sources = [