[clang-tools-extra] 12babb0 - [clang-tidy] Disable implicit search for a compilation db in some tests
Justin Bogner via cfe-commits
cfe-commits at lists.llvm.org
Thu Aug 17 08:46:42 PDT 2023
Author: Justin Bogner
Date: 2023-08-17T08:29:52-07:00
New Revision: 12babb08189cc1ca84d7fbb33d3c9726583b2e5a
URL: https://github.com/llvm/llvm-project/commit/12babb08189cc1ca84d7fbb33d3c9726583b2e5a
DIFF: https://github.com/llvm/llvm-project/commit/12babb08189cc1ca84d7fbb33d3c9726583b2e5a.diff
LOG: [clang-tidy] Disable implicit search for a compilation db in some tests
These tests were failing for me on windows with a very curious error:
error: argument unused during compilation: '/Zc:preprocessor'
It turns out that they were walking up the directory structure and
finding the compilation DB in my top level llvm-project directory.
Add `--` to the ends of the clang-tidy command lines so that they
don't go looking for random compilation databases. Also replace args
specified with `-extra-arg` with directly specifying them to the
FixedCompilationDatabase.
Differential Revision: https://reviews.llvm.org/D158157
Added:
Modified:
clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp
clang-tools-extra/test/clang-tidy/checkers/readability/else-after-return-pp-no-crash.cpp
clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-case-violation.cpp
clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-multiple-TUs.cpp
clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp
Removed:
################################################################################
diff --git a/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp b/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp
index 13ab5135953b36..38ffcbd7e805d8 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/cert/mem57-cpp-cpp17.cpp
@@ -1,6 +1,6 @@
// RUN: %check_clang_tidy %s -std=c++14 cert-mem57-cpp %t
-// RUN: clang-tidy --extra-arg='-std=c++17' --extra-arg='-faligned-allocation' -checks='-*,cert-mem57-cpp' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s
-// RUN: clang-tidy --extra-arg='-std=c++20' --extra-arg='-faligned-allocation' -checks='-*,cert-mem57-cpp' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s
+// RUN: clang-tidy -checks='-*,cert-mem57-cpp' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation
+// RUN: clang-tidy -checks='-*,cert-mem57-cpp' --extra-arg=-Wno-unused-variable --warnings-as-errors='*' %s -- -std=c++17 -faligned-allocation
struct alignas(128) Vector {
char Elems[128];
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/else-after-return-pp-no-crash.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/else-after-return-pp-no-crash.cpp
index a10868fbc3944f..82bacd54317922 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/else-after-return-pp-no-crash.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/else-after-return-pp-no-crash.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-tidy %s -checks=-*,readability-else-after-return
+// RUN: clang-tidy %s -checks=-*,readability-else-after-return --
// We aren't concerned about the output here, just want to ensure clang-tidy doesn't crash.
void foo() {
diff --git a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-case-violation.cpp b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-case-violation.cpp
index 09245e6541a0b3..6102a2e7031afb 100644
--- a/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-case-violation.cpp
+++ b/clang-tools-extra/test/clang-tidy/checkers/readability/identifier-naming-case-violation.cpp
@@ -5,7 +5,7 @@
// RUN: readability-identifier-naming.ClassCase: UUPER_CASE, \
// RUN: readability-identifier-naming.StructCase: CAMEL, \
// RUN: readability-identifier-naming.EnumCase: AnY_cASe, \
-// RUN: }}" 2>&1 | FileCheck %s --implicit-check-not="{{warning|error}}:"
+// RUN: }}" -- 2>&1 | FileCheck %s --implicit-check-not="{{warning|error}}:"
// CHECK-DAG: warning: invalid configuration value 'camelback' for option 'readability-identifier-naming.FunctionCase'; did you mean 'camelBack'? [clang-tidy-config]
// CHECK-DAG: warning: invalid configuration value 'UUPER_CASE' for option 'readability-identifier-naming.ClassCase'; did you mean 'UPPER_CASE'? [clang-tidy-config]
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-multiple-TUs.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-multiple-TUs.cpp
index 773e023cb22c9d..8264e399273e52 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-multiple-TUs.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/nolintbeginend-multiple-TUs.cpp
@@ -1,4 +1,4 @@
-// RUN: clang-tidy %S/Inputs/nolintbeginend/1st-translation-unit.cpp %S/Inputs/nolintbeginend/2nd-translation-unit.cpp --checks='-*,google-explicit-constructor' 2>&1 | FileCheck %s
+// RUN: clang-tidy %S/Inputs/nolintbeginend/1st-translation-unit.cpp %S/Inputs/nolintbeginend/2nd-translation-unit.cpp --checks='-*,google-explicit-constructor' -- 2>&1 | FileCheck %s
// CHECK-NOT: 1st-translation-unit.cpp:2:11: warning: single-argument constructors must be marked explicit
// CHECK: 1st-translation-unit.cpp:5:11: warning: single-argument constructors must be marked explicit
diff --git a/clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp b/clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp
index ace70a4a051e89..94d3732cc5293b 100644
--- a/clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp
+++ b/clang-tools-extra/test/clang-tidy/infrastructure/use-color.cpp
@@ -5,9 +5,9 @@
// RUN: clang-tidy -config='UseColor: false' -dump-config | FileCheck -check-prefix=CHECK-CONFIG-NO-COLOR %s
// RUN: clang-tidy -help | FileCheck -check-prefix=CHECK-OPT-PRESENT %s
-// RUN: clang-tidy -checks='-*, modernize-use-override' -extra-arg=-std=c++11 -use-color=false %s | FileCheck -check-prefix=CHECK-NO-COLOR %s
-// RUN: clang-tidy -checks='-*, modernize-use-override' -extra-arg=-std=c++11 %s | FileCheck -check-prefix=CHECK-NO-COLOR %s
-// RUN: clang-tidy -checks='-*, modernize-use-override' -extra-arg=-std=c++11 -use-color %s | FileCheck -check-prefix=CHECK-COLOR %s
+// RUN: clang-tidy -checks='-*, modernize-use-override' -use-color=false %s -- -std=c++11 | FileCheck -check-prefix=CHECK-NO-COLOR %s
+// RUN: clang-tidy -checks='-*, modernize-use-override' %s -- -std=c++11 | FileCheck -check-prefix=CHECK-NO-COLOR %s
+// RUN: clang-tidy -checks='-*, modernize-use-override' -use-color %s -- -std=c++11 | FileCheck -check-prefix=CHECK-COLOR %s
// CHECK-NOT: UseColor
// CHECK-CONFIG-NO-COLOR: UseColor: false
More information about the cfe-commits
mailing list