[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
This commit is contained in:
Justin Bogner 2023-08-17 01:23:23 -07:00
parent cf65afbf93
commit 12babb0818
5 changed files with 8 additions and 8 deletions

View File

@ -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];

View File

@ -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() {

View File

@ -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]

View File

@ -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

View File

@ -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