-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[clang-tidy][custom-check][NFC] fix test when CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS disable
#159809
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
…CUSTOM_CHECKS disable
Member
|
@llvm/pr-subscribers-clang-tidy Author: Congcong Cai (HerrCai0907) ChangesFull diff: https://github.com/llvm/llvm-project/pull/159809.diff 8 Files Affected:
diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
index d8175d1b2b6d0..a70d2ef2d92f2 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -9,6 +9,7 @@ set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
llvm_canonicalize_cmake_booleans(
CLANG_TIDY_ENABLE_STATIC_ANALYZER
+ CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
CLANG_PLUGIN_SUPPORT
LLVM_INSTALL_TOOLCHAIN_ONLY
)
diff --git a/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp b/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp
index f9a73750b4c3e..428276019bfb6 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: custom-check
// RUN: %check_clang_tidy %s custom-* %t --config-file=%S/Inputs/incorrect-clang-tidy.yml
// CHECK-MESSAGES: warning: 1:1: Matcher not found: varDeclInvalid in 'test-let-bind-invalid-2' [clang-tidy-config]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp b/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp
index 962313ddb587b..cec3caefa9279 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: custom-check
// RUN: %check_clang_tidy %s custom-test-let-bind %t --config-file=%S/Inputs/clang-tidy.yml
extern long E;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp b/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp
index e9a27301bd611..6b34669054df8 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: custom-check
// RUN: %check_clang_tidy %s custom-* %t --config-file=%S/Inputs/clang-tidy.yml
extern long E;
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp
index 8d0bc2bed180d..dc1f3f3754079 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp
@@ -1,3 +1,6 @@
+// REQUIRES: shell
+// REQUIRES: custom-check
+
// 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
// RUN: clang-tidy --experimental-custom-checks %t/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SAME-DIR
// 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 @@
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SUB-DIR-APPEND
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --list-checks | FileCheck %s --check-prefix=LIST-CHECK
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --dump-config | FileCheck %s --check-prefix=DUMP-CONFIG
-// REQUIRES: shell
long V;
diff --git a/clang-tools-extra/test/lit.cfg.py b/clang-tools-extra/test/lit.cfg.py
index b503c659f6022..c1da37d61bd61 100644
--- a/clang-tools-extra/test/lit.cfg.py
+++ b/clang-tools-extra/test/lit.cfg.py
@@ -54,7 +54,8 @@
if config.clang_tidy_staticanalyzer:
config.available_features.add("static-analyzer")
-
+if config.clang_tidy_custom_check:
+ config.available_features.add("custom-check")
python_exec = shlex.quote(config.python_executable)
check_clang_tidy = os.path.join(
config.test_source_root, "clang-tidy", "check_clang_tidy.py"
diff --git a/clang-tools-extra/test/lit.site.cfg.py.in b/clang-tools-extra/test/lit.site.cfg.py.in
index e6503a4c097ca..152ea6be2771c 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -10,6 +10,7 @@ config.python_executable = "@Python3_EXECUTABLE@"
config.target_triple = "@LLVM_TARGET_TRIPLE@"
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
+config.clang_tidy_custom_check = @CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS@
config.has_plugins = @CLANG_PLUGIN_SUPPORT@
# 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/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
index a3f20f5c1359f..f4b52de4251eb 100644
--- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
@@ -54,7 +54,6 @@ target_link_libraries(ClangTidyTests
PRIVATE
clangTidy
clangTidyAndroidModule
- clangTidyCustomModule
clangTidyGoogleModule
clangTidyMiscModule
clangTidyLLVMModule
@@ -65,3 +64,10 @@ target_link_libraries(ClangTidyTests
LLVMTestingAnnotations
LLVMTestingSupport
)
+
+if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
+ target_link_libraries(ClangTidyTests
+ PRIVATE
+ clangTidyCustomModule
+ )
+endif()
\ No newline at end of file
|
Member
|
@llvm/pr-subscribers-clang-tools-extra Author: Congcong Cai (HerrCai0907) ChangesFull diff: https://github.com/llvm/llvm-project/pull/159809.diff 8 Files Affected:
diff --git a/clang-tools-extra/test/CMakeLists.txt b/clang-tools-extra/test/CMakeLists.txt
index d8175d1b2b6d0..a70d2ef2d92f2 100644
--- a/clang-tools-extra/test/CMakeLists.txt
+++ b/clang-tools-extra/test/CMakeLists.txt
@@ -9,6 +9,7 @@ set(CLANG_TOOLS_BINARY_DIR "${CMAKE_CURRENT_BINARY_DIR}/..")
llvm_canonicalize_cmake_booleans(
CLANG_TIDY_ENABLE_STATIC_ANALYZER
+ CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS
CLANG_PLUGIN_SUPPORT
LLVM_INSTALL_TOOLCHAIN_ONLY
)
diff --git a/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp b/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp
index f9a73750b4c3e..428276019bfb6 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/custom/query-incorrect-query.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: custom-check
// RUN: %check_clang_tidy %s custom-* %t --config-file=%S/Inputs/incorrect-clang-tidy.yml
// CHECK-MESSAGES: warning: 1:1: Matcher not found: varDeclInvalid in 'test-let-bind-invalid-2' [clang-tidy-config]
diff --git a/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp b/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp
index 962313ddb587b..cec3caefa9279 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/custom/query-partially-active-check.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: custom-check
// RUN: %check_clang_tidy %s custom-test-let-bind %t --config-file=%S/Inputs/clang-tidy.yml
extern long E;
diff --git a/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp b/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp
index e9a27301bd611..6b34669054df8 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/custom/query.cpp
@@ -1,3 +1,4 @@
+// REQUIRES: custom-check
// RUN: %check_clang_tidy %s custom-* %t --config-file=%S/Inputs/clang-tidy.yml
extern long E;
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp
index 8d0bc2bed180d..dc1f3f3754079 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/custom-query-check.cpp
@@ -1,3 +1,6 @@
+// REQUIRES: shell
+// REQUIRES: custom-check
+
// 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
// RUN: clang-tidy --experimental-custom-checks %t/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SAME-DIR
// 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 @@
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml | FileCheck %s --check-prefix=CHECK-SUB-DIR-APPEND
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --list-checks | FileCheck %s --check-prefix=LIST-CHECK
// RUN: clang-tidy --experimental-custom-checks %t/subdir-append/main.cpp -checks='-*,custom-*' -vfsoverlay %t.yaml --dump-config | FileCheck %s --check-prefix=DUMP-CONFIG
-// REQUIRES: shell
long V;
diff --git a/clang-tools-extra/test/lit.cfg.py b/clang-tools-extra/test/lit.cfg.py
index b503c659f6022..c1da37d61bd61 100644
--- a/clang-tools-extra/test/lit.cfg.py
+++ b/clang-tools-extra/test/lit.cfg.py
@@ -54,7 +54,8 @@
if config.clang_tidy_staticanalyzer:
config.available_features.add("static-analyzer")
-
+if config.clang_tidy_custom_check:
+ config.available_features.add("custom-check")
python_exec = shlex.quote(config.python_executable)
check_clang_tidy = os.path.join(
config.test_source_root, "clang-tidy", "check_clang_tidy.py"
diff --git a/clang-tools-extra/test/lit.site.cfg.py.in b/clang-tools-extra/test/lit.site.cfg.py.in
index e6503a4c097ca..152ea6be2771c 100644
--- a/clang-tools-extra/test/lit.site.cfg.py.in
+++ b/clang-tools-extra/test/lit.site.cfg.py.in
@@ -10,6 +10,7 @@ config.python_executable = "@Python3_EXECUTABLE@"
config.target_triple = "@LLVM_TARGET_TRIPLE@"
config.host_triple = "@LLVM_HOST_TRIPLE@"
config.clang_tidy_staticanalyzer = @CLANG_TIDY_ENABLE_STATIC_ANALYZER@
+config.clang_tidy_custom_check = @CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS@
config.has_plugins = @CLANG_PLUGIN_SUPPORT@
# 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/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
index a3f20f5c1359f..f4b52de4251eb 100644
--- a/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
+++ b/clang-tools-extra/unittests/clang-tidy/CMakeLists.txt
@@ -54,7 +54,6 @@ target_link_libraries(ClangTidyTests
PRIVATE
clangTidy
clangTidyAndroidModule
- clangTidyCustomModule
clangTidyGoogleModule
clangTidyMiscModule
clangTidyLLVMModule
@@ -65,3 +64,10 @@ target_link_libraries(ClangTidyTests
LLVMTestingAnnotations
LLVMTestingSupport
)
+
+if(CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS)
+ target_link_libraries(ClangTidyTests
+ PRIVATE
+ clangTidyCustomModule
+ )
+endif()
\ No newline at end of file
|
CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS disable (#159809)
CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS disable (#159809)CLANG_TIDY_ENABLE_QUERY_BASED_CUSTOM_CHECKS disable
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No description provided.