Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / clang / test / Analysis / auto-obj-dtors-cfg-output.cpp
blob96b9a5508cc0846cf4938e405866545cc8f7180b
1 // RUN: %clang_analyze_cc1 -std=c++98 -fcxx-exceptions -fexceptions -analyzer-checker=debug.DumpCFG -analyzer-config cfg-rich-constructors=false %s > %t 2>&1
2 // RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX98,WARNINGS %s
3 // RUN: %clang_analyze_cc1 -std=c++98 -fcxx-exceptions -fexceptions -analyzer-checker=debug.DumpCFG -analyzer-config cfg-rich-constructors=true %s > %t 2>&1
4 // RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX98,ANALYZER,CXX98-ANALYZER %s
5 // RUN: %clang_analyze_cc1 -std=c++11 -fcxx-exceptions -fexceptions -analyzer-checker=debug.DumpCFG -analyzer-config cfg-rich-constructors=false %s > %t 2>&1
6 // RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,WARNINGS,CXX11-WARNINGS %s
7 // RUN: %clang_analyze_cc1 -std=c++11 -fcxx-exceptions -fexceptions -analyzer-checker=debug.DumpCFG -analyzer-config cfg-rich-constructors=true %s > %t 2>&1
8 // RUN: FileCheck --input-file=%t -check-prefixes=CHECK,CXX11,ANALYZER,CXX11-ANALYZER %s
10 // This file tests how we construct two different flavors of the Clang CFG -
11 // the CFG used by the Sema analysis-based warnings and the CFG used by the
12 // static analyzer. The difference in the behavior is checked via FileCheck
13 // prefixes (WARNINGS and ANALYZER respectively). When introducing new analyzer
14 // flags, no new run lines should be added - just these flags would go to the
15 // respective line depending on where is it turned on and where is it turned
16 // off. Feel free to add tests that test only one of the CFG flavors if you're
17 // not sure how the other flavor is supposed to work in your case.
19 class A {
20 public:
21 int x;
23 // CHECK: [B1 (ENTRY)]
24 // CHECK-NEXT: Succs (1): B0
25 // CHECK: [B0 (EXIT)]
26 // CHECK-NEXT: Preds (1): B1
27 A() {}
29 // CHECK: [B1 (ENTRY)]
30 // CHECK-NEXT: Succs (1): B0
31 // CHECK: [B0 (EXIT)]
32 // CHECK-NEXT: Preds (1): B1
33 ~A() {}
35 // CHECK: [B2 (ENTRY)]
36 // CHECK-NEXT: Succs (1): B1
37 // CHECK: [B1]
38 // CHECK-NEXT: 1: 1
39 // CHECK-NEXT: 2: return [B1.1];
40 // CHECK-NEXT: Preds (1): B2
41 // CHECK-NEXT: Succs (1): B0
42 // CHECK: [B0 (EXIT)]
43 // CHECK-NEXT: Preds (1): B1
44 operator int() const { return 1; }
47 extern const bool UV;
49 // CHECK: [B2 (ENTRY)]
50 // CHECK-NEXT: Succs (1): B1
51 // CHECK: [B1]
52 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
53 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
54 // CHECK-NEXT: 2: A a;
55 // CHECK-NEXT: 3: a
56 // CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, NoOp, const A)
57 // CHECK-NEXT: 5: const A &b = a;
58 // WARNINGS-NEXT: 6: A() (CXXConstructExpr, A)
59 // ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.9], A)
60 // CHECK-NEXT: 7: [B1.6] (BindTemporary)
61 // CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const A)
62 // CHECK-NEXT: 9: [B1.8]
63 // CHECK: 10: const A &c = A();
64 // CHECK: 11: [B1.10].~A() (Implicit destructor)
65 // CHECK: 12: [B1.2].~A() (Implicit destructor)
66 // CHECK-NEXT: Preds (1): B2
67 // CHECK-NEXT: Succs (1): B0
68 // CHECK: [B0 (EXIT)]
69 // CHECK-NEXT: Preds (1): B1
70 void test_const_ref() {
71 A a;
72 const A& b = a;
73 const A& c = A();
76 // CHECK: [B2 (ENTRY)]
77 // CHECK-NEXT: Succs (1): B1
78 // CHECK: [B1]
79 // WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
80 // CXX98-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], A)
81 // CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.3], A)
82 // CHECK-NEXT: 2: [B1.1] (BindTemporary)
83 // CXX98-NEXT: 3: [B1.2].x
84 // CXX98-NEXT: 4: [B1.3]
85 // CXX98-NEXT: 5: const int &x = A().x;
86 // CXX98-NEXT: 6: [B1.5].~A() (Implicit destructor)
87 // CXX11-NEXT: 3: [B1.2]
88 // CXX11-NEXT: 4: [B1.3].x
89 // CXX11-NEXT: 5: [B1.4] (ImplicitCastExpr, NoOp, const int)
90 // CXX11-NEXT: 6: const int &x = A().x;
91 // CXX11-NEXT: 7: [B1.6].~A() (Implicit destructor)
92 // CHECK-NEXT: Preds (1): B2
93 // CHECK-NEXT: Succs (1): B0
94 // CHECK: [B0 (EXIT)]
95 // CHECK-NEXT: Preds (1): B1
96 void test_const_ref_to_field() {
97 const int &x = A().x;
100 // CHECK: [B2 (ENTRY)]
101 // CHECK-NEXT: Succs (1): B1
102 // CHECK: [B1]
103 // WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
104 // CXX98-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], A)
105 // CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.3], A)
106 // CHECK-NEXT: 2: [B1.1] (BindTemporary)
107 // CXX98-NEXT: 3: A::x
108 // CXX98-NEXT: 4: &[B1.3]
109 // CXX98-NEXT: 5: [B1.2] .* [B1.4]
110 // CXX98-NEXT: 6: [B1.5]
111 // CXX98-NEXT: 7: const int &x = A() .* &A::x;
112 // CXX98-NEXT: 8: [B1.7].~A() (Implicit destructor)
113 // CXX11-NEXT: 3: [B1.2]
114 // CXX11-NEXT: 4: A::x
115 // CXX11-NEXT: 5: &[B1.4]
116 // CXX11-NEXT: 6: [B1.3] .* [B1.5]
117 // CXX11-NEXT: 7: [B1.6] (ImplicitCastExpr, NoOp, const int)
118 // CXX11-NEXT: 8: const int &x = A() .* &A::x;
119 // CXX11-NEXT: 9: [B1.8].~A() (Implicit destructor)
120 // CHECK-NEXT: Preds (1): B2
121 // CHECK-NEXT: Succs (1): B0
122 // CHECK: [B0 (EXIT)]
123 // CHECK-NEXT: Preds (1): B1
124 void test_pointer_to_member() {
125 const int &x = A().*&A::x;
128 // FIXME: There should be automatic destructors at the end of scope.
129 // CHECK: [B2 (ENTRY)]
130 // CHECK-NEXT: Succs (1): B1
131 // CHECK: [B1]
132 // WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
133 // ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.4], A)
134 // CHECK-NEXT: 2: [B1.1] (BindTemporary)
135 // CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const A)
136 // CHECK-NEXT: 4: [B1.3]
137 // CHECK-NEXT: 5: {[B1.4]}
138 // CHECK-NEXT: 6: B b = {A()};
139 // WARNINGS-NEXT: 7: A() (CXXConstructExpr, A)
140 // ANALYZER-NEXT: 7: A() (CXXConstructExpr, [B1.10], A)
141 // CHECK-NEXT: 8: [B1.7] (BindTemporary)
142 // CHECK-NEXT: 9: [B1.8] (ImplicitCastExpr, NoOp, const A)
143 // CHECK-NEXT: 10: [B1.9]
144 // CHECK-NEXT: 11: {[B1.10]}
145 // WARNINGS-NEXT: 12: A() (CXXConstructExpr, A)
146 // ANALYZER-NEXT: 12: A() (CXXConstructExpr, [B1.15], A)
147 // CHECK-NEXT: 13: [B1.12] (BindTemporary)
148 // CHECK-NEXT: 14: [B1.13] (ImplicitCastExpr, NoOp, const A)
149 // CHECK-NEXT: 15: [B1.14]
150 // CHECK-NEXT: 16: {[B1.15]}
151 // CHECK-NEXT: 17: {[B1.10], [B1.15]}
152 // CHECK-NEXT: 18: B bb[2] = {A(), A()};
153 // CHECK-NEXT: Preds (1): B2
154 // CHECK-NEXT: Succs (1): B0
155 // CHECK: [B0 (EXIT)]
156 // CHECK-NEXT: Preds (1): B1
157 void test_aggregate_lifetime_extension() {
158 struct B {
159 const A &x;
162 B b = {A()};
163 B bb[2] = {A(), A()};
166 // In C++98 such class 'C' will not be an aggregate.
167 #if __cplusplus >= 201103L
168 // FIXME: There should be automatic destructors at the end of the scope.
169 // CXX11: [B2 (ENTRY)]
170 // CXX11-NEXT: Succs (1): B1
171 // CXX11: [B1]
172 // CXX11-WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
173 // CXX11-ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], [B1.4], A)
174 // CXX11-NEXT: 2: [B1.1] (BindTemporary)
175 // CXX11-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const A)
176 // CXX11-NEXT: 4: [B1.3]
177 // CXX11-NEXT: 5: [B1.4] (CXXConstructExpr, const A)
178 // CXX11-WARNINGS-NEXT: 6: A() (CXXConstructExpr, A)
179 // CXX11-ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.7], [B1.9], A)
180 // CXX11-NEXT: 7: [B1.6] (BindTemporary)
181 // CXX11-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const A)
182 // CXX11-NEXT: 9: [B1.8]
183 // CXX11-NEXT: 10: [B1.9] (CXXConstructExpr, const A)
184 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
185 // CXX11-NEXT: 11: {[B1.2], [B1.7]}
186 // CXX11-NEXT: 12: [B1.11] (BindTemporary)
187 // CXX11-NEXT: 13: [B1.12]
188 // CXX11-NEXT: 14: {[B1.13]}
189 // Double curly braces trigger regexps, escape as per FileCheck manual.
190 // CXX11-NEXT: 15: C c = {{[{][{]}}A(), A(){{[}][}]}};
191 // CXX11-NEXT: 16: ~A() (Temporary object destructor)
192 // CXX11-NEXT: 17: ~A() (Temporary object destructor)
193 // CXX11-WARNINGS-NEXT: 18: A() (CXXConstructExpr, A)
194 // CXX11-ANALYZER-NEXT: 18: A() (CXXConstructExpr, [B1.19], [B1.21], A)
195 // CXX11-NEXT: 19: [B1.18] (BindTemporary)
196 // CXX11-NEXT: 20: [B1.19] (ImplicitCastExpr, NoOp, const A)
197 // CXX11-NEXT: 21: [B1.20]
198 // CXX11-NEXT: 22: [B1.21] (CXXConstructExpr, const A)
199 // CXX11-WARNINGS-NEXT: 23: A() (CXXConstructExpr, A)
200 // CXX11-ANALYZER-NEXT: 23: A() (CXXConstructExpr, [B1.24], [B1.26], A)
201 // CXX11-NEXT: 24: [B1.23] (BindTemporary)
202 // CXX11-NEXT: 25: [B1.24] (ImplicitCastExpr, NoOp, const A)
203 // CXX11-NEXT: 26: [B1.25]
204 // CXX11-NEXT: 27: [B1.26] (CXXConstructExpr, const A)
205 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
206 // CXX11-NEXT: 28: {[B1.19], [B1.24]}
207 // CXX11-NEXT: 29: [B1.28] (BindTemporary)
208 // CXX11-NEXT: 30: [B1.29]
209 // CXX11-NEXT: 31: {[B1.30]}
210 // CXX11-WARNINGS-NEXT: 32: A() (CXXConstructExpr, A)
211 // CXX11-ANALYZER-NEXT: 32: A() (CXXConstructExpr, [B1.33], [B1.35], A)
212 // CXX11-NEXT: 33: [B1.32] (BindTemporary)
213 // CXX11-NEXT: 34: [B1.33] (ImplicitCastExpr, NoOp, const A)
214 // CXX11-NEXT: 35: [B1.34]
215 // CXX11-NEXT: 36: [B1.35] (CXXConstructExpr, const A)
216 // CXX11-WARNINGS-NEXT: 37: A() (CXXConstructExpr, A)
217 // CXX11-ANALYZER-NEXT: 37: A() (CXXConstructExpr, [B1.38], [B1.40], A)
218 // CXX11-NEXT: 38: [B1.37] (BindTemporary)
219 // CXX11-NEXT: 39: [B1.38] (ImplicitCastExpr, NoOp, const A)
220 // CXX11-NEXT: 40: [B1.39]
221 // CXX11-NEXT: 41: [B1.40] (CXXConstructExpr, const A)
222 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
223 // CXX11-NEXT: 42: {[B1.33], [B1.38]}
224 // CXX11-NEXT: 43: [B1.42] (BindTemporary)
225 // CXX11-NEXT: 44: [B1.43]
226 // CXX11-NEXT: 45: {[B1.44]}
227 // Double curly braces trigger regexps, escape as per FileCheck manual.
228 // CXX11-NEXT: 46: {{[{][{]}}[B1.30]}, {[B1.44]{{[}][}]}}
229 // Double curly braces trigger regexps, escape as per FileCheck manual.
230 // CXX11-NEXT: 47: C cc[2] = {{[{][{][{]}}A(), A(){{[}][}]}}, {{[{][{]}}A(), A(){{[}][}][}]}};
231 // CXX11-NEXT: 48: ~A() (Temporary object destructor)
232 // CXX11-NEXT: 49: ~A() (Temporary object destructor)
233 // CXX11-NEXT: 50: ~A() (Temporary object destructor)
234 // CXX11-NEXT: 51: ~A() (Temporary object destructor)
235 // CXX11-NEXT: Preds (1): B2
236 // CXX11-NEXT: Succs (1): B0
237 // CXX11: [B0 (EXIT)]
238 // CXX11-NEXT: Preds (1): B1
239 void test_aggregate_array_lifetime_extension() {
240 struct C {
241 const A (&z)[2];
244 // Until C++17 there are elidable copies here, so there should be 9 temporary
245 // destructors of A()s. There are no destructors of 'c' and 'cc' because this
246 // aggregate has no destructor. Instead, arrays are lifetime-extended,
247 // and copies of A()s within them need to be destroyed via automatic
248 // destructors.
249 C c = {{A(), A()}};
250 C cc[2] = {{{A(), A()}}, {{A(), A()}}};
252 #endif
254 // CHECK: [B2 (ENTRY)]
255 // CHECK-NEXT: Succs (1): B1
256 // CHECK: [B1]
257 // WARNINGS-NEXT: 1: A() (CXXConstructExpr, A)
258 // ANALYZER-NEXT: 1: A() (CXXConstructExpr, [B1.2], [B1.4], A)
259 // CHECK-NEXT: 2: [B1.1] (BindTemporary)
260 // CHECK-NEXT: 3: [B1.2] (ImplicitCastExpr, NoOp, const A)
261 // CHECK-NEXT: 4: [B1.3]
262 // CHECK-NEXT: 5: [B1.4] (CXXConstructExpr, A)
263 // WARNINGS-NEXT: 6: A() (CXXConstructExpr, A)
264 // ANALYZER-NEXT: 6: A() (CXXConstructExpr, [B1.7], [B1.9], A)
265 // CHECK-NEXT: 7: [B1.6] (BindTemporary)
266 // CHECK-NEXT: 8: [B1.7] (ImplicitCastExpr, NoOp, const A)
267 // CHECK-NEXT: 9: [B1.8]
268 // CHECK-NEXT: 10: [B1.9] (CXXConstructExpr, A)
269 // WARNINGS-NEXT: 11: A() (CXXConstructExpr, A)
270 // ANALYZER-NEXT: 11: A() (CXXConstructExpr, [B1.12], [B1.14], A)
271 // CHECK-NEXT: 12: [B1.11] (BindTemporary)
272 // CHECK-NEXT: 13: [B1.12] (ImplicitCastExpr, NoOp, const A)
273 // CHECK-NEXT: 14: [B1.13]
274 // CHECK-NEXT: 15: [B1.14] (CXXConstructExpr, A)
275 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
276 // CHECK-NEXT: 16: {[B1.7], [B1.12]}
277 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
278 // CHECK-NEXT: 17: {[B1.2], {[B1.7], [B1.12]}}
279 // CHECK-NEXT: 18: D d = {A(), {A(), A()}};
280 // CHECK-NEXT: 19: ~A() (Temporary object destructor)
281 // CHECK-NEXT: 20: ~A() (Temporary object destructor)
282 // CHECK-NEXT: 21: ~A() (Temporary object destructor)
283 // WARNINGS-NEXT: 22: A() (CXXConstructExpr, A)
284 // ANALYZER-NEXT: 22: A() (CXXConstructExpr, [B1.23], [B1.25], A)
285 // CHECK-NEXT: 23: [B1.22] (BindTemporary)
286 // CHECK-NEXT: 24: [B1.23] (ImplicitCastExpr, NoOp, const A)
287 // CHECK-NEXT: 25: [B1.24]
288 // CHECK-NEXT: 26: [B1.25] (CXXConstructExpr, A)
289 // WARNINGS-NEXT: 27: A() (CXXConstructExpr, A)
290 // ANALYZER-NEXT: 27: A() (CXXConstructExpr, [B1.28], [B1.30], A)
291 // CHECK-NEXT: 28: [B1.27] (BindTemporary)
292 // CHECK-NEXT: 29: [B1.28] (ImplicitCastExpr, NoOp, const A)
293 // CHECK-NEXT: 30: [B1.29]
294 // CHECK-NEXT: 31: [B1.30] (CXXConstructExpr, A)
295 // WARNINGS-NEXT: 32: A() (CXXConstructExpr, A)
296 // ANALYZER-NEXT: 32: A() (CXXConstructExpr, [B1.33], [B1.35], A)
297 // CHECK-NEXT: 33: [B1.32] (BindTemporary)
298 // CHECK-NEXT: 34: [B1.33] (ImplicitCastExpr, NoOp, const A)
299 // CHECK-NEXT: 35: [B1.34]
300 // CHECK-NEXT: 36: [B1.35] (CXXConstructExpr, A)
301 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
302 // CHECK-NEXT: 37: {[B1.28], [B1.33]}
303 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
304 // CHECK-NEXT: 38: {[B1.23], {[B1.28], [B1.33]}}
305 // WARNINGS-NEXT: 39: A() (CXXConstructExpr, A)
306 // ANALYZER-NEXT: 39: A() (CXXConstructExpr, [B1.40], [B1.42], A)
307 // CHECK-NEXT: 40: [B1.39] (BindTemporary)
308 // CHECK-NEXT: 41: [B1.40] (ImplicitCastExpr, NoOp, const A)
309 // CHECK-NEXT: 42: [B1.41]
310 // CHECK-NEXT: 43: [B1.42] (CXXConstructExpr, A)
311 // WARNINGS-NEXT: 44: A() (CXXConstructExpr, A)
312 // ANALYZER-NEXT: 44: A() (CXXConstructExpr, [B1.45], [B1.47], A)
313 // CHECK-NEXT: 45: [B1.44] (BindTemporary)
314 // CHECK-NEXT: 46: [B1.45] (ImplicitCastExpr, NoOp, const A)
315 // CHECK-NEXT: 47: [B1.46]
316 // CHECK-NEXT: 48: [B1.47] (CXXConstructExpr, A)
317 // WARNINGS-NEXT: 49: A() (CXXConstructExpr, A)
318 // ANALYZER-NEXT: 49: A() (CXXConstructExpr, [B1.50], [B1.52], A)
319 // CHECK-NEXT: 50: [B1.49] (BindTemporary)
320 // CHECK-NEXT: 51: [B1.50] (ImplicitCastExpr, NoOp, const A)
321 // CHECK-NEXT: 52: [B1.51]
322 // CHECK-NEXT: 53: [B1.52] (CXXConstructExpr, A)
323 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
324 // CHECK-NEXT: 54: {[B1.45], [B1.50]}
325 // FIXME: Why does it look as if the initializer list consumes uncopied objects?
326 // CHECK-NEXT: 55: {[B1.40], {[B1.45], [B1.50]}}
327 // Double curly braces trigger regexps, escape as per FileCheck manual.
328 // CHECK-NEXT: 56: {{[{][{]}}[B1.23], {[B1.28], [B1.33]{{[}][}]}}, {[B1.40], {[B1.45], [B1.50]{{[}][}][}]}}
329 // Double curly braces trigger regexps, escape as per FileCheck manual.
330 // CHECK-NEXT: 57: D dd[2] = {{[{][{]}}A(), {A(), A(){{[}][}]}}, {A(), {A(), A(){{[}][}][}]}};
331 // CHECK-NEXT: 58: ~A() (Temporary object destructor)
332 // CHECK-NEXT: 59: ~A() (Temporary object destructor)
333 // CHECK-NEXT: 60: ~A() (Temporary object destructor)
334 // CHECK-NEXT: 61: ~A() (Temporary object destructor)
335 // CHECK-NEXT: 62: ~A() (Temporary object destructor)
336 // CHECK-NEXT: 63: ~A() (Temporary object destructor)
337 // CHECK-NEXT: 64: [B1.57].~D[2]() (Implicit destructor)
338 // CHECK-NEXT: 65: [B1.18].~D() (Implicit destructor)
339 // CHECK-NEXT: Preds (1): B2
340 // CHECK-NEXT: Succs (1): B0
341 // CHECK: [B0 (EXIT)]
342 // CHECK-NEXT: Preds (1): B1
343 void test_aggregate_with_nontrivial_own_destructor() {
344 struct D {
345 A y;
346 A w[2];
349 // Until C++17 there are elidable copies here, so there should be 9 temporary
350 // destructors of A()s. Destructors of 'd' and 'dd' should implicitly
351 // take care of the copies, so there should not be automatic destructors
352 // for copies of A()s.
353 D d = {A(), {A(), A()}};
354 D dd[2] = {{A(), {A(), A()}}, {A(), {A(), A()}}};
357 // CHECK: [B2 (ENTRY)]
358 // CHECK-NEXT: Succs (1): B1
359 // CHECK: [B1]
360 // WARNINGS-NEXT: 1: (CXXConstructExpr, A[2])
361 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A[2])
362 // CHECK-NEXT: 2: A a[2];
363 // WARNINGS-NEXT: 3: (CXXConstructExpr, A[0])
364 // ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], A[0])
365 // CHECK-NEXT: 4: A b[0];
366 // CHECK-NEXT: 5: [B1.2].~A[2]() (Implicit destructor)
367 // CHECK-NEXT: Preds (1): B2
368 // CHECK-NEXT: Succs (1): B0
369 // CHECK: [B0 (EXIT)]
370 // CHECK-NEXT: Preds (1): B1
371 void test_array() {
372 A a[2];
373 A b[0];
376 // CHECK: [B2 (ENTRY)]
377 // CHECK-NEXT: Succs (1): B1
378 // CHECK: [B1]
379 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
380 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
381 // CHECK-NEXT: 2: A a;
382 // WARNINGS-NEXT: 3: (CXXConstructExpr, A)
383 // ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], A)
384 // CHECK-NEXT: 4: A c;
385 // WARNINGS-NEXT: 5: (CXXConstructExpr, A)
386 // ANALYZER-NEXT: 5: (CXXConstructExpr, [B1.6], A)
387 // CHECK-NEXT: 6: A d;
388 // CHECK-NEXT: 7: [B1.6].~A() (Implicit destructor)
389 // CHECK-NEXT: 8: [B1.4].~A() (Implicit destructor)
390 // WARNINGS-NEXT: 9: (CXXConstructExpr, A)
391 // ANALYZER-NEXT: 9: (CXXConstructExpr, [B1.10], A)
392 // CHECK: 10: A b;
393 // CHECK: 11: [B1.10].~A() (Implicit destructor)
394 // CHECK: 12: [B1.2].~A() (Implicit destructor)
395 // CHECK-NEXT: Preds (1): B2
396 // CHECK-NEXT: Succs (1): B0
397 // CHECK: [B0 (EXIT)]
398 // CHECK-NEXT: Preds (1): B1
399 void test_scope() {
400 A a;
401 { A c;
402 A d;
404 A b;
407 // CHECK: [B4 (ENTRY)]
408 // CHECK-NEXT: Succs (1): B3
409 // CHECK: [B1]
410 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
411 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
412 // CHECK-NEXT: 2: A c;
413 // CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
414 // CHECK-NEXT: 4: [B3.4].~A() (Implicit destructor)
415 // CHECK-NEXT: 5: [B3.2].~A() (Implicit destructor)
416 // CHECK-NEXT: Preds (1): B3
417 // CHECK-NEXT: Succs (1): B0
418 // CHECK: [B2]
419 // CHECK-NEXT: 1: return;
420 // CHECK-NEXT: 2: [B3.4].~A() (Implicit destructor)
421 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
422 // CHECK-NEXT: Preds (1): B3
423 // CHECK-NEXT: Succs (1): B0
424 // CHECK: [B3]
425 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
426 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
427 // CHECK-NEXT: 2: A a;
428 // WARNINGS-NEXT: 3: (CXXConstructExpr, A)
429 // ANALYZER-NEXT: 3: (CXXConstructExpr, [B3.4], A)
430 // CHECK-NEXT: 4: A b;
431 // CHECK-NEXT: 5: UV
432 // CHECK-NEXT: 6: [B3.5] (ImplicitCastExpr, LValueToRValue, _Bool)
433 // CHECK-NEXT: T: if [B3.6]
434 // CHECK-NEXT: Preds (1): B4
435 // CHECK-NEXT: Succs (2): B2 B1
436 // CHECK: [B0 (EXIT)]
437 // CHECK-NEXT: Preds (2): B1 B2
438 void test_return() {
439 A a;
440 A b;
441 if (UV) return;
442 A c;
445 // CHECK: [B9 (ENTRY)]
446 // CHECK-NEXT: Succs (1): B7
447 // CHECK: [B1]
448 // CHECK: l1:
449 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
450 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
451 // CHECK-NEXT: 2: A c;
452 // CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
453 // CHECK-NEXT: 4: [B6.2].~A() (Implicit destructor)
454 // CHECK-NEXT: 5: [B7.2].~A() (Implicit destructor)
455 // CHECK-NEXT: Preds (2): B2 B3
456 // CHECK-NEXT: Succs (1): B0
457 // CHECK: [B2]
458 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
459 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
460 // CHECK-NEXT: 2: A b;
461 // CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
462 // CHECK-NEXT: 4: [B6.4].~A() (Implicit destructor)
463 // CHECK-NEXT: Preds (1): B4
464 // CHECK-NEXT: Succs (1): B1
465 // CHECK: [B3]
466 // CHECK-NEXT: 1: [B6.4].~A() (Implicit destructor)
467 // CHECK-NEXT: T: goto l1;
468 // CHECK: Preds (1): B4
469 // CHECK-NEXT: Succs (1): B1
470 // CHECK: [B4]
471 // CHECK-NEXT: 1: UV
472 // CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, LValueToRValue, _Bool)
473 // CHECK-NEXT: T: if [B4.2]
474 // CHECK-NEXT: Preds (1): B6
475 // CHECK-NEXT: Succs (2): B3 B2
476 // CHECK: [B5]
477 // CHECK: Preds (1): B6
478 // CHECK-NEXT: Succs (1): B8
479 // CHECK: [B6]
480 // CHECK: l0:
481 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
482 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B6.2], A)
483 // CHECK-NEXT: 2: A b;
484 // WARNINGS-NEXT: 3: (CXXConstructExpr, A)
485 // ANALYZER-NEXT: 3: (CXXConstructExpr, [B6.4], A)
486 // CHECK-NEXT: 4: A a;
487 // CHECK-NEXT: 5: UV
488 // CHECK-NEXT: 6: [B6.5] (ImplicitCastExpr, LValueToRValue, _Bool)
489 // CHECK-NEXT: T: if [B6.6]
490 // CHECK-NEXT: Preds (2): B7 B8
491 // CHECK-NEXT: Succs (2): B5 B4
492 // CHECK: [B7]
493 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
494 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B7.2], A)
495 // CHECK-NEXT: 2: A a;
496 // CHECK-NEXT: Preds (1): B9
497 // CHECK-NEXT: Succs (1): B6
498 // CHECK: [B8]
499 // CHECK-NEXT: 1: [B6.4].~A() (Implicit destructor)
500 // CHECK-NEXT: 2: [B6.2].~A() (Implicit destructor)
501 // CHECK-NEXT: T: goto l0;
502 // CHECK-NEXT: Preds (1): B5
503 // CHECK-NEXT: Succs (1): B6
504 // CHECK: [B0 (EXIT)]
505 // CHECK-NEXT: Preds (1): B1
506 void test_goto() {
507 A a;
509 A b;
510 { A a;
511 if (UV) goto l0;
512 if (UV) goto l1;
513 A b;
516 A c;
519 // CHECK: [B5 (ENTRY)]
520 // CHECK-NEXT: Succs (1): B4
521 // CHECK: [B1]
522 // CHECK-NEXT: 1: [B4.6].~A() (Implicit destructor)
523 // CHECK-NEXT: 2: [B4.2].~A() (Implicit destructor)
524 // CHECK-NEXT: Preds (2): B2 B3
525 // CHECK-NEXT: Succs (1): B0
526 // CHECK: [B2]
527 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
528 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
529 // CHECK-NEXT: 2: A c;
530 // CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
531 // CHECK-NEXT: Preds (1): B4
532 // CHECK-NEXT: Succs (1): B1
533 // CHECK: [B3]
534 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
535 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
536 // CHECK-NEXT: 2: A c;
537 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
538 // CHECK-NEXT: Preds (1): B4
539 // CHECK-NEXT: Succs (1): B1
540 // CHECK: [B4]
541 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
542 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], A)
543 // CHECK-NEXT: 2: A a;
544 // CHECK-NEXT: 3: a
545 // CHECK-NEXT: 4: [B4.3] (ImplicitCastExpr, NoOp, const A)
546 // WARNINGS-NEXT: 5: [B4.4] (CXXConstructExpr, A)
547 // ANALYZER-NEXT: 5: [B4.4] (CXXConstructExpr, [B4.6], A)
548 // CHECK-NEXT: 6: A b = a;
549 // CHECK-NEXT: 7: b
550 // CHECK-NEXT: 8: [B4.7] (ImplicitCastExpr, NoOp, const class A)
551 // CHECK-NEXT: 9: [B4.8].operator int
552 // CHECK: 10: [B4.8]
553 // CHECK: 11: [B4.10] (ImplicitCastExpr, UserDefinedConversion, int)
554 // CHECK: 12: [B4.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
555 // CHECK-NEXT: T: if [B4.12]
556 // CHECK-NEXT: Preds (1): B5
557 // CHECK-NEXT: Succs (2): B3 B2
558 // CHECK: [B0 (EXIT)]
559 // CHECK-NEXT: Preds (1): B1
560 void test_if_implicit_scope() {
561 A a;
562 if (A b = a)
563 A c;
564 else A c;
567 // CHECK: [B9 (ENTRY)]
568 // CHECK-NEXT: Succs (1): B8
569 // CHECK: [B1]
570 // CHECK-NEXT: 1: [B8.6].~A() (Implicit destructor)
571 // WARNINGS-NEXT: 2: (CXXConstructExpr, A)
572 // ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], A)
573 // CHECK-NEXT: 3: A e;
574 // CHECK-NEXT: 4: [B1.3].~A() (Implicit destructor)
575 // CHECK-NEXT: 5: [B8.2].~A() (Implicit destructor)
576 // CHECK-NEXT: Preds (2): B2 B5
577 // CHECK-NEXT: Succs (1): B0
578 // CHECK: [B2]
579 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
580 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
581 // CHECK-NEXT: 2: A d;
582 // CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
583 // CHECK-NEXT: 4: [B4.2].~A() (Implicit destructor)
584 // CHECK-NEXT: Preds (1): B4
585 // CHECK-NEXT: Succs (1): B1
586 // CHECK: [B3]
587 // CHECK-NEXT: 1: return;
588 // CHECK-NEXT: 2: [B4.2].~A() (Implicit destructor)
589 // CHECK-NEXT: 3: [B8.6].~A() (Implicit destructor)
590 // CHECK-NEXT: 4: [B8.2].~A() (Implicit destructor)
591 // CHECK-NEXT: Preds (1): B4
592 // CHECK-NEXT: Succs (1): B0
593 // CHECK: [B4]
594 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
595 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], A)
596 // CHECK-NEXT: 2: A c;
597 // CHECK-NEXT: 3: UV
598 // CHECK-NEXT: 4: [B4.3] (ImplicitCastExpr, LValueToRValue, _Bool)
599 // CHECK-NEXT: T: if [B4.4]
600 // CHECK-NEXT: Preds (1): B8
601 // CHECK-NEXT: Succs (2): B3 B2
602 // CHECK: [B5]
603 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
604 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], A)
605 // CHECK-NEXT: 2: A d;
606 // CHECK-NEXT: 3: [B5.2].~A() (Implicit destructor)
607 // CHECK-NEXT: 4: [B7.2].~A() (Implicit destructor)
608 // CHECK-NEXT: Preds (1): B7
609 // CHECK-NEXT: Succs (1): B1
610 // CHECK: [B6]
611 // CHECK-NEXT: 1: return;
612 // CHECK-NEXT: 2: [B7.2].~A() (Implicit destructor)
613 // CHECK-NEXT: 3: [B8.6].~A() (Implicit destructor)
614 // CHECK-NEXT: 4: [B8.2].~A() (Implicit destructor)
615 // CHECK-NEXT: Preds (1): B7
616 // CHECK-NEXT: Succs (1): B0
617 // CHECK: [B7]
618 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
619 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B7.2], A)
620 // CHECK-NEXT: 2: A c;
621 // CHECK-NEXT: 3: UV
622 // CHECK-NEXT: 4: [B7.3] (ImplicitCastExpr, LValueToRValue, _Bool)
623 // CHECK-NEXT: T: if [B7.4]
624 // CHECK-NEXT: Preds (1): B8
625 // CHECK-NEXT: Succs (2): B6 B5
626 // CHECK: [B8]
627 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
628 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B8.2], A)
629 // CHECK-NEXT: 2: A a;
630 // CHECK-NEXT: 3: a
631 // CHECK-NEXT: 4: [B8.3] (ImplicitCastExpr, NoOp, const A)
632 // WARNINGS-NEXT: 5: [B8.4] (CXXConstructExpr, A)
633 // ANALYZER-NEXT: 5: [B8.4] (CXXConstructExpr, [B8.6], A)
634 // CHECK-NEXT: 6: A b = a;
635 // CHECK-NEXT: 7: b
636 // CHECK-NEXT: 8: [B8.7] (ImplicitCastExpr, NoOp, const class A)
637 // CHECK-NEXT: 9: [B8.8].operator int
638 // CHECK: 10: [B8.8]
639 // CHECK: 11: [B8.10] (ImplicitCastExpr, UserDefinedConversion, int)
640 // CHECK: 12: [B8.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
641 // CHECK-NEXT: T: if [B8.12]
642 // CHECK-NEXT: Preds (1): B9
643 // CHECK-NEXT: Succs (2): B7 B4
644 // CHECK: [B0 (EXIT)]
645 // CHECK-NEXT: Preds (3): B1 B3 B6
646 void test_if_jumps() {
647 A a;
648 if (A b = a) {
649 A c;
650 if (UV) return;
651 A d;
652 } else {
653 A c;
654 if (UV) return;
655 A d;
657 A e;
660 // CHECK: [B6 (ENTRY)]
661 // CHECK-NEXT: Succs (1): B5
662 // CHECK: [B1]
663 // CHECK-NEXT: 1: [B4.4].~A() (Implicit destructor)
664 // CHECK-NEXT: 2: [B5.2].~A() (Implicit destructor)
665 // CHECK-NEXT: Preds (1): B4
666 // CHECK-NEXT: Succs (1): B0
667 // CHECK: [B2]
668 // CHECK-NEXT: Preds (1): B3
669 // CHECK-NEXT: Succs (1): B4
670 // CHECK: [B3]
671 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
672 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
673 // CHECK-NEXT: 2: A c;
674 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
675 // CHECK-NEXT: 4: [B4.4].~A() (Implicit destructor)
676 // CHECK-NEXT: Preds (1): B4
677 // CHECK-NEXT: Succs (1): B2
678 // CHECK: [B4]
679 // CHECK-NEXT: 1: a
680 // CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, NoOp, const A)
681 // WARNINGS-NEXT: 3: [B4.2] (CXXConstructExpr, A)
682 // ANALYZER-NEXT: 3: [B4.2] (CXXConstructExpr, [B4.4], A)
683 // CHECK-NEXT: 4: A b = a;
684 // CHECK-NEXT: 5: b
685 // CHECK-NEXT: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
686 // CHECK-NEXT: 7: [B4.6].operator int
687 // CHECK-NEXT: 8: [B4.6]
688 // CHECK-NEXT: 9: [B4.8] (ImplicitCastExpr, UserDefinedConversion, int)
689 // CHECK: 10: [B4.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
690 // CHECK-NEXT: T: while [B4.10]
691 // CHECK-NEXT: Preds (2): B2 B5
692 // CHECK-NEXT: Succs (2): B3 B1
693 // CHECK: [B5]
694 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
695 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], A)
696 // CHECK-NEXT: 2: A a;
697 // CHECK-NEXT: Preds (1): B6
698 // CHECK-NEXT: Succs (1): B4
699 // CHECK: [B0 (EXIT)]
700 // CHECK-NEXT: Preds (1): B1
701 void test_while_implicit_scope() {
702 A a;
703 while (A b = a)
704 A c;
707 // CHECK: [B12 (ENTRY)]
708 // CHECK-NEXT: Succs (1): B11
709 // CHECK: [B1]
710 // CHECK-NEXT: 1: [B10.4].~A() (Implicit destructor)
711 // WARNINGS-NEXT: 2: (CXXConstructExpr, A)
712 // ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], A)
713 // CHECK-NEXT: 3: A e;
714 // CHECK-NEXT: 4: [B1.3].~A() (Implicit destructor)
715 // CHECK-NEXT: 5: [B11.2].~A() (Implicit destructor)
716 // CHECK-NEXT: Preds (2): B8 B10
717 // CHECK-NEXT: Succs (1): B0
718 // CHECK: [B2]
719 // CHECK-NEXT: Preds (2): B3 B6
720 // CHECK-NEXT: Succs (1): B10
721 // CHECK: [B3]
722 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
723 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
724 // CHECK-NEXT: 2: A d;
725 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
726 // CHECK-NEXT: 4: [B9.2].~A() (Implicit destructor)
727 // CHECK-NEXT: 5: [B10.4].~A() (Implicit destructor)
728 // CHECK-NEXT: Preds (1): B5
729 // CHECK-NEXT: Succs (1): B2
730 // CHECK: [B4]
731 // CHECK-NEXT: 1: return;
732 // CHECK-NEXT: 2: [B9.2].~A() (Implicit destructor)
733 // CHECK-NEXT: 3: [B10.4].~A() (Implicit destructor)
734 // CHECK-NEXT: 4: [B11.2].~A() (Implicit destructor)
735 // CHECK-NEXT: Preds (1): B5
736 // CHECK-NEXT: Succs (1): B0
737 // CHECK: [B5]
738 // CHECK-NEXT: 1: UV
739 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
740 // CHECK-NEXT: T: if [B5.2]
741 // CHECK-NEXT: Preds (1): B7
742 // CHECK-NEXT: Succs (2): B4 B3
743 // CHECK: [B6]
744 // CHECK-NEXT: 1: [B9.2].~A() (Implicit destructor)
745 // CHECK-NEXT: 2: [B10.4].~A() (Implicit destructor)
746 // CHECK-NEXT: T: continue;
747 // CHECK: Preds (1): B7
748 // CHECK-NEXT: Succs (1): B2
749 // CHECK: [B7]
750 // CHECK-NEXT: 1: UV
751 // CHECK-NEXT: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
752 // CHECK-NEXT: T: if [B7.2]
753 // CHECK-NEXT: Preds (1): B9
754 // CHECK-NEXT: Succs (2): B6 B5
755 // CHECK: [B8]
756 // CHECK-NEXT: 1: [B9.2].~A() (Implicit destructor)
757 // CHECK-NEXT: T: break;
758 // CHECK: Preds (1): B9
759 // CHECK-NEXT: Succs (1): B1
760 // CHECK: [B9]
761 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
762 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], A)
763 // CHECK-NEXT: 2: A c;
764 // CHECK-NEXT: 3: UV
765 // CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
766 // CHECK-NEXT: T: if [B9.4]
767 // CHECK-NEXT: Preds (1): B10
768 // CHECK-NEXT: Succs (2): B8 B7
769 // CHECK: [B10]
770 // CHECK-NEXT: 1: a
771 // CHECK-NEXT: 2: [B10.1] (ImplicitCastExpr, NoOp, const A)
772 // WARNINGS-NEXT: 3: [B10.2] (CXXConstructExpr, A)
773 // ANALYZER-NEXT: 3: [B10.2] (CXXConstructExpr, [B10.4], A)
774 // CHECK-NEXT: 4: A b = a;
775 // CHECK-NEXT: 5: b
776 // CHECK-NEXT: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
777 // CHECK-NEXT: 7: [B10.6].operator int
778 // CHECK-NEXT: 8: [B10.6]
779 // CHECK-NEXT: 9: [B10.8] (ImplicitCastExpr, UserDefinedConversion, int)
780 // CHECK: 10: [B10.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
781 // CHECK-NEXT: T: while [B10.10]
782 // CHECK-NEXT: Preds (2): B2 B11
783 // CHECK-NEXT: Succs (2): B9 B1
784 // CHECK: [B11]
785 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
786 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], A)
787 // CHECK-NEXT: 2: A a;
788 // CHECK-NEXT: Preds (1): B12
789 // CHECK-NEXT: Succs (1): B10
790 // CHECK: [B0 (EXIT)]
791 // CHECK-NEXT: Preds (2): B1 B4
792 void test_while_jumps() {
793 A a;
794 while (A b = a) {
795 A c;
796 if (UV) break;
797 if (UV) continue;
798 if (UV) return;
799 A d;
801 A e;
804 // CHECK: [B4 (ENTRY)]
805 // CHECK-NEXT: Succs (1): B2
806 // CHECK: [B1]
807 // CHECK-NEXT: 1: UV
808 // CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, _Bool)
809 // CHECK-NEXT: T: do ... while [B1.2]
810 // CHECK-NEXT: Preds (1): B2
811 // CHECK-NEXT: Succs (2): B3 B0
812 // CHECK: [B2]
813 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
814 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
815 // CHECK-NEXT: 2: A a;
816 // CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
817 // CHECK-NEXT: Preds (2): B3 B4
818 // CHECK-NEXT: Succs (1): B1
819 // CHECK: [B3]
820 // CHECK-NEXT: Preds (1): B1
821 // CHECK-NEXT: Succs (1): B2
822 // CHECK: [B0 (EXIT)]
823 // CHECK-NEXT: Preds (1): B1
824 void test_do_implicit_scope() {
825 do A a;
826 while (UV);
829 // CHECK: [B12 (ENTRY)]
830 // CHECK-NEXT: Succs (1): B11
831 // CHECK: [B1]
832 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
833 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B1.2], A)
834 // CHECK-NEXT: 2: A d;
835 // CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
836 // CHECK-NEXT: 4: [B11.2].~A() (Implicit destructor)
837 // CHECK-NEXT: Preds (2): B8 B2
838 // CHECK-NEXT: Succs (1): B0
839 // CHECK: [B2]
840 // CHECK-NEXT: 1: UV
841 // CHECK-NEXT: 2: [B2.1] (ImplicitCastExpr, LValueToRValue, _Bool)
842 // CHECK-NEXT: T: do ... while [B2.2]
843 // CHECK-NEXT: Preds (2): B3 B6
844 // CHECK-NEXT: Succs (2): B10 B1
845 // CHECK: [B3]
846 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
847 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
848 // CHECK-NEXT: 2: A c;
849 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
850 // CHECK-NEXT: 4: [B9.2].~A() (Implicit destructor)
851 // CHECK-NEXT: Preds (1): B5
852 // CHECK-NEXT: Succs (1): B2
853 // CHECK: [B4]
854 // CHECK-NEXT: 1: return;
855 // CHECK-NEXT: 2: [B9.2].~A() (Implicit destructor)
856 // CHECK-NEXT: 3: [B11.2].~A() (Implicit destructor)
857 // CHECK-NEXT: Preds (1): B5
858 // CHECK-NEXT: Succs (1): B0
859 // CHECK: [B5]
860 // CHECK-NEXT: 1: UV
861 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
862 // CHECK-NEXT: T: if [B5.2]
863 // CHECK-NEXT: Preds (1): B7
864 // CHECK-NEXT: Succs (2): B4 B3
865 // CHECK: [B6]
866 // CHECK-NEXT: 1: [B9.2].~A() (Implicit destructor)
867 // CHECK-NEXT: T: continue;
868 // CHECK: Preds (1): B7
869 // CHECK-NEXT: Succs (1): B2
870 // CHECK: [B7]
871 // CHECK-NEXT: 1: UV
872 // CHECK-NEXT: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
873 // CHECK-NEXT: T: if [B7.2]
874 // CHECK-NEXT: Preds (1): B9
875 // CHECK-NEXT: Succs (2): B6 B5
876 // CHECK: [B8]
877 // CHECK-NEXT: 1: [B9.2].~A() (Implicit destructor)
878 // CHECK-NEXT: T: break;
879 // CHECK: Preds (1): B9
880 // CHECK-NEXT: Succs (1): B1
881 // CHECK: [B9]
882 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
883 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], A)
884 // CHECK-NEXT: 2: A b;
885 // CHECK-NEXT: 3: UV
886 // CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
887 // CHECK-NEXT: T: if [B9.4]
888 // CHECK-NEXT: Preds (2): B10 B11
889 // CHECK-NEXT: Succs (2): B8 B7
890 // CHECK: [B10]
891 // CHECK-NEXT: Preds (1): B2
892 // CHECK-NEXT: Succs (1): B9
893 // CHECK: [B11]
894 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
895 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], A)
896 // CHECK-NEXT: 2: A a;
897 // CHECK-NEXT: Preds (1): B12
898 // CHECK-NEXT: Succs (1): B9
899 // CHECK: [B0 (EXIT)]
900 // CHECK-NEXT: Preds (2): B1 B4
901 void test_do_jumps() {
902 A a;
903 do {
904 A b;
905 if (UV) break;
906 if (UV) continue;
907 if (UV) return;
908 A c;
909 } while (UV);
910 A d;
913 // CHECK: [B4 (ENTRY)]
914 // CHECK-NEXT: Succs (1): B2
915 // CHECK: [B1]
916 // CHECK-NEXT: 1: [B2.6].~A() (Implicit destructor)
917 // CHECK-NEXT: 2: [B2.2].~A() (Implicit destructor)
918 // CHECK-NEXT: Preds (2): B3 B2
919 // CHECK-NEXT: Succs (1): B0
920 // CHECK: [B2]
921 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
922 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
923 // CHECK-NEXT: 2: A a;
924 // CHECK-NEXT: 3: a
925 // CHECK-NEXT: 4: [B2.3] (ImplicitCastExpr, NoOp, const A)
926 // CHECK-NEXT: 5: [B2.4] (CXXConstructExpr, A)
927 // CHECK-NEXT: 6: A b = a;
928 // CHECK-NEXT: 7: b
929 // CHECK-NEXT: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
930 // CHECK-NEXT: 9: [B2.8].operator int
931 // CHECK: 10: [B2.8]
932 // CHECK: 11: [B2.10] (ImplicitCastExpr, UserDefinedConversion, int)
933 // CHECK-NEXT: T: switch [B2.11]
934 // CHECK-NEXT: Preds (1): B4
935 // CHECK-NEXT: Succs (1): B1
936 // CHECK: [B3]
937 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
938 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
939 // CHECK-NEXT: 2: A c;
940 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
941 // CHECK-NEXT: Succs (1): B1
942 // CHECK: [B0 (EXIT)]
943 // CHECK-NEXT: Preds (1): B1
944 void test_switch_implicit_scope() {
945 A a;
946 switch (A b = a)
947 A c;
950 // CHECK: [B9 (ENTRY)]
951 // CHECK-NEXT: Succs (1): B2
952 // CHECK: [B1]
953 // CHECK-NEXT: 1: [B2.6].~A() (Implicit destructor)
954 // WARNINGS-NEXT: 2: (CXXConstructExpr, A)
955 // ANALYZER-NEXT: 2: (CXXConstructExpr, [B1.3], A)
956 // CHECK-NEXT: 3: A g;
957 // CHECK-NEXT: 4: [B1.3].~A() (Implicit destructor)
958 // CHECK-NEXT: 5: [B2.2].~A() (Implicit destructor)
959 // CHECK-NEXT: Preds (3): B3 B7 B2
960 // CHECK-NEXT: Succs (1): B0
961 // CHECK: [B2]
962 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
963 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B2.2], A)
964 // CHECK-NEXT: 2: A a;
965 // CHECK-NEXT: 3: a
966 // CHECK-NEXT: 4: [B2.3] (ImplicitCastExpr, NoOp, const A)
967 // CHECK-NEXT: 5: [B2.4] (CXXConstructExpr, A)
968 // CHECK-NEXT: 6: A b = a;
969 // CHECK-NEXT: 7: b
970 // CHECK-NEXT: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
971 // CHECK-NEXT: 9: [B2.8].operator int
972 // CHECK: 10: [B2.8]
973 // CHECK: 11: [B2.10] (ImplicitCastExpr, UserDefinedConversion, int)
974 // CHECK-NEXT: T: switch [B2.11]
975 // CHECK-NEXT: Preds (1): B9
976 // CHECK-NEXT: Succs (3): B3 B8 B1
977 // CHECK: [B3]
978 // CHECK: case 1:
979 // CHECK-NEXT: T: break;
980 // CHECK: Preds (2): B2 B4
981 // CHECK-NEXT: Succs (1): B1
982 // CHECK: [B4]
983 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
984 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B4.2], A)
985 // CHECK-NEXT: 2: A f;
986 // CHECK-NEXT: 3: [B4.2].~A() (Implicit destructor)
987 // CHECK-NEXT: 4: [B8.2].~A() (Implicit destructor)
988 // CHECK-NEXT: Preds (1): B6
989 // CHECK-NEXT: Succs (1): B3
990 // CHECK: [B5]
991 // CHECK-NEXT: 1: return;
992 // CHECK-NEXT: 2: [B8.2].~A() (Implicit destructor)
993 // CHECK-NEXT: 3: [B2.6].~A() (Implicit destructor)
994 // CHECK-NEXT: 4: [B2.2].~A() (Implicit destructor)
995 // CHECK-NEXT: Preds (1): B6
996 // CHECK-NEXT: Succs (1): B0
997 // CHECK: [B6]
998 // CHECK-NEXT: 1: UV
999 // CHECK-NEXT: 2: [B6.1] (ImplicitCastExpr, LValueToRValue, _Bool)
1000 // CHECK-NEXT: T: if [B6.2]
1001 // CHECK-NEXT: Preds (1): B8
1002 // CHECK-NEXT: Succs (2): B5 B4
1003 // CHECK: [B7]
1004 // CHECK-NEXT: 1: [B8.2].~A() (Implicit destructor)
1005 // CHECK-NEXT: T: break;
1006 // CHECK: Preds (1): B8
1007 // CHECK-NEXT: Succs (1): B1
1008 // CHECK: [B8]
1009 // CHECK: case 0:
1010 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
1011 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B8.2], A)
1012 // CHECK-NEXT: 2: A c;
1013 // CHECK-NEXT: 3: UV
1014 // CHECK-NEXT: 4: [B8.3] (ImplicitCastExpr, LValueToRValue, _Bool)
1015 // CHECK-NEXT: T: if [B8.4]
1016 // CHECK-NEXT: Preds (1): B2
1017 // CHECK-NEXT: Succs (2): B7 B6
1018 // CHECK: [B0 (EXIT)]
1019 // CHECK-NEXT: Preds (2): B1 B5
1020 void test_switch_jumps() {
1021 A a;
1022 switch (A b = a) {
1023 case 0: {
1024 A c;
1025 if (UV) break;
1026 if (UV) return;
1027 A f;
1029 case 1:
1030 break;
1032 A g;
1035 // CHECK: [B6 (ENTRY)]
1036 // CHECK-NEXT: Succs (1): B5
1037 // CHECK: [B1]
1038 // CHECK-NEXT: 1: [B4.4].~A() (Implicit destructor)
1039 // CHECK-NEXT: 2: [B5.2].~A() (Implicit destructor)
1040 // CHECK-NEXT: Preds (1): B4
1041 // CHECK-NEXT: Succs (1): B0
1042 // CHECK: [B2]
1043 // CHECK-NEXT: 1: b
1044 // CHECK-NEXT: 2: [B2.1].x
1045 // CHECK-NEXT: 3: ++[B2.2]
1046 // CHECK-NEXT: 4: [B4.4].~A() (Implicit destructor)
1047 // CHECK-NEXT: Preds (1): B3
1048 // CHECK-NEXT: Succs (1): B4
1049 // CHECK: [B3]
1050 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
1051 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
1052 // CHECK-NEXT: 2: A c;
1053 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
1054 // CHECK-NEXT: Preds (1): B4
1055 // CHECK-NEXT: Succs (1): B2
1056 // CHECK: [B4]
1057 // CHECK-NEXT: 1: a
1058 // CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, NoOp, const A)
1059 // WARNINGS-NEXT: 3: [B4.2] (CXXConstructExpr, A)
1060 // ANALYZER-NEXT: 3: [B4.2] (CXXConstructExpr, [B4.4], A)
1061 // CHECK-NEXT: 4: A b = a;
1062 // CHECK-NEXT: 5: b
1063 // CHECK-NEXT: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
1064 // CHECK-NEXT: 7: [B4.6].operator int
1065 // CHECK-NEXT: 8: [B4.6]
1066 // CHECK-NEXT: 9: [B4.8] (ImplicitCastExpr, UserDefinedConversion, int)
1067 // CHECK: 10: [B4.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
1068 // CHECK-NEXT: T: for (...; [B4.10]; ...)
1069 // CHECK-NEXT: Preds (2): B2 B5
1070 // CHECK-NEXT: Succs (2): B3 B1
1071 // CHECK: [B5]
1072 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
1073 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B5.2], A)
1074 // CHECK-NEXT: 2: A a;
1075 // CHECK-NEXT: Preds (1): B6
1076 // CHECK-NEXT: Succs (1): B4
1077 // CHECK: [B0 (EXIT)]
1078 // CHECK-NEXT: Preds (1): B1
1079 void test_for_implicit_scope() {
1080 for (A a; A b = a; ++b.x)
1081 A c;
1084 // CHECK-LABEL: void test_for_range_implicit_scope()
1085 // CHECK: [B5 (ENTRY)]
1086 // CHECK-NEXT: Succs (1): B4
1087 // CHECK: [B1]
1088 // CHECK-NEXT: 1: __begin1
1089 // CHECK-NEXT: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, int *)
1090 // CHECK-NEXT: 3: __end1
1091 // CHECK-NEXT: 4: [B1.3] (ImplicitCastExpr, LValueToRValue, int *)
1092 // CHECK-NEXT: 5: [B1.2] != [B1.4]
1093 // CHECK-NEXT: T: for (int n : [B4.2])
1094 // CHECK-NEXT:[B3.7]
1095 // CHECK-NEXT: Preds (2): B2 B4
1096 // CHECK-NEXT: Succs (2): B3 B0
1097 // CHECK: [B2]
1098 // CHECK-NEXT: 1: __begin1
1099 // CHECK-NEXT: 2: ++[B2.1]
1100 // CHECK-NEXT: Preds (1): B3
1101 // CHECK-NEXT: Succs (1): B1
1102 // CHECK: [B3]
1103 // CHECK-NEXT: 1: __begin1
1104 // CHECK-NEXT: 2: [B3.1] (ImplicitCastExpr, LValueToRValue, int *)
1105 // CHECK-NEXT: 3: *[B3.2]
1106 // CHECK-NEXT: 4: [B3.3] (ImplicitCastExpr, LValueToRValue, int)
1107 // CHECK-NEXT: 5: int n
1108 // WARNINGS-NEXT: 6: (CXXConstructExpr, A)
1109 // ANALYZER-NEXT: 6: (CXXConstructExpr, [B3.7], A)
1110 // CHECK-NEXT: 7: A c;
1111 // CHECK-NEXT: 8: [B3.7].~A() (Implicit destructor)
1112 // CHECK-NEXT: Preds (1): B1
1113 // CHECK-NEXT: Succs (1): B2
1114 // CHECK: [B4]
1115 // CHECK-NEXT: 1: int nums[4];
1116 // CHECK-NEXT: 2: nums
1117 // CHECK-NEXT: 3: auto &&__range1 = nums;
1118 // CHECK-NEXT: 4: __range1
1119 // CHECK-NEXT: 5: [B4.4] (ImplicitCastExpr, ArrayToPointerDecay, int *)
1120 // CHECK-NEXT: 6: 4{{L*}}
1121 // CHECK-NEXT: 7: [B4.5] + [B4.6]
1122 // CHECK-NEXT: 8: auto __end1 = __range1 + 4{{L*}};
1123 // CHECK-NEXT: 9: __range1
1124 // CHECK-NEXT: 10: [B4.9] (ImplicitCastExpr, ArrayToPointerDecay, int *)
1125 // CHECK-NEXT: 11: auto __begin1 = __range1;
1126 // CHECK-NEXT: Preds (1): B5
1127 // CHECK-NEXT: Succs (1): B1
1128 // CHECK: [B0 (EXIT)]
1129 // CHECK-NEXT: Preds (1): B1
1130 void test_for_range_implicit_scope() {
1131 int nums[4];
1132 for (int n : nums)
1133 A c;
1137 // CHECK: [B12 (ENTRY)]
1138 // CHECK-NEXT: Succs (1): B11
1139 // CHECK: [B1]
1140 // CHECK-NEXT: 1: [B10.4].~A() (Implicit destructor)
1141 // CHECK-NEXT: 2: [B11.4].~A() (Implicit destructor)
1142 // WARNINGS-NEXT: 3: (CXXConstructExpr, A)
1143 // ANALYZER-NEXT: 3: (CXXConstructExpr, [B1.4], A)
1144 // CHECK-NEXT: 4: A f;
1145 // CHECK-NEXT: 5: [B1.4].~A() (Implicit destructor)
1146 // CHECK-NEXT: 6: [B11.2].~A() (Implicit destructor)
1147 // CHECK-NEXT: Preds (2): B8 B10
1148 // CHECK-NEXT: Succs (1): B0
1149 // CHECK: [B2]
1150 // CHECK-NEXT: 1: [B10.4].~A() (Implicit destructor)
1151 // CHECK-NEXT: Preds (2): B3 B6
1152 // CHECK-NEXT: Succs (1): B10
1153 // CHECK: [B3]
1154 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
1155 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B3.2], A)
1156 // CHECK-NEXT: 2: A e;
1157 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
1158 // CHECK-NEXT: 4: [B9.2].~A() (Implicit destructor)
1159 // CHECK-NEXT: Preds (1): B5
1160 // CHECK-NEXT: Succs (1): B2
1161 // CHECK: [B4]
1162 // CHECK-NEXT: 1: return;
1163 // CHECK-NEXT: 2: [B9.2].~A() (Implicit destructor)
1164 // CHECK-NEXT: 3: [B10.4].~A() (Implicit destructor)
1165 // CHECK-NEXT: 4: [B11.4].~A() (Implicit destructor)
1166 // CHECK-NEXT: 5: [B11.2].~A() (Implicit destructor)
1167 // CHECK-NEXT: Preds (1): B5
1168 // CHECK-NEXT: Succs (1): B0
1169 // CHECK: [B5]
1170 // CHECK-NEXT: 1: UV
1171 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
1172 // CHECK-NEXT: T: if [B5.2]
1173 // CHECK-NEXT: Preds (1): B7
1174 // CHECK-NEXT: Succs (2): B4 B3
1175 // CHECK: [B6]
1176 // CHECK-NEXT: 1: [B9.2].~A() (Implicit destructor)
1177 // CHECK-NEXT: T: continue;
1178 // CHECK: Preds (1): B7
1179 // CHECK-NEXT: Succs (1): B2
1180 // CHECK: [B7]
1181 // CHECK-NEXT: 1: UV
1182 // CHECK-NEXT: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
1183 // CHECK-NEXT: T: if [B7.2]
1184 // CHECK-NEXT: Preds (1): B9
1185 // CHECK-NEXT: Succs (2): B6 B5
1186 // CHECK: [B8]
1187 // CHECK-NEXT: 1: [B9.2].~A() (Implicit destructor)
1188 // CHECK-NEXT: T: break;
1189 // CHECK: Preds (1): B9
1190 // CHECK-NEXT: Succs (1): B1
1191 // CHECK: [B9]
1192 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
1193 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B9.2], A)
1194 // CHECK-NEXT: 2: A d;
1195 // CHECK-NEXT: 3: UV
1196 // CHECK-NEXT: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
1197 // CHECK-NEXT: T: if [B9.4]
1198 // CHECK-NEXT: Preds (1): B10
1199 // CHECK-NEXT: Succs (2): B8 B7
1200 // CHECK: [B10]
1201 // CHECK-NEXT: 1: b
1202 // CHECK-NEXT: 2: [B10.1] (ImplicitCastExpr, NoOp, const A)
1203 // WARNINGS-NEXT: 3: [B10.2] (CXXConstructExpr, A)
1204 // ANALYZER-NEXT: 3: [B10.2] (CXXConstructExpr, [B10.4], A)
1205 // CHECK-NEXT: 4: A c = b;
1206 // CHECK-NEXT: 5: c
1207 // CHECK-NEXT: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
1208 // CHECK-NEXT: 7: [B10.6].operator int
1209 // CHECK-NEXT: 8: [B10.6]
1210 // CHECK-NEXT: 9: [B10.8] (ImplicitCastExpr, UserDefinedConversion, int)
1211 // CHECK: 10: [B10.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
1212 // CHECK-NEXT: T: for (...; [B10.10]; )
1213 // CHECK-NEXT: Preds (2): B2 B11
1214 // CHECK-NEXT: Succs (2): B9 B1
1215 // CHECK: [B11]
1216 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
1217 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B11.2], A)
1218 // CHECK-NEXT: 2: A a;
1219 // WARNINGS-NEXT: 3: (CXXConstructExpr, A)
1220 // ANALYZER-NEXT: 3: (CXXConstructExpr, [B11.4], A)
1221 // CHECK-NEXT: 4: A b;
1222 // CHECK-NEXT: Preds (1): B12
1223 // CHECK-NEXT: Succs (1): B10
1224 // CHECK: [B0 (EXIT)]
1225 // CHECK-NEXT: Preds (2): B1 B4
1226 void test_for_jumps() {
1227 A a;
1228 for (A b; A c = b;) {
1229 A d;
1230 if (UV) break;
1231 if (UV) continue;
1232 if (UV) return;
1233 A e;
1235 A f;
1238 // CHECK: [B9 (ENTRY)]
1239 // CHECK-NEXT: Succs (1): B8
1240 // CHECK: [B1]
1241 // CHECK-NEXT: 1: [B7.4].~A() (Implicit destructor)
1242 // CHECK-NEXT: 2: [B8.2].~A() (Implicit destructor)
1243 // CHECK-NEXT: Preds (1): B7
1244 // CHECK-NEXT: Succs (1): B0
1245 // CHECK: [B2]
1246 // CHECK-NEXT: 1: [B5.4] ? [B3.3] : [B4.1]
1247 // CHECK-NEXT: 2: [B7.4].~A() (Implicit destructor)
1248 // CHECK-NEXT: Preds (2): B3 B4
1249 // CHECK-NEXT: Succs (1): B7
1250 // CHECK: [B3]
1251 // CHECK-NEXT: 1: b
1252 // CHECK-NEXT: 2: [B3.1].x
1253 // CHECK-NEXT: 3: [B3.2]++
1254 // CHECK-NEXT: Preds (1): B5
1255 // CHECK-NEXT: Succs (1): B2
1256 // CHECK: [B4]
1257 // CHECK-NEXT: 1: 0
1258 // CHECK-NEXT: Preds (1): B5
1259 // CHECK-NEXT: Succs (1): B2
1260 // CHECK: [B5]
1261 // CHECK-NEXT: 1: b
1262 // CHECK-NEXT: 2: [B5.1].x
1263 // CHECK-NEXT: 3: [B5.2] (ImplicitCastExpr, LValueToRValue, int)
1264 // CHECK-NEXT: 4: [B5.3] (ImplicitCastExpr, IntegralToBoolean, _Bool)
1265 // CHECK-NEXT: T: [B5.4] ? ... : ...
1266 // CHECK-NEXT: Preds (1): B6
1267 // CHECK-NEXT: Succs (2): B3 B4
1268 // CHECK: [B6]
1269 // CHECK-NEXT: 1: 0
1270 // CHECK-NEXT: 2: (void)[B6.1] (CStyleCastExpr, ToVoid, void)
1271 // CHECK-NEXT: Preds (1): B7
1272 // CHECK-NEXT: Succs (1): B5
1273 // CHECK: [B7]
1274 // CHECK-NEXT: 1: a
1275 // CHECK-NEXT: 2: [B7.1] (ImplicitCastExpr, NoOp, const A)
1276 // WARNINGS-NEXT: 3: [B7.2] (CXXConstructExpr, A)
1277 // ANALYZER-NEXT: 3: [B7.2] (CXXConstructExpr, [B7.4], A)
1278 // CHECK-NEXT: 4: A b = a;
1279 // CHECK-NEXT: 5: b
1280 // CHECK-NEXT: 6: [B7.5] (ImplicitCastExpr, NoOp, const class A)
1281 // CHECK-NEXT: 7: [B7.6].operator int
1282 // CHECK-NEXT: 8: [B7.6]
1283 // CHECK-NEXT: 9: [B7.8] (ImplicitCastExpr, UserDefinedConversion, int)
1284 // CHECK-NEXT: 10: [B7.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
1285 // CHECK-NEXT: T: for (...; [B7.10]; ...)
1286 // CHECK-NEXT: Preds (2): B2 B8
1287 // CHECK-NEXT: Succs (2): B6 B1
1288 // CHECK: [B8]
1289 // WARNINGS-NEXT: 1: (CXXConstructExpr, A)
1290 // ANALYZER-NEXT: 1: (CXXConstructExpr, [B8.2], A)
1291 // CHECK-NEXT: 2: A a;
1292 // CHECK-NEXT: Preds (1): B9
1293 // CHECK-NEXT: Succs (1): B7
1294 void test_for_inc_conditional() {
1295 for (A a; A b = a; b.x ? b.x++ : 0)
1296 (void)0;
1299 // CHECK: [B3 (ENTRY)]
1300 // CHECK-NEXT: Succs (1): B0
1301 // CHECK: [B1]
1302 // CHECK-NEXT: T: try ...
1303 // CHECK-NEXT: Succs (2): B2 B0
1304 // CHECK: [B2]
1305 // CHECK-NEXT: catch (const A &e):
1306 // CHECK-NEXT: 1: catch (const A &e) {
1307 // CHECK-NEXT: }
1308 // CHECK-NEXT: Preds (1): B1
1309 // CHECK-NEXT: Succs (1): B0
1310 // CHECK: [B0 (EXIT)]
1311 // CHECK-NEXT: Preds (3): B2 B1 B3
1312 void test_catch_const_ref() {
1313 try {
1314 } catch (const A& e) {
1318 // CHECK: [B3 (ENTRY)]
1319 // CHECK-NEXT: Succs (1): B0
1320 // CHECK: [B1]
1321 // CHECK-NEXT: T: try ...
1322 // CHECK-NEXT: Succs (2): B2 B0
1323 // CHECK: [B2]
1324 // CHECK-NEXT: catch (A e):
1325 // CHECK-NEXT: 1: catch (A e) {
1326 // CHECK-NEXT: }
1327 // CHECK-NEXT: 2: [B2.1].~A() (Implicit destructor)
1328 // CHECK-NEXT: Preds (1): B1
1329 // CHECK-NEXT: Succs (1): B0
1330 // CHECK: [B0 (EXIT)]
1331 // CHECK-NEXT: Preds (3): B2 B1 B3
1332 void test_catch_copy() {
1333 try {
1334 } catch (A e) {