From 74f64b21aa92df87ee1a34d8c72938d60dc62dee Mon Sep 17 00:00:00 2001 From: Hans Wennborg Date: Wed, 31 Jul 2019 07:42:31 +0000 Subject: [PATCH] Merging r367340 and r367341: (Minus the linuxkernel part, which is not present on the branch.) ------------------------------------------------------------------------ r367340 | nico | 2019-07-30 20:16:55 +0200 (Tue, 30 Jul 2019) | 6 lines gn build: Fix check-clang-tools after r362702. 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 ------------------------------------------------------------------------ ------------------------------------------------------------------------ r367341 | nico | 2019-07-30 20:19:13 +0200 (Tue, 30 Jul 2019) | 1 line gn build: Update comment I failed to update in r367340 / D65462 ------------------------------------------------------------------------ git-svn-id: https://llvm.org/svn/llvm-project/llvm/branches/release_90@367390 91177308-0d34-0410-b5e6-96231b3b80d8 --- .../clang-include-fixer/plugin/BUILD.gn | 18 ++++++++++++++++++ .../clang-tidy/plugin/BUILD.gn | 3 +++ .../gn/secondary/clang/tools/libclang/BUILD.gn | 18 +++++++++++++++--- 3 files changed, 36 insertions(+), 3 deletions(-) create mode 100644 utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn diff --git a/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn b/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn new file mode 100644 index 00000000000..ce4617556bf --- /dev/null +++ b/utils/gn/secondary/clang-tools-extra/clang-include-fixer/plugin/BUILD.gn @@ -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", + ] +} diff --git a/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn b/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn index 1d033e87ee5..ec6d4ce7887 100644 --- a/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn +++ b/utils/gn/secondary/clang-tools-extra/clang-tidy/plugin/BUILD.gn @@ -1,3 +1,5 @@ +import("//clang/lib/StaticAnalyzer/Frontend/enable.gni") + static_library("plugin") { output_name = "clangTidyPlugin" configs += [ "//llvm/utils/gn/build:clang_code" ] @@ -16,6 +18,7 @@ static_library("plugin") { "//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", diff --git a/utils/gn/secondary/clang/tools/libclang/BUILD.gn b/utils/gn/secondary/clang/tools/libclang/BUILD.gn index 567588478e6..eb04b3071fa 100644 --- a/utils/gn/secondary/clang/tools/libclang/BUILD.gn +++ b/utils/gn/secondary/clang/tools/libclang/BUILD.gn @@ -3,8 +3,6 @@ import("//llvm/version.gni") # This build file is just enough to get check-clang to pass, it's missing # several things from the CMake build: -# - linking in clangTidyPlugin and clangIncludeFixerPlugin from -# clang-tools-extra (which doesn't have any GN build files yet) # - using libclang.exports # - a build target copying the Python bindings # - the GN linux build always builds without -fPIC (as if LLVM_ENABLE_PIC=OFF @@ -39,8 +37,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 = [ -- 2.40.0