1 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='' %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck %s |
2 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='' -quiet %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK-QUIET %s |
3 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK2 %s |
4 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -quiet %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK2-QUIET %s |
5 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='header2\.h' %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK3 %s |
6 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='header2\.h' -quiet %s -- -I %S/Inputs/file-filter -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK3-QUIET %s |
7 | // FIXME: "-I %S/Inputs/file-filter/system/.." must be redundant. |
8 | // On Win32, file-filter/system\system-header1.h precedes |
9 | // file-filter\header*.h due to code order between '/' and '\\'. |
10 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -system-headers %s -- -I %S/Inputs/file-filter/system/.. -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK4 %s |
11 | // RUN: clang-tidy -checks='-*,google-explicit-constructor' -header-filter='.*' -system-headers -quiet %s -- -I %S/Inputs/file-filter/system/.. -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK4-QUIET %s |
12 | // RUN: clang-tidy -checks='-*,cppcoreguidelines-pro-type-cstyle-cast' -header-filter='.*' -system-headers %s -- -I %S/Inputs/file-filter/system/.. -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK5 %s |
13 | // RUN: clang-tidy -checks='-*,cppcoreguidelines-pro-type-cstyle-cast' -header-filter='.*' %s -- -I %S/Inputs/file-filter/system/.. -isystem %S/Inputs/file-filter/system 2>&1 | FileCheck --check-prefix=CHECK5-NO-SYSTEM-HEADERS %s |
14 | |
15 | #include "header1.h" |
16 | // CHECK-NOT: warning: |
17 | // CHECK-QUIET-NOT: warning: |
18 | // CHECK2: header1.h:1:12: warning: single-argument constructors must be marked explicit |
19 | // CHECK2-QUIET: header1.h:1:12: warning: single-argument constructors must be marked explicit |
20 | // CHECK3-NOT: warning: |
21 | // CHECK3-QUIET-NOT: warning: |
22 | // CHECK4: header1.h:1:12: warning: single-argument constructors |
23 | // CHECK4-QUIET: header1.h:1:12: warning: single-argument constructors |
24 | |
25 | #include "header2.h" |
26 | // CHECK-NOT: warning: |
27 | // CHECK-QUIET-NOT: warning: |
28 | // CHECK2: header2.h:1:12: warning: single-argument constructors |
29 | // CHECK2-QUIET: header2.h:1:12: warning: single-argument constructors |
30 | // CHECK3: header2.h:1:12: warning: single-argument constructors |
31 | // CHECK3-QUIET: header2.h:1:12: warning: single-argument constructors |
32 | // CHECK4: header2.h:1:12: warning: single-argument constructors |
33 | // CHECK4-QUIET: header2.h:1:12: warning: single-argument constructors |
34 | |
35 | #include <system-header.h> |
36 | // CHECK-NOT: warning: |
37 | // CHECK-QUIET-NOT: warning: |
38 | // CHECK2-NOT: warning: |
39 | // CHECK2-QUIET-NOT: warning: |
40 | // CHECK3-NOT: warning: |
41 | // CHECK3-QUIET-NOT: warning: |
42 | // CHECK4: system-header.h:1:12: warning: single-argument constructors |
43 | // CHECK4-QUIET: system-header.h:1:12: warning: single-argument constructors |
44 | |
45 | class A { A(int); }; |
46 | // CHECK: :[[@LINE-1]]:11: warning: single-argument constructors |
47 | // CHECK-QUIET: :[[@LINE-2]]:11: warning: single-argument constructors |
48 | // CHECK2: :[[@LINE-3]]:11: warning: single-argument constructors |
49 | // CHECK2-QUIET: :[[@LINE-4]]:11: warning: single-argument constructors |
50 | // CHECK3: :[[@LINE-5]]:11: warning: single-argument constructors |
51 | // CHECK3-QUIET: :[[@LINE-6]]:11: warning: single-argument constructors |
52 | // CHECK4: :[[@LINE-7]]:11: warning: single-argument constructors |
53 | // CHECK4-QUIET: :[[@LINE-8]]:11: warning: single-argument constructors |
54 | |
55 | // CHECK-NOT: warning: |
56 | // CHECK-QUIET-NOT: warning: |
57 | // CHECK2-NOT: warning: |
58 | // CHECK2-QUIET-NOT: warning: |
59 | // CHECK3-NOT: warning: |
60 | // CHECK3-QUIET-NOT: warning: |
61 | // CHECK4-NOT: warning: |
62 | // CHECK4-QUIET-NOT: warning: |
63 | |
64 | // CHECK: Suppressed 3 warnings (3 in non-user code) |
65 | // CHECK: Use -header-filter=.* to display errors from all non-system headers. |
66 | // CHECK-QUIET-NOT: Suppressed |
67 | // CHECK2: Suppressed 1 warnings (1 in non-user code) |
68 | // CHECK2: Use -header-filter=.* {{.*}} |
69 | // CHECK2-QUIET-NOT: Suppressed |
70 | // CHECK3: Suppressed 2 warnings (2 in non-user code) |
71 | // CHECK3: Use -header-filter=.* {{.*}} |
72 | // CHECK3-QUIET-NOT: Suppressed |
73 | // CHECK4-NOT: Suppressed {{.*}} warnings |
74 | // CHECK4-NOT: Use -header-filter=.* {{.*}} |
75 | // CHECK4-QUIET-NOT: Suppressed |
76 | |
77 | int x = 123; |
78 | auto x_ptr = TO_FLOAT_PTR(&x); |
79 | // CHECK5: :[[@LINE-1]]:14: warning: do not use C-style cast to convert between unrelated types |
80 | // CHECK5-NO-SYSTEM-HEADERS-NOT: :[[@LINE-2]]:14: warning: do not use C-style cast to convert between unrelated types |
81 | |