1 // RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-checker=debug.DumpCFG -analyzer-config cfg-scopes=true %s > %t 2>&1
2 // RUN: FileCheck --input-file=%t %s
7 // CHECK-NEXT: Succs (1): B0
9 // CHECK-NEXT: Preds (1): B1
12 // CHECK: [B1 (ENTRY)]
13 // CHECK-NEXT: Succs (1): B0
15 // CHECK-NEXT: Preds (1): B1
18 // CHECK: [B2 (ENTRY)]
19 // CHECK-NEXT: Succs (1): B1
22 // CHECK-NEXT: 2: return [B1.1];
23 // CHECK-NEXT: Preds (1): B2
24 // CHECK-NEXT: Succs (1): B0
26 // CHECK-NEXT: Preds (1): B1
27 operator int() const { return 1; }
33 // CHECK: [B2 (ENTRY)]
34 // CHECK-NEXT: Succs (1): B1
36 // CHECK-NEXT: 1: CFGScopeBegin(a)
37 // CHECK-NEXT: 2: (CXXConstructExpr, [B1.3], A[2])
38 // CHECK-NEXT: 3: A a[2];
39 // CHECK-NEXT: 4: (CXXConstructExpr, [B1.5], A[0])
40 // CHECK-NEXT: 5: A b[0];
41 // CHECK-NEXT: 6: [B1.3].~A[2]() (Implicit destructor)
42 // CHECK-NEXT: 7: CFGScopeEnd(a)
43 // CHECK-NEXT: Preds (1): B2
44 // CHECK-NEXT: Succs (1): B0
46 // CHECK-NEXT: Preds (1): B1
52 // CHECK: [B2 (ENTRY)]
53 // CHECK-NEXT: Succs (1): B1
55 // CHECK-NEXT: 1: CFGScopeBegin(a)
56 // CHECK-NEXT: 2: (CXXConstructExpr, [B1.3], A)
57 // CHECK-NEXT: 3: A a;
58 // CHECK-NEXT: 4: CFGScopeBegin(c)
59 // CHECK-NEXT: 5: (CXXConstructExpr, [B1.6], A)
60 // CHECK-NEXT: 6: A c;
61 // CHECK-NEXT: 7: (CXXConstructExpr, [B1.8], A)
62 // CHECK-NEXT: 8: A d;
63 // CHECK-NEXT: 9: [B1.8].~A() (Implicit destructor)
64 // CHECK-NEXT: 10: [B1.6].~A() (Implicit destructor)
65 // CHECK-NEXT: 11: CFGScopeEnd(c)
66 // CHECK-NEXT: 12: (CXXConstructExpr, [B1.13], A)
67 // CHECK-NEXT: 13: A b;
68 // CHECK-NEXT: 14: [B1.13].~A() (Implicit destructor)
69 // CHECK-NEXT: 15: [B1.3].~A() (Implicit destructor)
70 // CHECK-NEXT: 16: CFGScopeEnd(a)
71 // CHECK-NEXT: Preds (1): B2
72 // CHECK-NEXT: Succs (1): B0
74 // CHECK-NEXT: Preds (1): B1
83 // CHECK: [B4 (ENTRY)]
84 // CHECK-NEXT: Succs (1): B3
86 // CHECK-NEXT: 1: (CXXConstructExpr, [B1.2], A)
87 // CHECK-NEXT: 2: A c;
88 // CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
89 // CHECK-NEXT: 4: [B3.5].~A() (Implicit destructor)
90 // CHECK-NEXT: 5: [B3.3].~A() (Implicit destructor)
91 // CHECK-NEXT: 6: CFGScopeEnd(a)
92 // CHECK-NEXT: Preds (1): B3
93 // CHECK-NEXT: Succs (1): B0
95 // CHECK-NEXT: 1: return;
96 // CHECK-NEXT: 2: [B3.5].~A() (Implicit destructor)
97 // CHECK-NEXT: 3: [B3.3].~A() (Implicit destructor)
98 // CHECK-NEXT: 4: CFGScopeEnd(a)
99 // CHECK-NEXT: Preds (1): B3
100 // CHECK-NEXT: Succs (1): B0
102 // CHECK-NEXT: 1: CFGScopeBegin(a)
103 // CHECK-NEXT: 2: (CXXConstructExpr, [B3.3], A)
104 // CHECK-NEXT: 3: A a;
105 // CHECK-NEXT: 4: (CXXConstructExpr, [B3.5], A)
106 // CHECK-NEXT: 5: A b;
108 // CHECK-NEXT: 7: [B3.6] (ImplicitCastExpr, LValueToRValue, _Bool)
109 // CHECK-NEXT: T: if [B3.7]
110 // CHECK-NEXT: Preds (1): B4
111 // CHECK-NEXT: Succs (2): B2 B1
112 // CHECK: [B0 (EXIT)]
113 // CHECK-NEXT: Preds (2): B1 B2
121 // CHECK: [B5 (ENTRY)]
122 // CHECK-NEXT: Succs (1): B4
124 // CHECK-NEXT: 1: [B4.8].~A() (Implicit destructor)
125 // CHECK-NEXT: 2: CFGScopeEnd(b)
126 // CHECK-NEXT: 3: [B4.3].~A() (Implicit destructor)
127 // CHECK-NEXT: 4: CFGScopeEnd(a)
128 // CHECK-NEXT: Preds (2): B2 B3
129 // CHECK-NEXT: Succs (1): B0
131 // CHECK-NEXT: 1: CFGScopeBegin(c)
132 // CHECK-NEXT: 2: (CXXConstructExpr, [B2.3], A)
133 // CHECK-NEXT: 3: A c;
134 // CHECK-NEXT: 4: [B2.3].~A() (Implicit destructor)
135 // CHECK-NEXT: 5: CFGScopeEnd(c)
136 // CHECK-NEXT: Preds (1): B4
137 // CHECK-NEXT: Succs (1): B1
139 // CHECK-NEXT: 1: CFGScopeBegin(c)
140 // CHECK-NEXT: 2: (CXXConstructExpr, [B3.3], A)
141 // CHECK-NEXT: 3: A c;
142 // CHECK-NEXT: 4: [B3.3].~A() (Implicit destructor)
143 // CHECK-NEXT: 5: CFGScopeEnd(c)
144 // CHECK-NEXT: Preds (1): B4
145 // CHECK-NEXT: Succs (1): B1
147 // CHECK-NEXT: 1: CFGScopeBegin(a)
148 // CHECK-NEXT: 2: (CXXConstructExpr, [B4.3], A)
149 // CHECK-NEXT: 3: A a;
150 // CHECK-NEXT: 4: CFGScopeBegin(b)
152 // CHECK-NEXT: 6: [B4.5] (ImplicitCastExpr, NoOp, const A)
153 // CHECK-NEXT: 7: [B4.6] (CXXConstructExpr, [B4.8], A)
154 // CHECK-NEXT: 8: A b = a;
156 // CHECK-NEXT: 10: [B4.9] (ImplicitCastExpr, NoOp, const class A)
157 // CHECK-NEXT: 11: [B4.10].operator int
158 // CHECK-NEXT: 12: [B4.10]
159 // CHECK-NEXT: 13: [B4.12] (ImplicitCastExpr, UserDefinedConversion, int)
160 // CHECK-NEXT: 14: [B4.13] (ImplicitCastExpr, IntegralToBoolean, _Bool)
161 // CHECK-NEXT: T: if [B4.14]
162 // CHECK-NEXT: Preds (1): B5
163 // CHECK-NEXT: Succs (2): B3 B2
164 // CHECK: [B0 (EXIT)]
165 // CHECK-NEXT: Preds (1): B1
166 void test_if_implicit_scope() {
173 // CHECK: [B9 (ENTRY)]
174 // CHECK-NEXT: Succs (1): B8
176 // CHECK-NEXT: 1: [B8.8].~A() (Implicit destructor)
177 // CHECK-NEXT: 2: CFGScopeEnd(b)
178 // CHECK-NEXT: 3: (CXXConstructExpr, [B1.4], A)
179 // CHECK-NEXT: 4: A e;
180 // CHECK-NEXT: 5: [B1.4].~A() (Implicit destructor)
181 // CHECK-NEXT: 6: [B8.3].~A() (Implicit destructor)
182 // CHECK-NEXT: 7: CFGScopeEnd(a)
183 // CHECK-NEXT: Preds (2): B2 B5
184 // CHECK-NEXT: Succs (1): B0
186 // CHECK-NEXT: 1: (CXXConstructExpr, [B2.2], A)
187 // CHECK-NEXT: 2: A d;
188 // CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
189 // CHECK-NEXT: 4: [B4.3].~A() (Implicit destructor)
190 // CHECK-NEXT: 5: CFGScopeEnd(c)
191 // CHECK-NEXT: Preds (1): B4
192 // CHECK-NEXT: Succs (1): B1
194 // CHECK-NEXT: 1: return;
195 // CHECK-NEXT: 2: [B4.3].~A() (Implicit destructor)
196 // CHECK-NEXT: 3: CFGScopeEnd(c)
197 // CHECK-NEXT: 4: [B8.8].~A() (Implicit destructor)
198 // CHECK-NEXT: 5: CFGScopeEnd(b)
199 // CHECK-NEXT: 6: [B8.3].~A() (Implicit destructor)
200 // CHECK-NEXT: 7: CFGScopeEnd(a)
201 // CHECK-NEXT: Preds (1): B4
202 // CHECK-NEXT: Succs (1): B0
204 // CHECK-NEXT: 1: CFGScopeBegin(c)
205 // CHECK-NEXT: 2: (CXXConstructExpr, [B4.3], A)
206 // CHECK-NEXT: 3: A c;
208 // CHECK-NEXT: 5: [B4.4] (ImplicitCastExpr, LValueToRValue, _Bool)
209 // CHECK-NEXT: T: if [B4.5]
210 // CHECK-NEXT: Preds (1): B8
211 // CHECK-NEXT: Succs (2): B3 B2
213 // CHECK-NEXT: 1: (CXXConstructExpr, [B5.2], A)
214 // CHECK-NEXT: 2: A d;
215 // CHECK-NEXT: 3: [B5.2].~A() (Implicit destructor)
216 // CHECK-NEXT: 4: [B7.3].~A() (Implicit destructor)
217 // CHECK-NEXT: 5: CFGScopeEnd(c)
218 // CHECK-NEXT: Preds (1): B7
219 // CHECK-NEXT: Succs (1): B1
221 // CHECK-NEXT: 1: return;
222 // CHECK-NEXT: 2: [B7.3].~A() (Implicit destructor)
223 // CHECK-NEXT: 3: CFGScopeEnd(c)
224 // CHECK-NEXT: 4: [B8.8].~A() (Implicit destructor)
225 // CHECK-NEXT: 5: CFGScopeEnd(b)
226 // CHECK-NEXT: 6: [B8.3].~A() (Implicit destructor)
227 // CHECK-NEXT: 7: CFGScopeEnd(a)
228 // CHECK-NEXT: Preds (1): B7
229 // CHECK-NEXT: Succs (1): B0
231 // CHECK-NEXT: 1: CFGScopeBegin(c)
232 // CHECK-NEXT: 2: (CXXConstructExpr, [B7.3], A)
233 // CHECK-NEXT: 3: A c;
235 // CHECK-NEXT: 5: [B7.4] (ImplicitCastExpr, LValueToRValue, _Bool)
236 // CHECK-NEXT: T: if [B7.5]
237 // CHECK-NEXT: Preds (1): B8
238 // CHECK-NEXT: Succs (2): B6 B5
240 // CHECK-NEXT: 1: CFGScopeBegin(a)
241 // CHECK-NEXT: 2: (CXXConstructExpr, [B8.3], A)
242 // CHECK-NEXT: 3: A a;
243 // CHECK-NEXT: 4: CFGScopeBegin(b)
245 // CHECK-NEXT: 6: [B8.5] (ImplicitCastExpr, NoOp, const A)
246 // CHECK-NEXT: 7: [B8.6] (CXXConstructExpr, [B8.8], A)
247 // CHECK-NEXT: 8: A b = a;
249 // CHECK-NEXT: 10: [B8.9] (ImplicitCastExpr, NoOp, const class A)
250 // CHECK-NEXT: 11: [B8.10].operator int
251 // CHECK-NEXT: 12: [B8.10]
252 // CHECK-NEXT: 13: [B8.12] (ImplicitCastExpr, UserDefinedConversion, int)
253 // CHECK-NEXT: 14: [B8.13] (ImplicitCastExpr, IntegralToBoolean, _Bool)
254 // CHECK-NEXT: T: if [B8.14]
255 // CHECK-NEXT: Preds (1): B9
256 // CHECK-NEXT: Succs (2): B7 B4
257 // CHECK: [B0 (EXIT)]
258 // CHECK-NEXT: Preds (3): B1 B3 B6
259 void test_if_jumps() {
273 // CHECK: [B6 (ENTRY)]
274 // CHECK-NEXT: Succs (1): B5
276 // CHECK-NEXT: 1: [B4.5].~A() (Implicit destructor)
277 // CHECK-NEXT: 2: CFGScopeEnd(b)
278 // CHECK-NEXT: 3: [B5.3].~A() (Implicit destructor)
279 // CHECK-NEXT: 4: CFGScopeEnd(a)
280 // CHECK-NEXT: Preds (1): B4
281 // CHECK-NEXT: Succs (1): B0
283 // CHECK-NEXT: Preds (1): B3
284 // CHECK-NEXT: Succs (1): B4
286 // CHECK-NEXT: 1: CFGScopeBegin(c)
287 // CHECK-NEXT: 2: (CXXConstructExpr, [B3.3], A)
288 // CHECK-NEXT: 3: A c;
289 // CHECK-NEXT: 4: [B3.3].~A() (Implicit destructor)
290 // CHECK-NEXT: 5: CFGScopeEnd(c)
291 // CHECK-NEXT: 6: [B4.5].~A() (Implicit destructor)
292 // CHECK-NEXT: 7: CFGScopeEnd(b)
293 // CHECK-NEXT: Preds (1): B4
294 // CHECK-NEXT: Succs (1): B2
296 // CHECK-NEXT: 1: CFGScopeBegin(b)
298 // CHECK-NEXT: 3: [B4.2] (ImplicitCastExpr, NoOp, const A)
299 // CHECK-NEXT: 4: [B4.3] (CXXConstructExpr, [B4.5], A)
300 // CHECK-NEXT: 5: A b = a;
302 // CHECK-NEXT: 7: [B4.6] (ImplicitCastExpr, NoOp, const class A)
303 // CHECK-NEXT: 8: [B4.7].operator int
304 // CHECK-NEXT: 9: [B4.7]
305 // CHECK-NEXT: 10: [B4.9] (ImplicitCastExpr, UserDefinedConversion, int)
306 // CHECK-NEXT: 11: [B4.10] (ImplicitCastExpr, IntegralToBoolean, _Bool)
307 // CHECK-NEXT: T: while [B4.11]
308 // CHECK-NEXT: Preds (2): B2 B5
309 // CHECK-NEXT: Succs (2): B3 B1
311 // CHECK-NEXT: 1: CFGScopeBegin(a)
312 // CHECK-NEXT: 2: (CXXConstructExpr, [B5.3], A)
313 // CHECK-NEXT: 3: A a;
314 // CHECK-NEXT: Preds (1): B6
315 // CHECK-NEXT: Succs (1): B4
316 // CHECK: [B0 (EXIT)]
317 // CHECK-NEXT: Preds (1): B1
318 void test_while_implicit_scope() {
324 // CHECK: [B12 (ENTRY)]
325 // CHECK-NEXT: Succs (1): B11
327 // CHECK-NEXT: 1: [B10.5].~A() (Implicit destructor)
328 // CHECK-NEXT: 2: CFGScopeEnd(b)
329 // CHECK-NEXT: 3: (CXXConstructExpr, [B1.4], A)
330 // CHECK-NEXT: 4: A e;
331 // CHECK-NEXT: 5: [B1.4].~A() (Implicit destructor)
332 // CHECK-NEXT: 6: [B11.3].~A() (Implicit destructor)
333 // CHECK-NEXT: 7: CFGScopeEnd(a)
334 // CHECK-NEXT: Preds (2): B8 B10
335 // CHECK-NEXT: Succs (1): B0
337 // CHECK-NEXT: Preds (2): B3 B6
338 // CHECK-NEXT: Succs (1): B10
340 // CHECK-NEXT: 1: (CXXConstructExpr, [B3.2], A)
341 // CHECK-NEXT: 2: A d;
342 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
343 // CHECK-NEXT: 4: [B9.3].~A() (Implicit destructor)
344 // CHECK-NEXT: 5: CFGScopeEnd(c)
345 // CHECK-NEXT: 6: [B10.5].~A() (Implicit destructor)
346 // CHECK-NEXT: 7: CFGScopeEnd(b)
347 // CHECK-NEXT: Preds (1): B5
348 // CHECK-NEXT: Succs (1): B2
350 // CHECK-NEXT: 1: return;
351 // CHECK-NEXT: 2: [B9.3].~A() (Implicit destructor)
352 // CHECK-NEXT: 3: CFGScopeEnd(c)
353 // CHECK-NEXT: 4: [B10.5].~A() (Implicit destructor)
354 // CHECK-NEXT: 5: CFGScopeEnd(b)
355 // CHECK-NEXT: 6: [B11.3].~A() (Implicit destructor)
356 // CHECK-NEXT: 7: CFGScopeEnd(a)
357 // CHECK-NEXT: Preds (1): B5
358 // CHECK-NEXT: Succs (1): B0
361 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
362 // CHECK-NEXT: T: if [B5.2]
363 // CHECK-NEXT: Preds (1): B7
364 // CHECK-NEXT: Succs (2): B4 B3
366 // CHECK-NEXT: 1: [B9.3].~A() (Implicit destructor)
367 // CHECK-NEXT: 2: CFGScopeEnd(c)
368 // CHECK-NEXT: 3: [B10.5].~A() (Implicit destructor)
369 // CHECK-NEXT: 4: CFGScopeEnd(b)
370 // CHECK-NEXT: T: continue;
371 // CHECK-NEXT: Preds (1): B7
372 // CHECK-NEXT: Succs (1): B2
375 // CHECK-NEXT: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
376 // CHECK-NEXT: T: if [B7.2]
377 // CHECK-NEXT: Preds (1): B9
378 // CHECK-NEXT: Succs (2): B6 B5
380 // CHECK-NEXT: 1: [B9.3].~A() (Implicit destructor)
381 // CHECK-NEXT: 2: CFGScopeEnd(c)
382 // CHECK-NEXT: T: break;
383 // CHECK-NEXT: Preds (1): B9
384 // CHECK-NEXT: Succs (1): B1
386 // CHECK-NEXT: 1: CFGScopeBegin(c)
387 // CHECK-NEXT: 2: (CXXConstructExpr, [B9.3], A)
388 // CHECK-NEXT: 3: A c;
390 // CHECK-NEXT: 5: [B9.4] (ImplicitCastExpr, LValueToRValue, _Bool)
391 // CHECK-NEXT: T: if [B9.5]
392 // CHECK-NEXT: Preds (1): B10
393 // CHECK-NEXT: Succs (2): B8 B7
395 // CHECK-NEXT: 1: CFGScopeBegin(b)
397 // CHECK-NEXT: 3: [B10.2] (ImplicitCastExpr, NoOp, const A)
398 // CHECK-NEXT: 4: [B10.3] (CXXConstructExpr, [B10.5], A)
399 // CHECK-NEXT: 5: A b = a;
401 // CHECK-NEXT: 7: [B10.6] (ImplicitCastExpr, NoOp, const class A)
402 // CHECK-NEXT: 8: [B10.7].operator int
403 // CHECK-NEXT: 9: [B10.7]
404 // CHECK-NEXT: 10: [B10.9] (ImplicitCastExpr, UserDefinedConversion, int)
405 // CHECK-NEXT: 11: [B10.10] (ImplicitCastExpr, IntegralToBoolean, _Bool)
406 // CHECK-NEXT: T: while [B10.11]
407 // CHECK-NEXT: Preds (2): B2 B11
408 // CHECK-NEXT: Succs (2): B9 B1
410 // CHECK-NEXT: 1: CFGScopeBegin(a)
411 // CHECK-NEXT: 2: (CXXConstructExpr, [B11.3], A)
412 // CHECK-NEXT: 3: A a;
413 // CHECK-NEXT: Preds (1): B12
414 // CHECK-NEXT: Succs (1): B10
415 // CHECK: [B0 (EXIT)]
416 // CHECK-NEXT: Preds (2): B1 B4
417 void test_while_jumps() {
429 // CHECK: [B12 (ENTRY)]
430 // CHECK-NEXT: Succs (1): B11
432 // CHECK-NEXT: 1: (CXXConstructExpr, [B1.2], A)
433 // CHECK-NEXT: 2: A d;
434 // CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
435 // CHECK-NEXT: 4: [B11.3].~A() (Implicit destructor)
436 // CHECK-NEXT: 5: CFGScopeEnd(a)
437 // CHECK-NEXT: Preds (2): B8 B2
438 // CHECK-NEXT: Succs (1): B0
441 // CHECK-NEXT: 2: [B2.1] (ImplicitCastExpr, LValueToRValue, _Bool)
442 // CHECK-NEXT: T: do ... while [B2.2]
443 // CHECK-NEXT: Preds (2): B3 B6
444 // CHECK-NEXT: Succs (2): B10 B1
446 // CHECK-NEXT: 1: (CXXConstructExpr, [B3.2], A)
447 // CHECK-NEXT: 2: A c;
448 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
449 // CHECK-NEXT: 4: [B9.3].~A() (Implicit destructor)
450 // CHECK-NEXT: 5: CFGScopeEnd(b)
451 // CHECK-NEXT: Preds (1): B5
452 // CHECK-NEXT: Succs (1): B2
454 // CHECK-NEXT: 1: return;
455 // CHECK-NEXT: 2: [B9.3].~A() (Implicit destructor)
456 // CHECK-NEXT: 3: CFGScopeEnd(b)
457 // CHECK-NEXT: 4: [B11.3].~A() (Implicit destructor)
458 // CHECK-NEXT: 5: CFGScopeEnd(a)
459 // CHECK-NEXT: Preds (1): B5
460 // CHECK-NEXT: Succs (1): B0
463 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
464 // CHECK-NEXT: T: if [B5.2]
465 // CHECK-NEXT: Preds (1): B7
466 // CHECK-NEXT: Succs (2): B4 B3
468 // CHECK-NEXT: 1: [B9.3].~A() (Implicit destructor)
469 // CHECK-NEXT: 2: CFGScopeEnd(b)
470 // CHECK-NEXT: T: continue;
471 // CHECK-NEXT: Preds (1): B7
472 // CHECK-NEXT: Succs (1): B2
475 // CHECK-NEXT: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
476 // CHECK-NEXT: T: if [B7.2]
477 // CHECK-NEXT: Preds (1): B9
478 // CHECK-NEXT: Succs (2): B6 B5
480 // CHECK-NEXT: 1: [B9.3].~A() (Implicit destructor)
481 // CHECK-NEXT: 2: CFGScopeEnd(b)
482 // CHECK-NEXT: T: break;
483 // CHECK-NEXT: Preds (1): B9
484 // CHECK-NEXT: Succs (1): B1
486 // CHECK-NEXT: 1: CFGScopeBegin(b)
487 // CHECK-NEXT: 2: (CXXConstructExpr, [B9.3], A)
488 // CHECK-NEXT: 3: A b;
490 // CHECK-NEXT: 5: [B9.4] (ImplicitCastExpr, LValueToRValue, _Bool)
491 // CHECK-NEXT: T: if [B9.5]
492 // CHECK-NEXT: Preds (2): B10 B11
493 // CHECK-NEXT: Succs (2): B8 B7
495 // CHECK-NEXT: Preds (1): B2
496 // CHECK-NEXT: Succs (1): B9
498 // CHECK-NEXT: 1: CFGScopeBegin(a)
499 // CHECK-NEXT: 2: (CXXConstructExpr, [B11.3], A)
500 // CHECK-NEXT: 3: A a;
501 // CHECK-NEXT: Preds (1): B12
502 // CHECK-NEXT: Succs (1): B9
503 // CHECK: [B0 (EXIT)]
504 // CHECK-NEXT: Preds (2): B1 B4
505 void test_do_jumps() {
517 // CHECK: [B6 (ENTRY)]
518 // CHECK-NEXT: Succs (1): B5
520 // CHECK-NEXT: 1: [B4.5].~A() (Implicit destructor)
521 // CHECK-NEXT: 2: CFGScopeEnd(b)
522 // CHECK-NEXT: 3: [B5.3].~A() (Implicit destructor)
523 // CHECK-NEXT: 4: CFGScopeEnd(a)
524 // CHECK-NEXT: Preds (1): B4
525 // CHECK-NEXT: Succs (1): B0
527 // CHECK-NEXT: Preds (1): B3
528 // CHECK-NEXT: Succs (1): B4
530 // CHECK-NEXT: 1: CFGScopeBegin(c)
531 // CHECK-NEXT: 2: (CXXConstructExpr, [B3.3], A)
532 // CHECK-NEXT: 3: A c;
533 // CHECK-NEXT: 4: [B3.3].~A() (Implicit destructor)
534 // CHECK-NEXT: 5: CFGScopeEnd(c)
535 // CHECK-NEXT: 6: [B4.5].~A() (Implicit destructor)
536 // CHECK-NEXT: 7: CFGScopeEnd(b)
537 // CHECK-NEXT: Preds (1): B4
538 // CHECK-NEXT: Succs (1): B2
540 // CHECK-NEXT: 1: CFGScopeBegin(b)
542 // CHECK-NEXT: 3: [B4.2] (ImplicitCastExpr, NoOp, const A)
543 // CHECK-NEXT: 4: [B4.3] (CXXConstructExpr, [B4.5], A)
544 // CHECK-NEXT: 5: A b = a;
546 // CHECK-NEXT: 7: [B4.6] (ImplicitCastExpr, NoOp, const class A)
547 // CHECK-NEXT: 8: [B4.7].operator int
548 // CHECK-NEXT: 9: [B4.7]
549 // CHECK-NEXT: 10: [B4.9] (ImplicitCastExpr, UserDefinedConversion, int)
550 // CHECK-NEXT: 11: [B4.10] (ImplicitCastExpr, IntegralToBoolean, _Bool)
551 // CHECK-NEXT: T: for (...; [B4.11]; )
552 // CHECK-NEXT: Preds (2): B2 B5
553 // CHECK-NEXT: Succs (2): B3 B1
555 // CHECK-NEXT: 1: CFGScopeBegin(a)
556 // CHECK-NEXT: 2: (CXXConstructExpr, [B5.3], A)
557 // CHECK-NEXT: 3: A a;
558 // CHECK-NEXT: Preds (1): B6
559 // CHECK-NEXT: Succs (1): B4
560 // CHECK: [B0 (EXIT)]
561 // CHECK-NEXT: Preds (1): B1
562 void test_for_implicit_scope() {
567 // CHECK: [B12 (ENTRY)]
568 // CHECK-NEXT: Succs (1): B11
570 // CHECK-NEXT: 1: [B10.5].~A() (Implicit destructor)
571 // CHECK-NEXT: 2: CFGScopeEnd(c)
572 // CHECK-NEXT: 3: [B11.6].~A() (Implicit destructor)
573 // CHECK-NEXT: 4: CFGScopeEnd(b)
574 // CHECK-NEXT: 5: (CXXConstructExpr, [B1.6], A)
575 // CHECK-NEXT: 6: A f;
576 // CHECK-NEXT: 7: [B1.6].~A() (Implicit destructor)
577 // CHECK-NEXT: 8: [B11.3].~A() (Implicit destructor)
578 // CHECK-NEXT: 9: CFGScopeEnd(a)
579 // CHECK-NEXT: Preds (2): B8 B10
580 // CHECK-NEXT: Succs (1): B0
582 // CHECK-NEXT: Preds (2): B3 B6
583 // CHECK-NEXT: Succs (1): B10
585 // CHECK-NEXT: 1: (CXXConstructExpr, [B3.2], A)
586 // CHECK-NEXT: 2: A e;
587 // CHECK-NEXT: 3: [B3.2].~A() (Implicit destructor)
588 // CHECK-NEXT: 4: [B9.3].~A() (Implicit destructor)
589 // CHECK-NEXT: 5: CFGScopeEnd(d)
590 // CHECK-NEXT: 6: [B10.5].~A() (Implicit destructor)
591 // CHECK-NEXT: 7: CFGScopeEnd(c)
592 // CHECK-NEXT: Preds (1): B5
593 // CHECK-NEXT: Succs (1): B2
595 // CHECK-NEXT: 1: return;
596 // CHECK-NEXT: 2: [B9.3].~A() (Implicit destructor)
597 // CHECK-NEXT: 3: CFGScopeEnd(d)
598 // CHECK-NEXT: 4: [B10.5].~A() (Implicit destructor)
599 // CHECK-NEXT: 5: CFGScopeEnd(c)
600 // CHECK-NEXT: 6: [B11.6].~A() (Implicit destructor)
601 // CHECK-NEXT: 7: CFGScopeEnd(b)
602 // CHECK-NEXT: 8: [B11.3].~A() (Implicit destructor)
603 // CHECK-NEXT: 9: CFGScopeEnd(a)
604 // CHECK-NEXT: Preds (1): B5
605 // CHECK-NEXT: Succs (1): B0
608 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
609 // CHECK-NEXT: T: if [B5.2]
610 // CHECK-NEXT: Preds (1): B7
611 // CHECK-NEXT: Succs (2): B4 B3
613 // CHECK-NEXT: 1: [B9.3].~A() (Implicit destructor)
614 // CHECK-NEXT: 2: CFGScopeEnd(d)
615 // CHECK-NEXT: T: continue;
616 // CHECK-NEXT: Preds (1): B7
617 // CHECK-NEXT: Succs (1): B2
620 // CHECK-NEXT: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
621 // CHECK-NEXT: T: if [B7.2]
622 // CHECK-NEXT: Preds (1): B9
623 // CHECK-NEXT: Succs (2): B6 B5
625 // CHECK-NEXT: 1: [B9.3].~A() (Implicit destructor)
626 // CHECK-NEXT: 2: CFGScopeEnd(d)
627 // CHECK-NEXT: T: break;
628 // CHECK-NEXT: Preds (1): B9
629 // CHECK-NEXT: Succs (1): B1
631 // CHECK-NEXT: 1: CFGScopeBegin(d)
632 // CHECK-NEXT: 2: (CXXConstructExpr, [B9.3], A)
633 // CHECK-NEXT: 3: A d;
635 // CHECK-NEXT: 5: [B9.4] (ImplicitCastExpr, LValueToRValue, _Bool)
636 // CHECK-NEXT: T: if [B9.5]
637 // CHECK-NEXT: Preds (1): B10
638 // CHECK-NEXT: Succs (2): B8 B7
640 // CHECK-NEXT: 1: CFGScopeBegin(c)
642 // CHECK-NEXT: 3: [B10.2] (ImplicitCastExpr, NoOp, const A)
643 // CHECK-NEXT: 4: [B10.3] (CXXConstructExpr, [B10.5], A)
644 // CHECK-NEXT: 5: A c = b;
646 // CHECK-NEXT: 7: [B10.6] (ImplicitCastExpr, NoOp, const class A)
647 // CHECK-NEXT: 8: [B10.7].operator int
648 // CHECK-NEXT: 9: [B10.7]
649 // CHECK-NEXT: 10: [B10.9] (ImplicitCastExpr, UserDefinedConversion, int)
650 // CHECK-NEXT: 11: [B10.10] (ImplicitCastExpr, IntegralToBoolean, _Bool)
651 // CHECK-NEXT: T: for (...; [B10.11]; )
652 // CHECK-NEXT: Preds (2): B2 B11
653 // CHECK-NEXT: Succs (2): B9 B1
655 // CHECK-NEXT: 1: CFGScopeBegin(a)
656 // CHECK-NEXT: 2: (CXXConstructExpr, [B11.3], A)
657 // CHECK-NEXT: 3: A a;
658 // CHECK-NEXT: 4: CFGScopeBegin(b)
659 // CHECK-NEXT: 5: (CXXConstructExpr, [B11.6], A)
660 // CHECK-NEXT: 6: A b;
661 // CHECK-NEXT: Preds (1): B12
662 // CHECK-NEXT: Succs (1): B10
663 // CHECK: [B0 (EXIT)]
664 // CHECK-NEXT: Preds (2): B1 B4
665 void test_for_jumps() {
667 for (A b
; A c
= b
; ) {
677 // CHECK: [B8 (ENTRY)]
678 // CHECK-NEXT: Succs (1): B7
681 // CHECK-NEXT: 1: (CXXConstructExpr, [B1.2], A)
682 // CHECK-NEXT: 2: A c;
683 // CHECK-NEXT: 3: [B1.2].~A() (Implicit destructor)
684 // CHECK-NEXT: 4: [B6.5].~A() (Implicit destructor)
685 // CHECK-NEXT: 5: [B6.3].~A() (Implicit destructor)
686 // CHECK-NEXT: 6: [B7.3].~A() (Implicit destructor)
687 // CHECK-NEXT: 7: CFGScopeEnd(a)
688 // CHECK-NEXT: Preds (2): B2 B3
689 // CHECK-NEXT: Succs (1): B0
691 // CHECK-NEXT: 1: (CXXConstructExpr, [B2.2], A)
692 // CHECK-NEXT: 2: A b;
693 // CHECK-NEXT: 3: [B2.2].~A() (Implicit destructor)
694 // CHECK-NEXT: 4: [B6.8].~A() (Implicit destructor)
695 // CHECK-NEXT: 5: CFGScopeEnd(a)
696 // CHECK-NEXT: Preds (1): B4
697 // CHECK-NEXT: Succs (1): B1
699 // CHECK-NEXT: 1: [B6.8].~A() (Implicit destructor)
700 // CHECK-NEXT: 2: CFGScopeEnd(a)
701 // CHECK-NEXT: T: goto l1;
702 // CHECK-NEXT: Preds (1): B4
703 // CHECK-NEXT: Succs (1): B1
706 // CHECK-NEXT: 2: [B4.1] (ImplicitCastExpr, LValueToRValue, _Bool)
707 // CHECK-NEXT: T: if [B4.2]
708 // CHECK-NEXT: Preds (1): B6
709 // CHECK-NEXT: Succs (2): B3 B2
711 // CHECK-NEXT: 1: [B6.8].~A() (Implicit destructor)
712 // CHECK-NEXT: 2: [B6.5].~A() (Implicit destructor)
713 // CHECK-NEXT: 3: [B6.3].~A() (Implicit destructor)
714 // CHECK-NEXT: 4: CFGScopeEnd(cb)
715 // CHECK-NEXT: T: goto l0;
716 // CHECK-NEXT: Preds (1): B6
717 // CHECK-NEXT: Succs (1): B6
720 // CHECK-NEXT: 1: CFGScopeBegin(cb)
721 // CHECK-NEXT: 2: (CXXConstructExpr, [B6.3], A)
722 // CHECK-NEXT: 3: A cb;
723 // CHECK-NEXT: 4: (CXXConstructExpr, [B6.5], A)
724 // CHECK-NEXT: 5: A b;
725 // CHECK-NEXT: 6: CFGScopeBegin(a)
726 // CHECK-NEXT: 7: (CXXConstructExpr, [B6.8], A)
727 // CHECK-NEXT: 8: A a;
729 // CHECK-NEXT: 10: [B6.9] (ImplicitCastExpr, LValueToRValue, _Bool)
730 // CHECK-NEXT: T: if [B6.10]
731 // CHECK-NEXT: Preds (2): B7 B5
732 // CHECK-NEXT: Succs (2): B5 B4
734 // CHECK-NEXT: 1: CFGScopeBegin(a)
735 // CHECK-NEXT: 2: (CXXConstructExpr, [B7.3], A)
736 // CHECK-NEXT: 3: A a;
737 // CHECK-NEXT: Preds (1): B8
738 // CHECK-NEXT: Succs (1): B6
739 // CHECK: [B0 (EXIT)]
740 // CHECK-NEXT: Preds (1): B1
755 // CHECK: [B7 (ENTRY)]
756 // CHECK-NEXT: Succs (1): B6
758 // CHECK-NEXT: 1: CFGScopeEnd(i)
759 // CHECK-NEXT: 2: CFGScopeBegin(unused2)
760 // CHECK-NEXT: 3: int unused2;
761 // CHECK-NEXT: 4: CFGScopeEnd(unused2)
762 // CHECK-NEXT: Preds (2): B4 B5
763 // CHECK-NEXT: Succs (1): B0
766 // CHECK-NEXT: 2: ++[B2.1]
767 // CHECK-NEXT: Preds (1): B3
768 // CHECK-NEXT: Succs (1): B5
770 // CHECK-NEXT: 1: CFGScopeEnd(unused1)
771 // CHECK-NEXT: Succs (1): B2
773 // CHECK-NEXT: 1: CFGScopeBegin(unused1)
774 // CHECK-NEXT: 2: int unused1;
775 // CHECK-NEXT: 3: CFGScopeEnd(unused1)
776 // CHECK-NEXT: T: break;
777 // CHECK-NEXT: Preds (1): B5
778 // CHECK-NEXT: Succs (1): B1
781 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, int)
783 // CHECK-NEXT: 4: [B5.2] < [B5.3]
784 // CHECK-NEXT: T: for (...; [B5.4]; ...)
785 // CHECK-NEXT: Preds (2): B2 B6
786 // CHECK-NEXT: Succs (2): B4 B1
788 // CHECK-NEXT: 1: CFGScopeBegin(i)
790 // CHECK-NEXT: 3: int i = 0;
791 // CHECK-NEXT: Preds (1): B7
792 // CHECK-NEXT: Succs (1): B5
793 // CHECK: [B0 (EXIT)]
794 // CHECK-NEXT: Preds (1): B1
795 void test_for_compound_and_break() {
796 for (int i
= 0; i
< 3; ++i
) {
807 // CHECK: [B6 (ENTRY)]
808 // CHECK-NEXT: Succs (1): B5
810 // CHECK-NEXT: 1: CFGScopeEnd(__end1)
811 // CHECK-NEXT: 2: CFGScopeEnd(__begin1)
812 // CHECK-NEXT: 3: CFGScopeEnd(__range1)
813 // CHECK-NEXT: 4: [B5.3].~A[10]() (Implicit destructor)
814 // CHECK-NEXT: 5: CFGScopeEnd(a)
815 // CHECK-NEXT: Preds (1): B2
816 // CHECK-NEXT: Succs (1): B0
818 // CHECK-NEXT: 1: __begin1
819 // CHECK-NEXT: 2: [B2.1] (ImplicitCastExpr, LValueToRValue, A *)
820 // CHECK-NEXT: 3: __end1
821 // CHECK-NEXT: 4: [B2.3] (ImplicitCastExpr, LValueToRValue, A *)
822 // CHECK-NEXT: 5: [B2.2] != [B2.4]
823 // CHECK-NEXT: T: for (auto &i : [B5.4])
825 // CHECK: Preds (2): B3 B5
826 // CHECK-NEXT: Succs (2): B4 B1
828 // CHECK-NEXT: 1: __begin1
829 // CHECK-NEXT: 2: ++[B3.1]
830 // CHECK-NEXT: Preds (1): B4
831 // CHECK-NEXT: Succs (1): B2
833 // CHECK-NEXT: 1: CFGScopeBegin(i)
834 // CHECK-NEXT: 2: __begin1
835 // CHECK-NEXT: 3: [B4.2] (ImplicitCastExpr, LValueToRValue, A *)
836 // CHECK-NEXT: 4: *[B4.3]
837 // CHECK-NEXT: 5: auto &i
838 // CHECK-NEXT: 6: operator=
839 // CHECK-NEXT: 7: [B4.6] (ImplicitCastExpr, FunctionToPointerDecay, A &(*)(const A &)
842 // CHECK-NEXT: 10: [B4.9] (ImplicitCastExpr, NoOp, const A)
843 // CHECK-NEXT: 11: [B4.8] = [B4.10] (OperatorCall)
844 // CHECK-NEXT: 12: CFGScopeEnd(i)
845 // CHECK-NEXT: Preds (1): B2
846 // CHECK-NEXT: Succs (1): B3
848 // CHECK-NEXT: 1: CFGScopeBegin(a)
849 // CHECK-NEXT: 2: (CXXConstructExpr, [B5.3], A[10])
850 // CHECK-NEXT: 3: A a[10];
852 // CHECK-NEXT: 5: auto &&__range1 = a;
853 // CHECK-NEXT: 6: CFGScopeBegin(__end1)
854 // CHECK-NEXT: 7: __range1
855 // CHECK-NEXT: 8: [B5.7] (ImplicitCastExpr, ArrayToPointerDecay, A *)
857 // CHECK-NEXT: 10: [B5.8] + [B5.9]
858 // CHECK-NEXT: 11: auto __end1 = __range1 + 10
859 // CHECK-NEXT: 12: __range1
860 // CHECK-NEXT: 13: [B5.12] (ImplicitCastExpr, ArrayToPointerDecay, A *)
861 // CHECK-NEXT: 14: auto __begin1 = __range1;
862 // CHECK-NEXT: Preds (1): B6
863 // CHECK-NEXT: Succs (1): B2
864 // CHECK: [B0 (EXIT)]
865 // CHECK-NEXT: Preds (1): B1
866 void test_range_for(A
&b
) {
872 // CHECK: [B8 (ENTRY)]
873 // CHECK-NEXT: Succs (1): B2
875 // CHECK-NEXT: 1: CFGScopeEnd(i)
877 // CHECK-NEXT: 3: int k = 1;
878 // CHECK-NEXT: 4: CFGScopeEnd(c)
879 // CHECK-NEXT: Preds (3): B3 B5 B6
880 // CHECK-NEXT: Succs (1): B0
882 // CHECK-NEXT: 1: CFGScopeBegin(c)
883 // CHECK-NEXT: 2: '1'
884 // CHECK-NEXT: 3: char c = '1';
885 // CHECK-NEXT: 4: CFGScopeBegin(i)
886 // CHECK-NEXT: 5: getX
887 // CHECK-NEXT: 6: [B2.5] (ImplicitCastExpr, FunctionToPointerDecay, int (*)(void))
888 // CHECK-NEXT: 7: [B2.6]()
889 // CHECK-NEXT: 8: int i = getX();
891 // CHECK-NEXT: 10: [B2.9] (ImplicitCastExpr, LValueToRValue, int)
892 // CHECK-NEXT: T: switch [B2.10]
893 // CHECK-NEXT: Preds (1): B8
894 // CHECK-NEXT: Succs (5): B4 B5 B6 B7 B3
896 // CHECK-NEXT: default:
897 // CHECK-NEXT: 1: CFGScopeBegin(a)
899 // CHECK-NEXT: 3: int a = 0;
901 // CHECK-NEXT: 5: ++[B3.4]
902 // CHECK-NEXT: 6: CFGScopeEnd(a)
903 // CHECK-NEXT: Preds (2): B4 B2
904 // CHECK-NEXT: Succs (1): B1
906 // CHECK-NEXT: case 3:
907 // CHECK-NEXT: 1: '2'
909 // CHECK-NEXT: 3: [B4.2] = [B4.1]
910 // CHECK-NEXT: Preds (1): B2
911 // CHECK-NEXT: Succs (1): B3
913 // CHECK-NEXT: case 2:
914 // CHECK-NEXT: 1: '2'
916 // CHECK-NEXT: 3: [B5.2] = [B5.1]
917 // CHECK-NEXT: T: break;
918 // CHECK-NEXT: Preds (1): B2
919 // CHECK-NEXT: Succs (1): B1
921 // CHECK-NEXT: case 1:
922 // CHECK-NEXT: 1: '3'
924 // CHECK-NEXT: 3: [B6.2] = [B6.1]
925 // CHECK-NEXT: T: break;
926 // CHECK-NEXT: Preds (2): B2 B7
927 // CHECK-NEXT: Succs (1): B1
929 // CHECK-NEXT: case 0:
930 // CHECK-NEXT: 1: '2'
932 // CHECK-NEXT: 3: [B7.2] = [B7.1]
933 // CHECK-NEXT: Preds (1): B2
934 // CHECK-NEXT: Succs (1): B6
935 // CHECK: [B0 (EXIT)]
936 // CHECK-NEXT: Preds (1): B1
937 void test_switch_with_compound_with_default() {
939 switch (int i
= getX()) {
959 // CHECK: [B6 (ENTRY)]
960 // CHECK-NEXT: Succs (1): B2
962 // CHECK-NEXT: 1: CFGScopeEnd(i)
964 // CHECK-NEXT: 3: int k = 3;
965 // CHECK-NEXT: 4: CFGScopeEnd(c)
966 // CHECK-NEXT: Preds (3): B3 B4 B2
967 // CHECK-NEXT: Succs (1): B0
969 // CHECK-NEXT: 1: CFGScopeBegin(c)
970 // CHECK-NEXT: 2: '1'
971 // CHECK-NEXT: 3: char c = '1';
972 // CHECK-NEXT: 4: CFGScopeBegin(i)
973 // CHECK-NEXT: 5: getX
974 // CHECK-NEXT: 6: [B2.5] (ImplicitCastExpr, FunctionToPointerDecay, int (*)(void))
975 // CHECK-NEXT: 7: [B2.6]()
976 // CHECK-NEXT: 8: int i = getX();
978 // CHECK-NEXT: 10: [B2.9] (ImplicitCastExpr, LValueToRValue, int)
979 // CHECK-NEXT: T: switch [B2.10]
980 // CHECK-NEXT: Preds (1): B6
981 // CHECK-NEXT: Succs (4): B3 B4 B5 B1
983 // CHECK-NEXT: case 2:
984 // CHECK-NEXT: 1: '3'
986 // CHECK-NEXT: 3: [B3.2] = [B3.1]
987 // CHECK-NEXT: T: break;
988 // CHECK-NEXT: Preds (1): B2
989 // CHECK-NEXT: Succs (1): B1
991 // CHECK-NEXT: case 1:
992 // CHECK-NEXT: 1: '1'
994 // CHECK-NEXT: 3: [B4.2] = [B4.1]
995 // CHECK-NEXT: T: break;
996 // CHECK-NEXT: Preds (2): B2 B5
997 // CHECK-NEXT: Succs (1): B1
999 // CHECK-NEXT: case 0:
1000 // CHECK-NEXT: 1: '2'
1002 // CHECK-NEXT: 3: [B5.2] = [B5.1]
1003 // CHECK-NEXT: Preds (1): B2
1004 // CHECK-NEXT: Succs (1): B4
1005 // CHECK: [B0 (EXIT)]
1006 // CHECK-NEXT: Preds (1): B1
1007 int test_switch_with_compound_without_default() {
1009 switch (int i
= getX()) {
1022 // CHECK: [B5 (ENTRY)]
1023 // CHECK-NEXT: Succs (1): B2
1025 // CHECK-NEXT: 1: CFGScopeEnd(i)
1027 // CHECK-NEXT: 3: int k = 1;
1028 // CHECK-NEXT: 4: CFGScopeEnd(s)
1029 // CHECK-NEXT: Preds (1): B3
1030 // CHECK-NEXT: Succs (1): B0
1032 // CHECK-NEXT: 1: CFGScopeBegin(s)
1033 // CHECK-NEXT: 2: '1'
1034 // CHECK-NEXT: 3: char s = '1';
1035 // CHECK-NEXT: 4: CFGScopeBegin(i)
1036 // CHECK-NEXT: 5: getX
1037 // CHECK-NEXT: 6: [B2.5] (ImplicitCastExpr, FunctionToPointerDecay, int (*)(void))
1038 // CHECK-NEXT: 7: [B2.6]()
1039 // CHECK-NEXT: 8: int i = getX();
1041 // CHECK-NEXT: 10: [B2.9] (ImplicitCastExpr, LValueToRValue, int)
1042 // CHECK-NEXT: T: switch [B2.10]
1043 // CHECK-NEXT: Preds (1): B5
1044 // CHECK-NEXT: Succs (2): B4 B3
1046 // CHECK-NEXT: default:
1047 // CHECK-NEXT: 1: CFGScopeBegin(a)
1049 // CHECK-NEXT: 3: int a = 0;
1051 // CHECK-NEXT: 5: ++[B3.4]
1052 // CHECK-NEXT: 6: CFGScopeEnd(a)
1053 // CHECK-NEXT: Preds (2): B4 B2
1054 // CHECK-NEXT: Succs (1): B1
1056 // CHECK-NEXT: case 0:
1057 // CHECK-NEXT: Preds (1): B2
1058 // CHECK-NEXT: Succs (1): B3
1059 // CHECK: [B0 (EXIT)]
1060 // CHECK-NEXT: Preds (1): B1
1061 void test_without_compound() {
1063 switch (int i
= getX())
1072 // CHECK: [B12 (ENTRY)]
1073 // CHECK-NEXT: Succs (1): B11
1075 // CHECK-NEXT: 1: CFGScopeEnd(i)
1076 // CHECK-NEXT: Preds (2): B4 B10
1077 // CHECK-NEXT: Succs (1): B0
1080 // CHECK-NEXT: 2: ++[B2.1]
1081 // CHECK-NEXT: Preds (2): B3 B7
1082 // CHECK-NEXT: Succs (1): B10
1084 // CHECK-NEXT: 1: CFGScopeEnd(z)
1085 // CHECK-NEXT: Succs (1): B2
1087 // CHECK-NEXT: 1: CFGScopeBegin(z)
1089 // CHECK-NEXT: 3: int z = 5;
1090 // CHECK-NEXT: 4: CFGScopeEnd(z)
1091 // CHECK-NEXT: T: break;
1092 // CHECK-NEXT: Preds (2): B6 B8
1093 // CHECK-NEXT: Succs (1): B1
1096 // CHECK-NEXT: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, int)
1097 // CHECK-NEXT: T: switch [B5.2]
1098 // CHECK-NEXT: Preds (1): B10
1099 // CHECK-NEXT: Succs (4): B7 B8 B9 B6
1101 // CHECK-NEXT: default:
1104 // CHECK-NEXT: 3: [B6.2] = [B6.1]
1105 // CHECK-NEXT: Preds (1): B5
1106 // CHECK-NEXT: Succs (1): B4
1108 // CHECK-NEXT: case 2:
1111 // CHECK-NEXT: 3: [B7.2] = [B7.1]
1112 // CHECK-NEXT: T: continue;
1113 // CHECK-NEXT: Preds (1): B5
1114 // CHECK-NEXT: Succs (1): B2
1116 // CHECK-NEXT: case 1:
1119 // CHECK-NEXT: 3: [B8.2] = [B8.1]
1120 // CHECK-NEXT: T: break;
1121 // CHECK-NEXT: Preds (2): B5 B9
1122 // CHECK-NEXT: Succs (1): B4
1124 // CHECK-NEXT: case 0:
1127 // CHECK-NEXT: 3: [B9.2] = [B9.1]
1128 // CHECK-NEXT: Preds (1): B5
1129 // CHECK-NEXT: Succs (1): B8
1132 // CHECK-NEXT: 2: [B10.1] (ImplicitCastExpr, LValueToRValue, int)
1133 // CHECK-NEXT: 3: 1000
1134 // CHECK-NEXT: 4: [B10.2] < [B10.3]
1135 // CHECK-NEXT: T: for (...; [B10.4]; ...)
1136 // CHECK-NEXT: Preds (2): B2 B11
1137 // CHECK-NEXT: Succs (2): B5 B1
1139 // CHECK-NEXT: 1: CFGScopeBegin(i)
1140 // CHECK-NEXT: 2: int i;
1141 // CHECK-NEXT: 3: int x;
1142 // CHECK-NEXT: 4: int y;
1145 // CHECK-NEXT: 7: [B11.6] = [B11.5]
1146 // CHECK-NEXT: Preds (1): B12
1147 // CHECK-NEXT: Succs (1): B10
1148 // CHECK: [B0 (EXIT)]
1149 // CHECK-NEXT: Preds (1): B1
1150 void test_for_switch_in_for() {
1152 for (i
= 0; i
< 1000; ++i
) {
1158 break; // break from switch
1161 continue; // continue in loop
1167 break; // break from loop