[llvm] e20fcf0 - Unbreak clang-tidy tests after D79599 / e9b4113902850.
Nico Weber via llvm-commits
llvm-commits at lists.llvm.org
Fri May 8 09:37:52 PDT 2020
Author: Nico Weber
Date: 2020-05-08T12:37:33-04:00
New Revision: e20fcf0504e598c4f9f6ee77ca56d7431f9194c3
URL: https://github.com/llvm/llvm-project/commit/e20fcf0504e598c4f9f6ee77ca56d7431f9194c3
DIFF: https://github.com/llvm/llvm-project/commit/e20fcf0504e598c4f9f6ee77ca56d7431f9194c3.diff
LOG: Unbreak clang-tidy tests after D79599 / e9b4113902850.
Added:
llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni
Modified:
clang-tools-extra/test/CMakeLists.txt
clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
clang-tools-extra/test/lit.site.cfg.py.in
llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
Removed:
################################################################################
diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
index a2cedeaaa53a..60217b8c50cd 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -15,7 +15,10 @@ endif ()
string(REPLACE ${CMAKE_CFG_INTDIR} ${LLVM_BUILD_MODE} CLANG_TOOLS_DIR ${LLVM_RUNTIME_OUTPUT_INTDIR})
-llvm_canonicalize_cmake_booleans(CLANG_ENABLE_STATIC_ANALYZER)
+llvm_canonicalize_cmake_booleans(
+ CLANG_ENABLE_STATIC_ANALYZER
+ LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA
+ )
configure_lit_site_cfg(
${CMAKE_CURRENT_SOURCE_DIR}/lit.site.cfg.py.in
@@ -58,8 +61,6 @@ set(CLANG_TOOLS_TEST_DEPS
# Unit tests
ExtraToolsUnitTests
- # For the clang-tidy libclang integration test.
- c-index-test
# clang-tidy tests require it.
clang-resource-headers
@@ -67,6 +68,10 @@ set(CLANG_TOOLS_TEST_DEPS
# Clang-tidy tests need clang for building modules.
clang
)
+if (LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA)
+ # For the clang-tidy libclang integration test.
+ set(CLANG_TOOLS_TEST_DEPS ${CLANG_TOOLS_TEST_DEPS} "c-index-test")
+endif ()
# Add lit test dependencies.
set(LLVM_UTILS_DEPS
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
index 12eb6febbacf..e57350289c25 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/basic.cpp
@@ -1,5 +1,4 @@
// RUN: clang-tidy %s -checks='-*,llvm-namespace-comment' -- | FileCheck %s
-// RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin -Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang -checks='-*,llvm-namespace-comment' 2>&1 | FileCheck %s
namespace i {
}
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
index 671c350828b2..d10c16620749 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolint-plugin.cpp
@@ -1,4 +1,4 @@
-// REQUIRES: static-analyzer
+// REQUIRES: static-analyzer, libclang_include_clang_tools_extra
// RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin -Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang -checks='-*,google-explicit-constructor,clang-diagnostic-unused-variable,clang-analyzer-core.UndefinedBinaryOperatorResult' -Wunused-variable -I%S/Inputs/nolint 2>&1 | FileCheck %s
#include "trigger_warning.h"
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
index 0c84b9340aa3..4835f4c52a45 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintnextline-plugin.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: libclang_include_clang_tools_extra
// RUN: c-index-test -test-load-source-reparse 2 all %s -Xclang -add-plugin -Xclang clang-tidy -Xclang -plugin-arg-clang-tidy -Xclang -checks='-*,google-explicit-constructor' 2>&1 | FileCheck %s
class A { A(int i); };
diff --git a/clang-tools-extra/test/lit.site.cfg.py.in b/clang-tools-extra/test/lit.site.cfg.py.in
index 5dc112a56126..31ce2eaa27d0 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -11,6 +11,7 @@ config.clang_libs_dir = "@SHLIBDIR@"
config.python_executable = "@Python3_EXECUTABLE@"
config.target_triple = "@TARGET_TRIPLE@"
config.clang_staticanalyzer = @CLANG_ENABLE_STATIC_ANALYZER@
+config.libclang_include_clang_tools_extra = @LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA@
# Support substitution of the tools and libs dirs with user parameters. This is
# used when we can't determine the tool dir at configuration time.
diff --git a/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn b/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
index 832028dce654..383cb2e1b15c 100644
--- a/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang-tools-extra/test/BUILD.gn
@@ -1,4 +1,5 @@
import("//clang/lib/StaticAnalyzer/Frontend/enable.gni")
+import("//clang/tools/libclang/include_clang_tools_extra.gni")
import("//llvm/triples.gni")
import("//llvm/utils/gn/build/write_cmake_config.gni")
import("clang_tools_extra_lit_site_cfg_files.gni")
@@ -42,6 +43,12 @@ write_lit_config("lit_site_cfg") {
} else {
extra_values += [ "CLANG_ENABLE_STATIC_ANALYZER=0" ]
}
+
+ if (libclang_include_clang_tools_extra) {
+ extra_values += [ "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=1" ]
+ } else {
+ extra_values += [ "LIBCLANG_INCLUDE_CLANG_TOOLS_EXTRA=0" ]
+ }
}
write_lit_config("lit_unit_site_cfg") {
diff --git a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
index 04c82ebdba29..5c97bebf137f 100644
--- a/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
+++ b/llvm/utils/gn/secondary/clang/tools/libclang/BUILD.gn
@@ -1,4 +1,5 @@
import("//clang/lib/ARCMigrate/enable.gni")
+import("//clang/tools/libclang/include_clang_tools_extra.gni")
import("//llvm/version.gni")
# This build file is just enough to get check-clang to pass, it's missing
@@ -9,11 +10,6 @@ import("//llvm/version.gni")
# in the CMake build), so libclang is always a static library on linux
# - the GN build doesn't have LIBCLANG_BUILD_STATIC
-declare_args() {
- # Whether to include code from clang-tools-extra in libclang.
- libclang_include_clang_tools_extra = false
-}
-
libclang_target_type = "shared_library"
if (host_os != "win" && host_os != "mac") {
# ELF targets need -fPIC to build shared libs but they aren't on by default.
diff --git a/llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni b/llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni
new file mode 100644
index 000000000000..41502f22a35b
--- /dev/null
+++ b/llvm/utils/gn/secondary/clang/tools/libclang/include_clang_tools_extra.gni
@@ -0,0 +1,5 @@
+declare_args() {
+ # Whether to include code from clang-tools-extra in libclang.
+ libclang_include_clang_tools_extra = false
+}
+
More information about the llvm-commits
mailing list