Skip to content

Commit a513b70

Browse files
authored
[clang-tidy][custom-check][NFC] fix test when CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS disable (llvm#159809)
1 parent 5f86d0b commit a513b70

File tree

8 files changed

+17
-3
lines changed

8 files changed

+17
-3
lines changed

clang-tools-extra/test/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
99

1010
llvm_canonicalize_cmake_booleans(
1111
CLANG_TIDY_ENABLE_STATIC_ANALYZER
12+
CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
1213
CLANG_PLUGIN_SUPPORT
1314
LLVM_INSTALL_TOOLCHAIN_ONLY
1415
)

clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: custom-check
12
// RUN: %check_clang_tidy %s custom-* %t --config-file=%S/Inputs/incorrect-clang-tidy.yml
23

34
// CHECK-MESSAGES: warning: 1:1: Matcher not found: varDeclInvalid in 'test-let-bind-invalid-2' [clang-tidy-config]

clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: custom-check
12
// RUN: %check_clang_tidy %s custom-test-let-bind %t --config-file=%S/Inputs/clang-tidy.yml
23

34
extern long E;

clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
// REQUIRES: custom-check
12
// RUN: %check_clang_tidy %s custom-* %t --config-file=%S/Inputs/clang-tidy.yml
23

34
extern long E;

clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
// REQUIRES: shell
2+
// REQUIRES: custom-check
3+
14
// RUN: sed -e "s:INPUT_DIR:%S/Inputs/custom-query-check:g" -e "s:OUT_DIR:%t:g" -e "s:MAIN_FILE:%s:g" %S/Inputs/custom-query-check/vfsoverlay.yaml > %t.yaml
25
// RUN: clang-tidy --experimental-custom-checks %t/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SAME-DIR
36
// RUN: clang-tidy --experimental-custom-checks %t/subdir/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SUB-DIR-BASE
@@ -6,7 +9,6 @@
69
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SUB-DIR-APPEND
710
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --list-checks | FileCheck %s --check-prefix=LIST-CHECK
811
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --dump-config | FileCheck %s --check-prefix=DUMP-CONFIG
9-
// REQUIRES: shell
1012

1113

1214
long V;

clang-tools-extra/test/lit.cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,8 @@
5454

5555
if config.clang_tidy_staticanalyzer:
5656
config.available_features.add("static-analyzer")
57-
57+
if config.clang_tidy_custom_check:
58+
config.available_features.add("custom-check")
5859
python_exec = shlex.quote(config.python_executable)
5960
check_clang_tidy = os.path.join(
6061
config.test_source_root, "clang-tidy", "check_clang_tidy.py"

clang-tools-extra/test/lit.site.cfg.py.in

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ config.python_executable = "@Python3_EXECUTABLE@"
1010
config.target_triple = "@LLVM_TARGET_TRIPLE@"
1111
config.host_triple = "@LLVM_HOST_TRIPLE@"
1212
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
13+
config.clang_tidy_custom_check = @CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS@
1314
config.has_plugins = @CLANG_PLUGIN_SUPPORT@
1415
# Support substitution of the tools and libs dirs with user parameters. This is
1516
# used when we can't determine the tool dir at configuration time.

clang-tools-extra/unittests/clang-tidy/CMakeLists.txt

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ target_link_libraries(ClangTidyTests
5454
PRIVATE
5555
clangTidy
5656
clangTidyAndroidModule
57-
clangTidyCustomModule
5857
clangTidyGoogleModule
5958
clangTidyMiscModule
6059
clangTidyLLVMModule
@@ -65,3 +64,10 @@ target_link_libraries(ClangTidyTests
6564
LLVMTestingAnnotations
6665
LLVMTestingSupport
6766
)
67+
68+
if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
69+
target_link_libraries(ClangTidyTests
70+
PRIVATE
71+
clangTidyCustomModule
72+
)
73+
endif()

0 commit comments

Comments
 (0)