1// RUN: clang-tidy %s --checks='-*,llvm-namespace-comment,clang-diagnostic*' \
2// RUN: -- -Wunused-variable 2>&1 \
3// RUN: | FileCheck %s --check-prefix=CHECK-WARN -implicit-check-not='{{warning|error}}:'
4// RUN: not clang-tidy %s --checks='-*,llvm-namespace-comment,clang-diagnostic*' \
5// RUN: --warnings-as-errors='clang-diagnostic*' -- -Wunused-variable 2>&1 \
6// RUN: | FileCheck %s --check-prefix=CHECK-WERR -implicit-check-not='{{warning|error}}:'
7// RUN: not clang-tidy %s --checks='-*,llvm-namespace-comment,clang-diagnostic*' \
8// RUN: --warnings-as-errors='clang-diagnostic*' -quiet -- -Wunused-variable 2>&1 \
9// RUN: | FileCheck %s --check-prefix=CHECK-WERR-QUIET -implicit-check-not='{{warning|error}}:'
10// RUN: clang-tidy %s --checks='-*,llvm-namespace-comment' --warnings-as-errors=* -- \
11// RUN: -Wunused-variable 2>&1 | FileCheck %s --check-prefix=CHECK-SUPPRESSED \
12// RUN: -implicit-check-not='{{warning|error}}:'
13
14void f() { int i; }
15// CHECK-WARN: warning: unused variable 'i' [clang-diagnostic-unused-variable]
16// CHECK-WERR: error: unused variable 'i' [clang-diagnostic-unused-variable,-warnings-as-errors]
17// CHECK-WERR-QUIET: error: unused variable 'i' [clang-diagnostic-unused-variable,-warnings-as-errors]
18
19// CHECK-WARN-NOT: treated as
20// CHECK-WERR: 1 warning treated as error
21// CHECK-WERR-QUIET-NOT: treated as
22
23// CHECK-SUPPRESSED-NOT: unused variable 'i'
24// CHECK-SUPPRESSED: 1 warning generated.
25// CHECK-SUPPRESSED: Suppressed 1 warnings (1 with check filters).
26

source code of clang-tools-extra/test/clang-tidy/infrastructure/warnings-as-errors-diagnostics.cpp