File: nolintbeginend.cpp

package info (click to toggle)
llvm-toolchain-17 1%3A17.0.6-22
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,799,624 kB
  • sloc: cpp: 6,428,607; ansic: 1,383,196; asm: 793,408; python: 223,504; objc: 75,364; f90: 60,502; lisp: 33,869; pascal: 15,282; sh: 9,684; perl: 7,453; ml: 4,937; awk: 3,523; makefile: 2,889; javascript: 2,149; xml: 888; fortran: 619; cs: 573
file content (151 lines) | stat: -rw-r--r-- 4,113 bytes parent folder | download | duplicates (12)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
// RUN: %check_clang_tidy %s google-explicit-constructor,clang-diagnostic-unused-variable,cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays %t -- -extra-arg=-Wunused-variable

class A { A(int i); };
// CHECK-MESSAGES: :[[@LINE-1]]:11: warning: single-argument constructors must be marked explicit

// NOLINTBEGIN
class B1 { B1(int i); };
// NOLINTEND

// NOLINTBEGIN
// NOLINTEND
// NOLINTBEGIN
class B2 { B2(int i); };
// NOLINTEND

// NOLINTBEGIN
// NOLINTBEGIN
class B3 { B3(int i); };
// NOLINTEND
// NOLINTEND

// NOLINTBEGIN
// NOLINTBEGIN
// NOLINTEND
class B4 { B4(int i); };
// NOLINTEND

// NOLINTBEGIN
// NOLINTEND
class B5 { B5(int i); };
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit

// NOLINTBEGIN(google-explicit-constructor)
class C1 { C1(int i); };
// NOLINTEND(google-explicit-constructor)

// NOLINTBEGIN()
class C2 { C2(int i); };
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
// NOLINTEND()

// NOLINTBEGIN(*)
class C3 { C3(int i); };
// NOLINTEND(*)

// NOLINTBEGIN(some-other-check)
class C4 { C4(int i); };
// CHECK-MESSAGES: :[[@LINE-1]]:12: warning: single-argument constructors must be marked explicit
// NOLINTEND(some-other-check)

// NOLINTBEGIN(some-other-check, google-explicit-constructor)
class C5 { C5(int i); };
// NOLINTEND(some-other-check, google-explicit-constructor)

// NOLINTBEGIN(google-explicit-constructor)
// NOLINTBEGIN(some-other-check)
class C6 { C6(int i); };
// NOLINTEND(some-other-check)
// NOLINTEND(google-explicit-constructor)

// NOLINTBEGIN(google-explicit-constructor)
// NOLINTBEGIN
class C7 { C7(int i); };
// NOLINTEND
// NOLINTEND(google-explicit-constructor)

// NOLINTBEGIN
// NOLINTBEGIN(google-explicit-constructor)
class C8 { C8(int i); };
// NOLINTEND(google-explicit-constructor)
// NOLINTEND

// NOLINTBEGIN(not-closed-bracket-is-treated-as-skip-all
class C9 { C9(int i); };
// NOLINTEND(not-closed-bracket-is-treated-as-skip-all

// NOLINTBEGIN without-brackets-skip-all, another-check
class C10 { C10(int i); };
// NOLINTEND without-brackets-skip-all, another-check

#define MACRO(X) class X { X(int i); };

MACRO(D1)
// CHECK-MESSAGES: :[[@LINE-1]]:7: warning: single-argument constructors must be marked explicit
// CHECK-MESSAGES: :[[@LINE-4]]:28: note: expanded from macro 'MACRO

// NOLINTBEGIN
MACRO(D2)
// NOLINTEND

#define MACRO_NOARG class E { E(int i); };

// NOLINTBEGIN
MACRO_NOARG
// NOLINTEND

// NOLINTBEGIN
#define MACRO_WRAPPED_WITH_NO_LINT class I { I(int i); };
// NOLINTEND

MACRO_WRAPPED_WITH_NO_LINT

#define MACRO_NO_LINT_INSIDE_MACRO \
  /* NOLINTBEGIN */                \
  class J { J(int i); };           \
  /* NOLINTEND */

MACRO_NO_LINT_INSIDE_MACRO

// NOLINTBEGIN(google*)
class C11 { C11(int i); };
// NOLINTEND(google*)

// NOLINTBEGIN(*explicit-constructor)
class C12 { C12(int i); };
// NOLINTEND(*explicit-constructor)

// NOLINTBEGIN(*explicit*)
class C13 { C13(int i); };
// NOLINTEND(*explicit*)

// NOLINTBEGIN(-explicit-constructor)
class C14 { C14(int x); };
// CHECK-MESSAGES: :[[@LINE-1]]:13: warning: single-argument constructors must be marked explicit
// NOLINTEND(-explicit-constructor)

// NOLINTBEGIN(google*,-google*)
class C15 { C15(int x); };
// NOLINTEND(google*,-google*)

// NOLINTBEGIN(*,-google*)
class C16 { C16(int x); };
// NOLINTEND(*,-google*)

int array1[10];
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays]

// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays)
int array2[10];
// CHECK-MESSAGES: :[[@LINE-1]]:1: warning: do not declare C-style arrays, use std::array<> instead [modernize-avoid-c-arrays]
// NOLINTEND(cppcoreguidelines-avoid-c-arrays)

// NOLINTBEGIN(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)
int array3[10];
// NOLINTEND(cppcoreguidelines-avoid-c-arrays,modernize-avoid-c-arrays)

// NOLINTBEGIN(*-avoid-c-arrays)
int array4[10];
// NOLINTEND(*-avoid-c-arrays)

// CHECK-MESSAGES: Suppressed 26 warnings (26 NOLINT).