blob: 566e6caed60d49592832095a83952d112031c4c2 [file] [log] [blame]
Ted Kremenek337e4db2012-03-10 01:34:17 +00001// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-checker=debug.DumpCFG -cfg-add-implicit-dtors %s > %t 2>&1
2// RUN: FileCheck --input-file=%t %s
Marcin Swiderskifcb72ac2010-10-01 00:23:17 +00003// XPASS: *
4
5class A {
6public:
7 A() {}
8 ~A() {}
9 operator int() const { return 1; }
10};
11
12extern const bool UV;
13
14void test_const_ref() {
15 A a;
16 const A& b = a;
17 const A& c = A();
18}
19
Marcin Swiderskib1c52872010-10-25 07:00:40 +000020void test_array() {
21 A a[2];
22 A b[0];
23}
24
Marcin Swiderskifcb72ac2010-10-01 00:23:17 +000025void test_scope() {
26 A a;
27 { A c;
28 A d;
29 }
30 A b;
31}
32
33void test_return() {
34 A a;
35 A b;
36 if (UV) return;
37 A c;
38}
39
40void test_goto() {
41 A a;
42l0:
43 A b;
44 { A a;
45 if (UV) goto l0;
46 if (UV) goto l1;
47 A b;
48 }
49l1:
50 A c;
51}
52
Marcin Swiderski04e046c2010-10-01 00:52:17 +000053void test_if_implicit_scope() {
54 A a;
55 if (A b = a)
56 A c;
57 else A c;
58}
59
60void test_if_jumps() {
61 A a;
62 if (A b = a) {
63 A c;
64 if (UV) return;
65 A d;
66 } else {
67 A c;
68 if (UV) return;
69 A d;
70 }
71 A e;
72}
73
Marcin Swiderski05adedc2010-10-01 01:14:17 +000074void test_while_implicit_scope() {
75 A a;
76 while (A b = a)
77 A c;
78}
79
80void test_while_jumps() {
81 A a;
82 while (A b = a) {
83 A c;
84 if (UV) break;
85 if (UV) continue;
86 if (UV) return;
87 A d;
88 }
89 A e;
90}
91
92void test_do_implicit_scope() {
93 do A a;
94 while (UV);
95}
96
97void test_do_jumps() {
98 A a;
99 do {
100 A b;
101 if (UV) break;
102 if (UV) continue;
103 if (UV) return;
104 A c;
105 } while (UV);
106 A d;
107}
108
Marcin Swiderski8ae60582010-10-01 01:24:41 +0000109void test_switch_implicit_scope() {
110 A a;
111 switch (A b = a)
112 A c;
113}
114
115void test_switch_jumps() {
116 A a;
117 switch (A b = a) {
118 case 0: {
119 A c;
120 if (UV) break;
121 if (UV) return;
122 A f;
123 }
124 case 1:
125 break;
126 }
127 A g;
128}
129
Marcin Swiderski47575f12010-10-01 01:38:14 +0000130void test_for_implicit_scope() {
131 for (A a; A b = a; )
132 A c;
133}
134
135void test_for_jumps() {
136 A a;
137 for (A b; A c = b; ) {
138 A d;
139 if (UV) break;
140 if (UV) continue;
141 if (UV) return;
142 A e;
143 }
144 A f;
145}
146
Marcin Swiderski0e97bcb2010-10-01 01:46:52 +0000147void test_catch_const_ref() {
148 try {
149 } catch (const A& e) {
150 }
151}
152
153void test_catch_copy() {
154 try {
155 } catch (A e) {
156 }
157}
158
Anna Zaksaa560982012-03-13 19:32:00 +0000159// CHECK: [B1 (ENTRY)]
160// CHECK: Succs (1): B0
161// CHECK: [B0 (EXIT)]
162// CHECK: Preds (1): B1
163// CHECK: [B1 (ENTRY)]
164// CHECK: Succs (1): B0
165// CHECK: [B0 (EXIT)]
166// CHECK: Preds (1): B1
167// CHECK: [B2 (ENTRY)]
168// CHECK: Succs (1): B1
169// CHECK: [B1]
170// CHECK: 1: 1
171// CHECK: 2: return [B1.1];
172// CHECK: Preds (1): B2
173// CHECK: Succs (1): B0
174// CHECK: [B0 (EXIT)]
175// CHECK: Preds (1): B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000176// CHECK: [B2 (ENTRY)]
177// CHECK: Succs (1): B1
178// CHECK: [B1]
179// CHECK: 1: (CXXConstructExpr, class A)
180// CHECK: 2: A a;
181// CHECK: 3: a
182// CHECK: 4: [B1.3] (ImplicitCastExpr, NoOp, const class A)
183// CHECK: 5: const A &b = a;
184// CHECK: 6: A() (CXXConstructExpr, class A)
185// CHECK: 7: [B1.6] (BindTemporary)
186// CHECK: 8: [B1.7] (ImplicitCastExpr, NoOp, const class A)
187// CHECK: 9: [B1.8]
188// CHECK: 10: const A &c = A();
189// CHECK: 11: [B1.10].~A() (Implicit destructor)
190// CHECK: 12: [B1.2].~A() (Implicit destructor)
191// CHECK: Preds (1): B2
192// CHECK: Succs (1): B0
193// CHECK: [B0 (EXIT)]
194// CHECK: Preds (1): B1
195// CHECK: [B2 (ENTRY)]
196// CHECK: Succs (1): B1
197// CHECK: [B1]
198// CHECK: 1: (CXXConstructExpr, class A [2])
199// CHECK: 2: A a[2];
200// CHECK: 3: (CXXConstructExpr, class A [0])
201// CHECK: 4: A b[0];
202// CHECK: 5: [B1.2].~A() (Implicit destructor)
203// CHECK: Preds (1): B2
204// CHECK: Succs (1): B0
205// CHECK: [B0 (EXIT)]
206// CHECK: Preds (1): B1
207// CHECK: [B2 (ENTRY)]
208// CHECK: Succs (1): B1
209// CHECK: [B1]
210// CHECK: 1: (CXXConstructExpr, class A)
211// CHECK: 2: A a;
212// CHECK: 3: (CXXConstructExpr, class A)
213// CHECK: 4: A c;
214// CHECK: 5: (CXXConstructExpr, class A)
215// CHECK: 6: A d;
216// CHECK: 7: [B1.6].~A() (Implicit destructor)
217// CHECK: 8: [B1.4].~A() (Implicit destructor)
218// CHECK: 9: (CXXConstructExpr, class A)
219// CHECK: 10: A b;
220// CHECK: 11: [B1.10].~A() (Implicit destructor)
221// CHECK: 12: [B1.2].~A() (Implicit destructor)
222// CHECK: Preds (1): B2
223// CHECK: Succs (1): B0
224// CHECK: [B0 (EXIT)]
225// CHECK: Preds (1): B1
226// CHECK: [B4 (ENTRY)]
227// CHECK: Succs (1): B3
228// CHECK: [B1]
229// CHECK: 1: (CXXConstructExpr, class A)
230// CHECK: 2: A c;
231// CHECK: 3: [B1.2].~A() (Implicit destructor)
232// CHECK: 4: [B3.4].~A() (Implicit destructor)
233// CHECK: 5: [B3.2].~A() (Implicit destructor)
234// CHECK: Preds (1): B3
235// CHECK: Succs (1): B0
236// CHECK: [B2]
237// CHECK: 1: return;
238// CHECK: 2: [B3.4].~A() (Implicit destructor)
239// CHECK: 3: [B3.2].~A() (Implicit destructor)
240// CHECK: Preds (1): B3
241// CHECK: Succs (1): B0
242// CHECK: [B3]
243// CHECK: 1: (CXXConstructExpr, class A)
244// CHECK: 2: A a;
245// CHECK: 3: (CXXConstructExpr, class A)
246// CHECK: 4: A b;
247// CHECK: 5: UV
248// CHECK: 6: [B3.5] (ImplicitCastExpr, LValueToRValue, _Bool)
249// CHECK: T: if [B3.6]
250// CHECK: Preds (1): B4
251// CHECK: Succs (2): B2 B1
252// CHECK: [B0 (EXIT)]
253// CHECK: Preds (2): B1 B2
254// CHECK: [B8 (ENTRY)]
255// CHECK: Succs (1): B7
256// CHECK: [B1]
257// CHECK: l1:
258// CHECK: 1: (CXXConstructExpr, class A)
259// CHECK: 2: A c;
260// CHECK: 3: [B1.2].~A() (Implicit destructor)
261// CHECK: 4: [B6.2].~A() (Implicit destructor)
262// CHECK: 5: [B7.2].~A() (Implicit destructor)
263// CHECK: Preds (2): B2 B3
264// CHECK: Succs (1): B0
265// CHECK: [B2]
266// CHECK: 1: (CXXConstructExpr, class A)
267// CHECK: 2: A b;
268// CHECK: 3: [B2.2].~A() (Implicit destructor)
269// CHECK: 4: [B6.4].~A() (Implicit destructor)
270// CHECK: Preds (1): B4
271// CHECK: Succs (1): B1
272// CHECK: [B3]
273// CHECK: 1: [B6.4].~A() (Implicit destructor)
274// CHECK: T: goto l1;
275// CHECK: Preds (1): B4
276// CHECK: Succs (1): B1
277// CHECK: [B4]
278// CHECK: 1: UV
279// CHECK: 2: [B4.1] (ImplicitCastExpr, LValueToRValue, _Bool)
280// CHECK: T: if [B4.2]
281// CHECK: Preds (1): B6
282// CHECK: Succs (2): B3 B2
283// CHECK: [B5]
284// CHECK: 1: [B6.4].~A() (Implicit destructor)
285// CHECK: 2: [B6.2].~A() (Implicit destructor)
286// CHECK: T: goto l0;
287// CHECK: Preds (1): B6
288// CHECK: Succs (1): B6
289// CHECK: [B6]
290// CHECK: l0:
291// CHECK: 1: (CXXConstructExpr, class A)
292// CHECK: 2: A b;
293// CHECK: 3: (CXXConstructExpr, class A)
294// CHECK: 4: A a;
295// CHECK: 5: UV
296// CHECK: 6: [B6.5] (ImplicitCastExpr, LValueToRValue, _Bool)
297// CHECK: T: if [B6.6]
298// CHECK: Preds (2): B7 B5
299// CHECK: Succs (2): B5 B4
300// CHECK: [B7]
301// CHECK: 1: (CXXConstructExpr, class A)
302// CHECK: 2: A a;
303// CHECK: Preds (1): B8
304// CHECK: Succs (1): B6
305// CHECK: [B0 (EXIT)]
306// CHECK: Preds (1): B1
307// CHECK: [B5 (ENTRY)]
308// CHECK: Succs (1): B4
309// CHECK: [B1]
310// CHECK: 1: [B4.6].~A() (Implicit destructor)
311// CHECK: 2: [B4.2].~A() (Implicit destructor)
312// CHECK: Preds (2): B2 B3
313// CHECK: Succs (1): B0
314// CHECK: [B2]
315// CHECK: 1: (CXXConstructExpr, class A)
316// CHECK: 2: A c;
317// CHECK: 3: [B2.2].~A() (Implicit destructor)
318// CHECK: Preds (1): B4
319// CHECK: Succs (1): B1
320// CHECK: [B3]
321// CHECK: 1: (CXXConstructExpr, class A)
322// CHECK: 2: A c;
323// CHECK: 3: [B3.2].~A() (Implicit destructor)
324// CHECK: Preds (1): B4
325// CHECK: Succs (1): B1
326// CHECK: [B4]
327// CHECK: 1: (CXXConstructExpr, class A)
328// CHECK: 2: A a;
329// CHECK: 3: a
330// CHECK: 4: [B4.3] (ImplicitCastExpr, NoOp, const class A)
331// CHECK: 5: [B4.4] (CXXConstructExpr, class A)
332// CHECK: 6: A b = a;
333// CHECK: 7: b
334// CHECK: 8: [B4.7] (ImplicitCastExpr, NoOp, const class A)
335// CHECK: 9: [B4.8].operator int
336// CHECK: 10: [B4.9]()
337// CHECK: 11: [B4.10] (ImplicitCastExpr, UserDefinedConversion, int)
338// CHECK: 12: [B4.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
339// CHECK: T: if [B4.12]
340// CHECK: Preds (1): B5
341// CHECK: Succs (2): B3 B2
342// CHECK: [B0 (EXIT)]
343// CHECK: Preds (1): B1
344// CHECK: [B9 (ENTRY)]
345// CHECK: Succs (1): B8
346// CHECK: [B1]
347// CHECK: 1: [B8.6].~A() (Implicit destructor)
348// CHECK: 2: (CXXConstructExpr, class A)
349// CHECK: 3: A e;
350// CHECK: 4: [B1.3].~A() (Implicit destructor)
351// CHECK: 5: [B8.2].~A() (Implicit destructor)
352// CHECK: Preds (2): B2 B5
353// CHECK: Succs (1): B0
354// CHECK: [B2]
355// CHECK: 1: (CXXConstructExpr, class A)
356// CHECK: 2: A d;
357// CHECK: 3: [B2.2].~A() (Implicit destructor)
358// CHECK: 4: [B4.2].~A() (Implicit destructor)
359// CHECK: Preds (1): B4
360// CHECK: Succs (1): B1
361// CHECK: [B3]
362// CHECK: 1: return;
363// CHECK: 2: [B4.2].~A() (Implicit destructor)
364// CHECK: 3: [B8.6].~A() (Implicit destructor)
365// CHECK: 4: [B8.2].~A() (Implicit destructor)
366// CHECK: Preds (1): B4
367// CHECK: Succs (1): B0
368// CHECK: [B4]
369// CHECK: 1: (CXXConstructExpr, class A)
370// CHECK: 2: A c;
371// CHECK: 3: UV
372// CHECK: 4: [B4.3] (ImplicitCastExpr, LValueToRValue, _Bool)
373// CHECK: T: if [B4.4]
374// CHECK: Preds (1): B8
375// CHECK: Succs (2): B3 B2
376// CHECK: [B5]
377// CHECK: 1: (CXXConstructExpr, class A)
378// CHECK: 2: A d;
379// CHECK: 3: [B5.2].~A() (Implicit destructor)
380// CHECK: 4: [B7.2].~A() (Implicit destructor)
381// CHECK: Preds (1): B7
382// CHECK: Succs (1): B1
383// CHECK: [B6]
384// CHECK: 1: return;
385// CHECK: 2: [B7.2].~A() (Implicit destructor)
386// CHECK: 3: [B8.6].~A() (Implicit destructor)
387// CHECK: 4: [B8.2].~A() (Implicit destructor)
388// CHECK: Preds (1): B7
389// CHECK: Succs (1): B0
390// CHECK: [B7]
391// CHECK: 1: (CXXConstructExpr, class A)
392// CHECK: 2: A c;
393// CHECK: 3: UV
394// CHECK: 4: [B7.3] (ImplicitCastExpr, LValueToRValue, _Bool)
395// CHECK: T: if [B7.4]
396// CHECK: Preds (1): B8
397// CHECK: Succs (2): B6 B5
398// CHECK: [B8]
399// CHECK: 1: (CXXConstructExpr, class A)
400// CHECK: 2: A a;
401// CHECK: 3: a
402// CHECK: 4: [B8.3] (ImplicitCastExpr, NoOp, const class A)
403// CHECK: 5: [B8.4] (CXXConstructExpr, class A)
404// CHECK: 6: A b = a;
405// CHECK: 7: b
406// CHECK: 8: [B8.7] (ImplicitCastExpr, NoOp, const class A)
407// CHECK: 9: [B8.8].operator int
408// CHECK: 10: [B8.9]()
409// CHECK: 11: [B8.10] (ImplicitCastExpr, UserDefinedConversion, int)
410// CHECK: 12: [B8.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
411// CHECK: T: if [B8.12]
412// CHECK: Preds (1): B9
413// CHECK: Succs (2): B7 B4
414// CHECK: [B0 (EXIT)]
415// CHECK: Preds (3): B1 B3 B6
416// CHECK: [B6 (ENTRY)]
417// CHECK: Succs (1): B5
418// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000419// CHECK: 1: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000420// CHECK: 2: [B5.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000421// CHECK: Preds (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000422// CHECK: Succs (1): B0
423// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000424// CHECK: Preds (1): B3
425// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000426// CHECK: [B3]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000427// CHECK: 1: (CXXConstructExpr, class A)
428// CHECK: 2: A c;
429// CHECK: 3: [B3.2].~A() (Implicit destructor)
430// CHECK: 4: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000431// CHECK: Preds (1): B4
432// CHECK: Succs (1): B2
433// CHECK: [B4]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000434// CHECK: 1: a
435// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
436// CHECK: 3: [B4.2] (CXXConstructExpr, class A)
437// CHECK: 4: A b = a;
438// CHECK: 5: b
439// CHECK: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
440// CHECK: 7: [B4.6].operator int
441// CHECK: 8: [B4.7]()
442// CHECK: 9: [B4.8] (ImplicitCastExpr, UserDefinedConversion, int)
443// CHECK: 10: [B4.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
444// CHECK: T: while [B4.10]
445// CHECK: Preds (2): B2 B5
446// CHECK: Succs (2): B3 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000447// CHECK: [B5]
448// CHECK: 1: (CXXConstructExpr, class A)
449// CHECK: 2: A a;
450// CHECK: Preds (1): B6
Ted Kremenek3f635c02012-07-14 05:04:10 +0000451// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000452// CHECK: [B0 (EXIT)]
453// CHECK: Preds (1): B1
454// CHECK: [B12 (ENTRY)]
455// CHECK: Succs (1): B11
456// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000457// CHECK: 1: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000458// CHECK: 2: (CXXConstructExpr, class A)
459// CHECK: 3: A e;
460// CHECK: 4: [B1.3].~A() (Implicit destructor)
461// CHECK: 5: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000462// CHECK: Preds (2): B8 B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000463// CHECK: Succs (1): B0
464// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000465// CHECK: Preds (2): B3 B6
466// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000467// CHECK: [B3]
Ted Kremenek682060c2011-12-22 23:33:52 +0000468// CHECK: 1: (CXXConstructExpr, class A)
469// CHECK: 2: A d;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000470// CHECK: 3: [B3.2].~A() (Implicit destructor)
471// CHECK: 4: [B9.2].~A() (Implicit destructor)
472// CHECK: 5: [B10.4].~A() (Implicit destructor)
473// CHECK: Preds (1): B5
474// CHECK: Succs (1): B2
475// CHECK: [B4]
Ted Kremenek682060c2011-12-22 23:33:52 +0000476// CHECK: 1: return;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000477// CHECK: 2: [B9.2].~A() (Implicit destructor)
478// CHECK: 3: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000479// CHECK: 4: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000480// CHECK: Preds (1): B5
Ted Kremenek682060c2011-12-22 23:33:52 +0000481// CHECK: Succs (1): B0
Ted Kremenek3f635c02012-07-14 05:04:10 +0000482// CHECK: [B5]
483// CHECK: 1: UV
484// CHECK: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
485// CHECK: T: if [B5.2]
486// CHECK: Preds (1): B7
487// CHECK: Succs (2): B4 B3
Ted Kremenek682060c2011-12-22 23:33:52 +0000488// CHECK: [B6]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000489// CHECK: 1: [B9.2].~A() (Implicit destructor)
490// CHECK: 2: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000491// CHECK: T: continue;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000492// CHECK: Preds (1): B7
493// CHECK: Succs (1): B2
494// CHECK: [B7]
Ted Kremenek682060c2011-12-22 23:33:52 +0000495// CHECK: 1: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000496// CHECK: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
497// CHECK: T: if [B7.2]
498// CHECK: Preds (1): B9
499// CHECK: Succs (2): B6 B5
500// CHECK: [B8]
501// CHECK: 1: [B9.2].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000502// CHECK: T: break;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000503// CHECK: Preds (1): B9
Ted Kremenek682060c2011-12-22 23:33:52 +0000504// CHECK: Succs (1): B1
Ted Kremenek3f635c02012-07-14 05:04:10 +0000505// CHECK: [B9]
Ted Kremenek682060c2011-12-22 23:33:52 +0000506// CHECK: 1: (CXXConstructExpr, class A)
507// CHECK: 2: A c;
508// CHECK: 3: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000509// CHECK: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
510// CHECK: T: if [B9.4]
511// CHECK: Preds (1): B10
512// CHECK: Succs (2): B8 B7
513// CHECK: [B10]
514// CHECK: 1: a
515// CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
516// CHECK: 3: [B10.2] (CXXConstructExpr, class A)
517// CHECK: 4: A b = a;
518// CHECK: 5: b
519// CHECK: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
520// CHECK: 7: [B10.6].operator int
521// CHECK: 8: [B10.7]()
522// CHECK: 9: [B10.8] (ImplicitCastExpr, UserDefinedConversion, int)
523// CHECK: 10: [B10.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
524// CHECK: T: while [B10.10]
525// CHECK: Preds (2): B2 B11
526// CHECK: Succs (2): B9 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000527// CHECK: [B11]
528// CHECK: 1: (CXXConstructExpr, class A)
529// CHECK: 2: A a;
530// CHECK: Preds (1): B12
Ted Kremenek3f635c02012-07-14 05:04:10 +0000531// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000532// CHECK: [B0 (EXIT)]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000533// CHECK: Preds (2): B1 B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000534// CHECK: [B4 (ENTRY)]
535// CHECK: Succs (1): B2
536// CHECK: [B1]
537// CHECK: 1: UV
538// CHECK: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, _Bool)
539// CHECK: T: do ... while [B1.2]
540// CHECK: Preds (1): B2
541// CHECK: Succs (2): B3 B0
542// CHECK: [B2]
543// CHECK: 1: (CXXConstructExpr, class A)
544// CHECK: 2: A a;
545// CHECK: 3: [B2.2].~A() (Implicit destructor)
546// CHECK: Preds (2): B3 B4
547// CHECK: Succs (1): B1
548// CHECK: [B3]
549// CHECK: Preds (1): B1
550// CHECK: Succs (1): B2
551// CHECK: [B0 (EXIT)]
552// CHECK: Preds (1): B1
553// CHECK: [B12 (ENTRY)]
554// CHECK: Succs (1): B11
555// CHECK: [B1]
556// CHECK: 1: (CXXConstructExpr, class A)
557// CHECK: 2: A d;
558// CHECK: 3: [B1.2].~A() (Implicit destructor)
559// CHECK: 4: [B11.2].~A() (Implicit destructor)
560// CHECK: Preds (2): B8 B2
561// CHECK: Succs (1): B0
562// CHECK: [B2]
563// CHECK: 1: UV
564// CHECK: 2: [B2.1] (ImplicitCastExpr, LValueToRValue, _Bool)
565// CHECK: T: do ... while [B2.2]
566// CHECK: Preds (2): B3 B6
567// CHECK: Succs (2): B10 B1
568// CHECK: [B3]
569// CHECK: 1: (CXXConstructExpr, class A)
570// CHECK: 2: A c;
571// CHECK: 3: [B3.2].~A() (Implicit destructor)
572// CHECK: 4: [B9.2].~A() (Implicit destructor)
573// CHECK: Preds (1): B5
574// CHECK: Succs (1): B2
575// CHECK: [B4]
576// CHECK: 1: return;
577// CHECK: 2: [B9.2].~A() (Implicit destructor)
578// CHECK: 3: [B11.2].~A() (Implicit destructor)
579// CHECK: Preds (1): B5
580// CHECK: Succs (1): B0
581// CHECK: [B5]
582// CHECK: 1: UV
583// CHECK: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
584// CHECK: T: if [B5.2]
585// CHECK: Preds (1): B7
586// CHECK: Succs (2): B4 B3
587// CHECK: [B6]
588// CHECK: 1: [B9.2].~A() (Implicit destructor)
589// CHECK: T: continue;
590// CHECK: Preds (1): B7
591// CHECK: Succs (1): B2
592// CHECK: [B7]
593// CHECK: 1: UV
594// CHECK: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
595// CHECK: T: if [B7.2]
596// CHECK: Preds (1): B9
597// CHECK: Succs (2): B6 B5
598// CHECK: [B8]
599// CHECK: 1: [B9.2].~A() (Implicit destructor)
600// CHECK: T: break;
601// CHECK: Preds (1): B9
602// CHECK: Succs (1): B1
603// CHECK: [B9]
604// CHECK: 1: (CXXConstructExpr, class A)
605// CHECK: 2: A b;
606// CHECK: 3: UV
607// CHECK: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
608// CHECK: T: if [B9.4]
609// CHECK: Preds (2): B10 B11
610// CHECK: Succs (2): B8 B7
611// CHECK: [B10]
612// CHECK: Preds (1): B2
613// CHECK: Succs (1): B9
614// CHECK: [B11]
615// CHECK: 1: (CXXConstructExpr, class A)
616// CHECK: 2: A a;
617// CHECK: Preds (1): B12
618// CHECK: Succs (1): B9
619// CHECK: [B0 (EXIT)]
620// CHECK: Preds (2): B1 B4
621// CHECK: [B4 (ENTRY)]
622// CHECK: Succs (1): B2
623// CHECK: [B1]
624// CHECK: 1: [B2.6].~A() (Implicit destructor)
625// CHECK: 2: [B2.2].~A() (Implicit destructor)
626// CHECK: Preds (2): B3 B2
627// CHECK: Succs (1): B0
628// CHECK: [B2]
629// CHECK: 1: (CXXConstructExpr, class A)
630// CHECK: 2: A a;
631// CHECK: 3: a
632// CHECK: 4: [B2.3] (ImplicitCastExpr, NoOp, const class A)
633// CHECK: 5: [B2.4] (CXXConstructExpr, class A)
634// CHECK: 6: A b = a;
635// CHECK: 7: b
636// CHECK: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
637// CHECK: 9: [B2.8].operator int
638// CHECK: 10: [B2.9]()
639// CHECK: 11: [B2.10] (ImplicitCastExpr, UserDefinedConversion, int)
640// CHECK: T: switch [B2.11]
641// CHECK: Preds (1): B4
642// CHECK: Succs (1): B1
643// CHECK: [B3]
644// CHECK: 1: (CXXConstructExpr, class A)
645// CHECK: 2: A c;
646// CHECK: 3: [B3.2].~A() (Implicit destructor)
647// CHECK: Succs (1): B1
648// CHECK: [B0 (EXIT)]
649// CHECK: Preds (1): B1
650// CHECK: [B9 (ENTRY)]
651// CHECK: Succs (1): B2
652// CHECK: [B1]
653// CHECK: 1: [B2.6].~A() (Implicit destructor)
654// CHECK: 2: (CXXConstructExpr, class A)
655// CHECK: 3: A g;
656// CHECK: 4: [B1.3].~A() (Implicit destructor)
657// CHECK: 5: [B2.2].~A() (Implicit destructor)
658// CHECK: Preds (3): B3 B7 B2
659// CHECK: Succs (1): B0
660// CHECK: [B2]
661// CHECK: 1: (CXXConstructExpr, class A)
662// CHECK: 2: A a;
663// CHECK: 3: a
664// CHECK: 4: [B2.3] (ImplicitCastExpr, NoOp, const class A)
665// CHECK: 5: [B2.4] (CXXConstructExpr, class A)
666// CHECK: 6: A b = a;
667// CHECK: 7: b
668// CHECK: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
669// CHECK: 9: [B2.8].operator int
670// CHECK: 10: [B2.9]()
671// CHECK: 11: [B2.10] (ImplicitCastExpr, UserDefinedConversion, int)
672// CHECK: T: switch [B2.11]
673// CHECK: Preds (1): B9
674// CHECK: Succs (3): B3 B8
Ted Kremenek88299892011-07-28 23:07:59 +0000675// CHECK: B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000676// CHECK: [B3]
677// CHECK: case 1:
678// CHECK: T: break;
679// CHECK: Preds (2): B2 B4
680// CHECK: Succs (1): B1
681// CHECK: [B4]
682// CHECK: 1: (CXXConstructExpr, class A)
683// CHECK: 2: A f;
684// CHECK: 3: [B4.2].~A() (Implicit destructor)
685// CHECK: 4: [B8.2].~A() (Implicit destructor)
686// CHECK: Preds (1): B6
687// CHECK: Succs (1): B3
688// CHECK: [B5]
689// CHECK: 1: return;
690// CHECK: 2: [B8.2].~A() (Implicit destructor)
691// CHECK: 3: [B2.6].~A() (Implicit destructor)
692// CHECK: 4: [B2.2].~A() (Implicit destructor)
693// CHECK: Preds (1): B6
694// CHECK: Succs (1): B0
695// CHECK: [B6]
696// CHECK: 1: UV
697// CHECK: 2: [B6.1] (ImplicitCastExpr, LValueToRValue, _Bool)
698// CHECK: T: if [B6.2]
699// CHECK: Preds (1): B8
700// CHECK: Succs (2): B5 B4
701// CHECK: [B7]
702// CHECK: 1: [B8.2].~A() (Implicit destructor)
703// CHECK: T: break;
704// CHECK: Preds (1): B8
705// CHECK: Succs (1): B1
706// CHECK: [B8]
707// CHECK: case 0:
708// CHECK: 1: (CXXConstructExpr, class A)
709// CHECK: 2: A c;
710// CHECK: 3: UV
711// CHECK: 4: [B8.3] (ImplicitCastExpr, LValueToRValue, _Bool)
712// CHECK: T: if [B8.4]
713// CHECK: Preds (1): B2
714// CHECK: Succs (2): B7 B6
715// CHECK: [B0 (EXIT)]
716// CHECK: Preds (2): B1 B5
717// CHECK: [B6 (ENTRY)]
718// CHECK: Succs (1): B5
719// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000720// CHECK: 1: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000721// CHECK: 2: [B5.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000722// CHECK: Preds (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000723// CHECK: Succs (1): B0
724// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000725// CHECK: Preds (1): B3
726// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000727// CHECK: [B3]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000728// CHECK: 1: (CXXConstructExpr, class A)
729// CHECK: 2: A c;
730// CHECK: 3: [B3.2].~A() (Implicit destructor)
731// CHECK: 4: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000732// CHECK: Preds (1): B4
733// CHECK: Succs (1): B2
734// CHECK: [B4]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000735// CHECK: 1: a
736// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
737// CHECK: 3: [B4.2] (CXXConstructExpr, class A)
738// CHECK: 4: A b = a;
739// CHECK: 5: b
740// CHECK: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
741// CHECK: 7: [B4.6].operator int
742// CHECK: 8: [B4.7]()
743// CHECK: 9: [B4.8] (ImplicitCastExpr, UserDefinedConversion, int)
744// CHECK: 10: [B4.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
745// CHECK: T: for (...; [B4.10]; )
746// CHECK: Preds (2): B2 B5
747// CHECK: Succs (2): B3 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000748// CHECK: [B5]
749// CHECK: 1: (CXXConstructExpr, class A)
750// CHECK: 2: A a;
751// CHECK: Preds (1): B6
Ted Kremenek3f635c02012-07-14 05:04:10 +0000752// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000753// CHECK: [B0 (EXIT)]
754// CHECK: Preds (1): B1
755// CHECK: [B12 (ENTRY)]
756// CHECK: Succs (1): B11
757// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000758// CHECK: 1: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000759// CHECK: 2: [B11.4].~A() (Implicit destructor)
760// CHECK: 3: (CXXConstructExpr, class A)
761// CHECK: 4: A f;
762// CHECK: 5: [B1.4].~A() (Implicit destructor)
763// CHECK: 6: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000764// CHECK: Preds (2): B8 B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000765// CHECK: Succs (1): B0
766// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000767// CHECK: Preds (2): B3 B6
768// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000769// CHECK: [B3]
Ted Kremenek682060c2011-12-22 23:33:52 +0000770// CHECK: 1: (CXXConstructExpr, class A)
771// CHECK: 2: A e;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000772// CHECK: 3: [B3.2].~A() (Implicit destructor)
773// CHECK: 4: [B9.2].~A() (Implicit destructor)
774// CHECK: 5: [B10.4].~A() (Implicit destructor)
775// CHECK: Preds (1): B5
776// CHECK: Succs (1): B2
777// CHECK: [B4]
Ted Kremenek682060c2011-12-22 23:33:52 +0000778// CHECK: 1: return;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000779// CHECK: 2: [B9.2].~A() (Implicit destructor)
780// CHECK: 3: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000781// CHECK: 4: [B11.4].~A() (Implicit destructor)
782// CHECK: 5: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000783// CHECK: Preds (1): B5
Ted Kremenek682060c2011-12-22 23:33:52 +0000784// CHECK: Succs (1): B0
Ted Kremenek3f635c02012-07-14 05:04:10 +0000785// CHECK: [B5]
786// CHECK: 1: UV
787// CHECK: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
788// CHECK: T: if [B5.2]
789// CHECK: Preds (1): B7
790// CHECK: Succs (2): B4 B3
Ted Kremenek682060c2011-12-22 23:33:52 +0000791// CHECK: [B6]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000792// CHECK: 1: [B9.2].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000793// CHECK: T: continue;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000794// CHECK: Preds (1): B7
795// CHECK: Succs (1): B2
796// CHECK: [B7]
Ted Kremenek682060c2011-12-22 23:33:52 +0000797// CHECK: 1: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000798// CHECK: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
799// CHECK: T: if [B7.2]
800// CHECK: Preds (1): B9
801// CHECK: Succs (2): B6 B5
802// CHECK: [B8]
803// CHECK: 1: [B9.2].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000804// CHECK: T: break;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000805// CHECK: Preds (1): B9
Ted Kremenek682060c2011-12-22 23:33:52 +0000806// CHECK: Succs (1): B1
Ted Kremenek3f635c02012-07-14 05:04:10 +0000807// CHECK: [B9]
Ted Kremenek682060c2011-12-22 23:33:52 +0000808// CHECK: 1: (CXXConstructExpr, class A)
809// CHECK: 2: A d;
810// CHECK: 3: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000811// CHECK: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
812// CHECK: T: if [B9.4]
813// CHECK: Preds (1): B10
814// CHECK: Succs (2): B8 B7
815// CHECK: [B10]
816// CHECK: 1: b
817// CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
818// CHECK: 3: [B10.2] (CXXConstructExpr, class A)
819// CHECK: 4: A c = b;
820// CHECK: 5: c
821// CHECK: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
822// CHECK: 7: [B10.6].operator int
823// CHECK: 8: [B10.7]()
824// CHECK: 9: [B10.8] (ImplicitCastExpr, UserDefinedConversion, int)
825// CHECK: 10: [B10.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
826// CHECK: T: for (...; [B10.10]; )
827// CHECK: Preds (2): B2 B11
828// CHECK: Succs (2): B9 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000829// CHECK: [B11]
830// CHECK: 1: (CXXConstructExpr, class A)
831// CHECK: 2: A a;
832// CHECK: 3: (CXXConstructExpr, class A)
833// CHECK: 4: A b;
834// CHECK: Preds (1): B12
Ted Kremenek3f635c02012-07-14 05:04:10 +0000835// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000836// CHECK: [B0 (EXIT)]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000837// CHECK: Preds (2): B1 B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000838// CHECK: [B3 (ENTRY)]
839// CHECK: Succs (1): B0
840// CHECK: [B1]
841// CHECK: T: try ...
842// CHECK: Succs (2): B2 B0
843// CHECK: [B2]
844// CHECK: catch (const A &e):
Ted Kremenek337e4db2012-03-10 01:34:17 +0000845// CHECK: 1: catch (const A &e) {
846// CHECK: }
Ted Kremenek682060c2011-12-22 23:33:52 +0000847// CHECK: Preds (1): B1
848// CHECK: Succs (1): B0
849// CHECK: [B0 (EXIT)]
850// CHECK: Preds (3): B2 B1 B3
851// CHECK: [B3 (ENTRY)]
852// CHECK: Succs (1): B0
853// CHECK: [B1]
854// CHECK: T: try ...
855// CHECK: Succs (2): B2 B0
856// CHECK: [B2]
857// CHECK: catch (A e):
Ted Kremenek337e4db2012-03-10 01:34:17 +0000858// CHECK: 1: catch (A e) {
859// CHECK: }
860// CHECK: 2: [B2.1].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000861// CHECK: Preds (1): B1
862// CHECK: Succs (1): B0
863// CHECK: [B0 (EXIT)]
864// CHECK: Preds (3): B2 B1 B3
Ted Kremenek3f635c02012-07-14 05:04:10 +0000865