1// RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-shadow,clang-diagnostic-float-conversion' %s -- | count 0
2//
3// Enable warnings using -config:
4// RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-shadow,clang-diagnostic-float-conversion' \
5// RUN: -config='{ExtraArgs: ["-Wshadow","-Wno-unused-variable"], ExtraArgsBefore: ["-Wno-shadow","-Wfloat-conversion","-Wunused-variable"]}' %s -- \
6// RUN: | FileCheck -implicit-check-not='{{warning:|error:}}' %s
7//
8// ... -extra-arg:
9// RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-shadow,clang-diagnostic-float-conversion' \
10// RUN: -extra-arg=-Wshadow -extra-arg=-Wno-unused-variable \
11// RUN: -extra-arg-before=-Wno-shadow -extra-arg-before=-Wfloat-conversion \
12// RUN: -extra-arg-before=-Wunused-variable %s -- \
13// RUN: | FileCheck -implicit-check-not='{{warning:|error:}}' %s
14//
15// ... a combination of -config and -extra-arg(-before):
16// RUN: clang-tidy -checks='-*,modernize-use-override,clang-diagnostic-shadow,clang-diagnostic-float-conversion' \
17// RUN: -config='{ExtraArgs: ["-Wno-unused-variable"], ExtraArgsBefore: ["-Wno-shadow","-Wfloat-conversion"]}' \
18// RUN: -extra-arg=-Wshadow -extra-arg-before=-Wunused-variable %s -- \
19// RUN: | FileCheck -implicit-check-not='{{warning:|error:}}' %s
20
21void f(float x) {
22 int a;
23 { int a; }
24 // CHECK: :[[@LINE-1]]:9: warning: declaration shadows a local variable [clang-diagnostic-shadow]
25 int b = x;
26 // CHECK: :[[@LINE-1]]:11: warning: implicit conversion turns floating-point number into integer: 'float' to 'int' [clang-diagnostic-float-conversion]
27}
28

source code of clang-tools-extra/test/clang-tidy/infrastructure/custom-diagnostics.cpp