blob: 0fc6517391193d073953254ddf921cdba4d4a2ce [file] [log] [blame]
Jordan Rose5a1ffe92012-09-05 22:55:23 +00001// RUN: %clang_cc1 -fcxx-exceptions -fexceptions -analyze -analyzer-checker=debug.DumpCFG %s > %t 2>&1
Ted Kremenek337e4db2012-03-10 01:34:17 +00002// RUN: FileCheck --input-file=%t %s
Marcin Swiderskifcb72ac2010-10-01 00:23:17 +00003
4class A {
5public:
6 A() {}
7 ~A() {}
8 operator int() const { return 1; }
9};
10
11extern const bool UV;
12
13void test_const_ref() {
14 A a;
15 const A& b = a;
16 const A& c = A();
17}
18
Marcin Swiderskib1c52872010-10-25 07:00:40 +000019void test_array() {
20 A a[2];
21 A b[0];
22}
23
Marcin Swiderskifcb72ac2010-10-01 00:23:17 +000024void test_scope() {
25 A a;
26 { A c;
27 A d;
28 }
29 A b;
30}
31
32void test_return() {
33 A a;
34 A b;
35 if (UV) return;
36 A c;
37}
38
39void test_goto() {
40 A a;
41l0:
42 A b;
43 { A a;
44 if (UV) goto l0;
45 if (UV) goto l1;
46 A b;
47 }
48l1:
49 A c;
50}
51
Marcin Swiderski04e046c2010-10-01 00:52:17 +000052void test_if_implicit_scope() {
53 A a;
54 if (A b = a)
55 A c;
56 else A c;
57}
58
59void test_if_jumps() {
60 A a;
61 if (A b = a) {
62 A c;
63 if (UV) return;
64 A d;
65 } else {
66 A c;
67 if (UV) return;
68 A d;
69 }
70 A e;
71}
72
Marcin Swiderski05adedc2010-10-01 01:14:17 +000073void test_while_implicit_scope() {
74 A a;
75 while (A b = a)
76 A c;
77}
78
79void test_while_jumps() {
80 A a;
81 while (A b = a) {
82 A c;
83 if (UV) break;
84 if (UV) continue;
85 if (UV) return;
86 A d;
87 }
88 A e;
89}
90
91void test_do_implicit_scope() {
92 do A a;
93 while (UV);
94}
95
96void test_do_jumps() {
97 A a;
98 do {
99 A b;
100 if (UV) break;
101 if (UV) continue;
102 if (UV) return;
103 A c;
104 } while (UV);
105 A d;
106}
107
Marcin Swiderski8ae60582010-10-01 01:24:41 +0000108void test_switch_implicit_scope() {
109 A a;
110 switch (A b = a)
111 A c;
112}
113
114void test_switch_jumps() {
115 A a;
116 switch (A b = a) {
117 case 0: {
118 A c;
119 if (UV) break;
120 if (UV) return;
121 A f;
122 }
123 case 1:
124 break;
125 }
126 A g;
127}
128
Marcin Swiderski47575f12010-10-01 01:38:14 +0000129void test_for_implicit_scope() {
130 for (A a; A b = a; )
131 A c;
132}
133
134void test_for_jumps() {
135 A a;
136 for (A b; A c = b; ) {
137 A d;
138 if (UV) break;
139 if (UV) continue;
140 if (UV) return;
141 A e;
142 }
143 A f;
144}
145
Marcin Swiderski0e97bcb2010-10-01 01:46:52 +0000146void test_catch_const_ref() {
147 try {
148 } catch (const A& e) {
149 }
150}
151
152void test_catch_copy() {
153 try {
154 } catch (A e) {
155 }
156}
157
Anna Zaksaa560982012-03-13 19:32:00 +0000158// CHECK: [B1 (ENTRY)]
159// CHECK: Succs (1): B0
160// CHECK: [B0 (EXIT)]
161// CHECK: Preds (1): B1
162// CHECK: [B1 (ENTRY)]
163// CHECK: Succs (1): B0
164// CHECK: [B0 (EXIT)]
165// CHECK: Preds (1): B1
166// CHECK: [B2 (ENTRY)]
167// CHECK: Succs (1): B1
168// CHECK: [B1]
169// CHECK: 1: 1
170// CHECK: 2: return [B1.1];
171// CHECK: Preds (1): B2
172// CHECK: Succs (1): B0
173// CHECK: [B0 (EXIT)]
174// CHECK: Preds (1): B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000175// CHECK: [B2 (ENTRY)]
176// CHECK: Succs (1): B1
177// CHECK: [B1]
178// CHECK: 1: (CXXConstructExpr, class A)
179// CHECK: 2: A a;
180// CHECK: 3: a
181// CHECK: 4: [B1.3] (ImplicitCastExpr, NoOp, const class A)
182// CHECK: 5: const A &b = a;
183// CHECK: 6: A() (CXXConstructExpr, class A)
184// CHECK: 7: [B1.6] (BindTemporary)
185// CHECK: 8: [B1.7] (ImplicitCastExpr, NoOp, const class A)
186// CHECK: 9: [B1.8]
187// CHECK: 10: const A &c = A();
188// CHECK: 11: [B1.10].~A() (Implicit destructor)
189// CHECK: 12: [B1.2].~A() (Implicit destructor)
190// CHECK: Preds (1): B2
191// CHECK: Succs (1): B0
192// CHECK: [B0 (EXIT)]
193// CHECK: Preds (1): B1
194// CHECK: [B2 (ENTRY)]
195// CHECK: Succs (1): B1
196// CHECK: [B1]
197// CHECK: 1: (CXXConstructExpr, class A [2])
198// CHECK: 2: A a[2];
199// CHECK: 3: (CXXConstructExpr, class A [0])
200// CHECK: 4: A b[0];
201// CHECK: 5: [B1.2].~A() (Implicit destructor)
202// CHECK: Preds (1): B2
203// CHECK: Succs (1): B0
204// CHECK: [B0 (EXIT)]
205// CHECK: Preds (1): B1
206// CHECK: [B2 (ENTRY)]
207// CHECK: Succs (1): B1
208// CHECK: [B1]
209// CHECK: 1: (CXXConstructExpr, class A)
210// CHECK: 2: A a;
211// CHECK: 3: (CXXConstructExpr, class A)
212// CHECK: 4: A c;
213// CHECK: 5: (CXXConstructExpr, class A)
214// CHECK: 6: A d;
215// CHECK: 7: [B1.6].~A() (Implicit destructor)
216// CHECK: 8: [B1.4].~A() (Implicit destructor)
217// CHECK: 9: (CXXConstructExpr, class A)
218// CHECK: 10: A b;
219// CHECK: 11: [B1.10].~A() (Implicit destructor)
220// CHECK: 12: [B1.2].~A() (Implicit destructor)
221// CHECK: Preds (1): B2
222// CHECK: Succs (1): B0
223// CHECK: [B0 (EXIT)]
224// CHECK: Preds (1): B1
225// CHECK: [B4 (ENTRY)]
226// CHECK: Succs (1): B3
227// CHECK: [B1]
228// CHECK: 1: (CXXConstructExpr, class A)
229// CHECK: 2: A c;
230// CHECK: 3: [B1.2].~A() (Implicit destructor)
231// CHECK: 4: [B3.4].~A() (Implicit destructor)
232// CHECK: 5: [B3.2].~A() (Implicit destructor)
233// CHECK: Preds (1): B3
234// CHECK: Succs (1): B0
235// CHECK: [B2]
236// CHECK: 1: return;
237// CHECK: 2: [B3.4].~A() (Implicit destructor)
238// CHECK: 3: [B3.2].~A() (Implicit destructor)
239// CHECK: Preds (1): B3
240// CHECK: Succs (1): B0
241// CHECK: [B3]
242// CHECK: 1: (CXXConstructExpr, class A)
243// CHECK: 2: A a;
244// CHECK: 3: (CXXConstructExpr, class A)
245// CHECK: 4: A b;
246// CHECK: 5: UV
247// CHECK: 6: [B3.5] (ImplicitCastExpr, LValueToRValue, _Bool)
248// CHECK: T: if [B3.6]
249// CHECK: Preds (1): B4
250// CHECK: Succs (2): B2 B1
251// CHECK: [B0 (EXIT)]
252// CHECK: Preds (2): B1 B2
253// CHECK: [B8 (ENTRY)]
254// CHECK: Succs (1): B7
255// CHECK: [B1]
256// CHECK: l1:
257// CHECK: 1: (CXXConstructExpr, class A)
258// CHECK: 2: A c;
259// CHECK: 3: [B1.2].~A() (Implicit destructor)
260// CHECK: 4: [B6.2].~A() (Implicit destructor)
261// CHECK: 5: [B7.2].~A() (Implicit destructor)
262// CHECK: Preds (2): B2 B3
263// CHECK: Succs (1): B0
264// CHECK: [B2]
265// CHECK: 1: (CXXConstructExpr, class A)
266// CHECK: 2: A b;
267// CHECK: 3: [B2.2].~A() (Implicit destructor)
268// CHECK: 4: [B6.4].~A() (Implicit destructor)
269// CHECK: Preds (1): B4
270// CHECK: Succs (1): B1
271// CHECK: [B3]
272// CHECK: 1: [B6.4].~A() (Implicit destructor)
273// CHECK: T: goto l1;
274// CHECK: Preds (1): B4
275// CHECK: Succs (1): B1
276// CHECK: [B4]
277// CHECK: 1: UV
278// CHECK: 2: [B4.1] (ImplicitCastExpr, LValueToRValue, _Bool)
279// CHECK: T: if [B4.2]
280// CHECK: Preds (1): B6
281// CHECK: Succs (2): B3 B2
282// CHECK: [B5]
283// CHECK: 1: [B6.4].~A() (Implicit destructor)
284// CHECK: 2: [B6.2].~A() (Implicit destructor)
285// CHECK: T: goto l0;
286// CHECK: Preds (1): B6
287// CHECK: Succs (1): B6
288// CHECK: [B6]
289// CHECK: l0:
290// CHECK: 1: (CXXConstructExpr, class A)
291// CHECK: 2: A b;
292// CHECK: 3: (CXXConstructExpr, class A)
293// CHECK: 4: A a;
294// CHECK: 5: UV
295// CHECK: 6: [B6.5] (ImplicitCastExpr, LValueToRValue, _Bool)
296// CHECK: T: if [B6.6]
297// CHECK: Preds (2): B7 B5
298// CHECK: Succs (2): B5 B4
299// CHECK: [B7]
300// CHECK: 1: (CXXConstructExpr, class A)
301// CHECK: 2: A a;
302// CHECK: Preds (1): B8
303// CHECK: Succs (1): B6
304// CHECK: [B0 (EXIT)]
305// CHECK: Preds (1): B1
306// CHECK: [B5 (ENTRY)]
307// CHECK: Succs (1): B4
308// CHECK: [B1]
309// CHECK: 1: [B4.6].~A() (Implicit destructor)
310// CHECK: 2: [B4.2].~A() (Implicit destructor)
311// CHECK: Preds (2): B2 B3
312// CHECK: Succs (1): B0
313// CHECK: [B2]
314// CHECK: 1: (CXXConstructExpr, class A)
315// CHECK: 2: A c;
316// CHECK: 3: [B2.2].~A() (Implicit destructor)
317// CHECK: Preds (1): B4
318// CHECK: Succs (1): B1
319// CHECK: [B3]
320// CHECK: 1: (CXXConstructExpr, class A)
321// CHECK: 2: A c;
322// CHECK: 3: [B3.2].~A() (Implicit destructor)
323// CHECK: Preds (1): B4
324// CHECK: Succs (1): B1
325// CHECK: [B4]
326// CHECK: 1: (CXXConstructExpr, class A)
327// CHECK: 2: A a;
328// CHECK: 3: a
329// CHECK: 4: [B4.3] (ImplicitCastExpr, NoOp, const class A)
330// CHECK: 5: [B4.4] (CXXConstructExpr, class A)
331// CHECK: 6: A b = a;
332// CHECK: 7: b
333// CHECK: 8: [B4.7] (ImplicitCastExpr, NoOp, const class A)
334// CHECK: 9: [B4.8].operator int
335// CHECK: 10: [B4.9]()
336// CHECK: 11: [B4.10] (ImplicitCastExpr, UserDefinedConversion, int)
337// CHECK: 12: [B4.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
338// CHECK: T: if [B4.12]
339// CHECK: Preds (1): B5
340// CHECK: Succs (2): B3 B2
341// CHECK: [B0 (EXIT)]
342// CHECK: Preds (1): B1
343// CHECK: [B9 (ENTRY)]
344// CHECK: Succs (1): B8
345// CHECK: [B1]
346// CHECK: 1: [B8.6].~A() (Implicit destructor)
347// CHECK: 2: (CXXConstructExpr, class A)
348// CHECK: 3: A e;
349// CHECK: 4: [B1.3].~A() (Implicit destructor)
350// CHECK: 5: [B8.2].~A() (Implicit destructor)
351// CHECK: Preds (2): B2 B5
352// CHECK: Succs (1): B0
353// CHECK: [B2]
354// CHECK: 1: (CXXConstructExpr, class A)
355// CHECK: 2: A d;
356// CHECK: 3: [B2.2].~A() (Implicit destructor)
357// CHECK: 4: [B4.2].~A() (Implicit destructor)
358// CHECK: Preds (1): B4
359// CHECK: Succs (1): B1
360// CHECK: [B3]
361// CHECK: 1: return;
362// CHECK: 2: [B4.2].~A() (Implicit destructor)
363// CHECK: 3: [B8.6].~A() (Implicit destructor)
364// CHECK: 4: [B8.2].~A() (Implicit destructor)
365// CHECK: Preds (1): B4
366// CHECK: Succs (1): B0
367// CHECK: [B4]
368// CHECK: 1: (CXXConstructExpr, class A)
369// CHECK: 2: A c;
370// CHECK: 3: UV
371// CHECK: 4: [B4.3] (ImplicitCastExpr, LValueToRValue, _Bool)
372// CHECK: T: if [B4.4]
373// CHECK: Preds (1): B8
374// CHECK: Succs (2): B3 B2
375// CHECK: [B5]
376// CHECK: 1: (CXXConstructExpr, class A)
377// CHECK: 2: A d;
378// CHECK: 3: [B5.2].~A() (Implicit destructor)
379// CHECK: 4: [B7.2].~A() (Implicit destructor)
380// CHECK: Preds (1): B7
381// CHECK: Succs (1): B1
382// CHECK: [B6]
383// CHECK: 1: return;
384// CHECK: 2: [B7.2].~A() (Implicit destructor)
385// CHECK: 3: [B8.6].~A() (Implicit destructor)
386// CHECK: 4: [B8.2].~A() (Implicit destructor)
387// CHECK: Preds (1): B7
388// CHECK: Succs (1): B0
389// CHECK: [B7]
390// CHECK: 1: (CXXConstructExpr, class A)
391// CHECK: 2: A c;
392// CHECK: 3: UV
393// CHECK: 4: [B7.3] (ImplicitCastExpr, LValueToRValue, _Bool)
394// CHECK: T: if [B7.4]
395// CHECK: Preds (1): B8
396// CHECK: Succs (2): B6 B5
397// CHECK: [B8]
398// CHECK: 1: (CXXConstructExpr, class A)
399// CHECK: 2: A a;
400// CHECK: 3: a
401// CHECK: 4: [B8.3] (ImplicitCastExpr, NoOp, const class A)
402// CHECK: 5: [B8.4] (CXXConstructExpr, class A)
403// CHECK: 6: A b = a;
404// CHECK: 7: b
405// CHECK: 8: [B8.7] (ImplicitCastExpr, NoOp, const class A)
406// CHECK: 9: [B8.8].operator int
407// CHECK: 10: [B8.9]()
408// CHECK: 11: [B8.10] (ImplicitCastExpr, UserDefinedConversion, int)
409// CHECK: 12: [B8.11] (ImplicitCastExpr, IntegralToBoolean, _Bool)
410// CHECK: T: if [B8.12]
411// CHECK: Preds (1): B9
412// CHECK: Succs (2): B7 B4
413// CHECK: [B0 (EXIT)]
414// CHECK: Preds (3): B1 B3 B6
415// CHECK: [B6 (ENTRY)]
416// CHECK: Succs (1): B5
417// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000418// CHECK: 1: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000419// CHECK: 2: [B5.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000420// CHECK: Preds (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000421// CHECK: Succs (1): B0
422// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000423// CHECK: Preds (1): B3
424// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000425// CHECK: [B3]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000426// CHECK: 1: (CXXConstructExpr, class A)
427// CHECK: 2: A c;
428// CHECK: 3: [B3.2].~A() (Implicit destructor)
429// CHECK: 4: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000430// CHECK: Preds (1): B4
431// CHECK: Succs (1): B2
432// CHECK: [B4]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000433// CHECK: 1: a
434// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
435// CHECK: 3: [B4.2] (CXXConstructExpr, class A)
436// CHECK: 4: A b = a;
437// CHECK: 5: b
438// CHECK: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
439// CHECK: 7: [B4.6].operator int
440// CHECK: 8: [B4.7]()
441// CHECK: 9: [B4.8] (ImplicitCastExpr, UserDefinedConversion, int)
442// CHECK: 10: [B4.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
443// CHECK: T: while [B4.10]
444// CHECK: Preds (2): B2 B5
445// CHECK: Succs (2): B3 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000446// CHECK: [B5]
447// CHECK: 1: (CXXConstructExpr, class A)
448// CHECK: 2: A a;
449// CHECK: Preds (1): B6
Ted Kremenek3f635c02012-07-14 05:04:10 +0000450// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000451// CHECK: [B0 (EXIT)]
452// CHECK: Preds (1): B1
453// CHECK: [B12 (ENTRY)]
454// CHECK: Succs (1): B11
455// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000456// CHECK: 1: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000457// CHECK: 2: (CXXConstructExpr, class A)
458// CHECK: 3: A e;
459// CHECK: 4: [B1.3].~A() (Implicit destructor)
460// CHECK: 5: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000461// CHECK: Preds (2): B8 B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000462// CHECK: Succs (1): B0
463// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000464// CHECK: Preds (2): B3 B6
465// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000466// CHECK: [B3]
Ted Kremenek682060c2011-12-22 23:33:52 +0000467// CHECK: 1: (CXXConstructExpr, class A)
468// CHECK: 2: A d;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000469// CHECK: 3: [B3.2].~A() (Implicit destructor)
470// CHECK: 4: [B9.2].~A() (Implicit destructor)
471// CHECK: 5: [B10.4].~A() (Implicit destructor)
472// CHECK: Preds (1): B5
473// CHECK: Succs (1): B2
474// CHECK: [B4]
Ted Kremenek682060c2011-12-22 23:33:52 +0000475// CHECK: 1: return;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000476// CHECK: 2: [B9.2].~A() (Implicit destructor)
477// CHECK: 3: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000478// CHECK: 4: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000479// CHECK: Preds (1): B5
Ted Kremenek682060c2011-12-22 23:33:52 +0000480// CHECK: Succs (1): B0
Ted Kremenek3f635c02012-07-14 05:04:10 +0000481// CHECK: [B5]
482// CHECK: 1: UV
483// CHECK: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
484// CHECK: T: if [B5.2]
485// CHECK: Preds (1): B7
486// CHECK: Succs (2): B4 B3
Ted Kremenek682060c2011-12-22 23:33:52 +0000487// CHECK: [B6]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000488// CHECK: 1: [B9.2].~A() (Implicit destructor)
489// CHECK: 2: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000490// CHECK: T: continue;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000491// CHECK: Preds (1): B7
492// CHECK: Succs (1): B2
493// CHECK: [B7]
Ted Kremenek682060c2011-12-22 23:33:52 +0000494// CHECK: 1: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000495// CHECK: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
496// CHECK: T: if [B7.2]
497// CHECK: Preds (1): B9
498// CHECK: Succs (2): B6 B5
499// CHECK: [B8]
500// CHECK: 1: [B9.2].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000501// CHECK: T: break;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000502// CHECK: Preds (1): B9
Ted Kremenek682060c2011-12-22 23:33:52 +0000503// CHECK: Succs (1): B1
Ted Kremenek3f635c02012-07-14 05:04:10 +0000504// CHECK: [B9]
Ted Kremenek682060c2011-12-22 23:33:52 +0000505// CHECK: 1: (CXXConstructExpr, class A)
506// CHECK: 2: A c;
507// CHECK: 3: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000508// CHECK: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
509// CHECK: T: if [B9.4]
510// CHECK: Preds (1): B10
511// CHECK: Succs (2): B8 B7
512// CHECK: [B10]
513// CHECK: 1: a
514// CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
515// CHECK: 3: [B10.2] (CXXConstructExpr, class A)
516// CHECK: 4: A b = a;
517// CHECK: 5: b
518// CHECK: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
519// CHECK: 7: [B10.6].operator int
520// CHECK: 8: [B10.7]()
521// CHECK: 9: [B10.8] (ImplicitCastExpr, UserDefinedConversion, int)
522// CHECK: 10: [B10.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
523// CHECK: T: while [B10.10]
524// CHECK: Preds (2): B2 B11
525// CHECK: Succs (2): B9 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000526// CHECK: [B11]
527// CHECK: 1: (CXXConstructExpr, class A)
528// CHECK: 2: A a;
529// CHECK: Preds (1): B12
Ted Kremenek3f635c02012-07-14 05:04:10 +0000530// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000531// CHECK: [B0 (EXIT)]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000532// CHECK: Preds (2): B1 B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000533// CHECK: [B4 (ENTRY)]
534// CHECK: Succs (1): B2
535// CHECK: [B1]
536// CHECK: 1: UV
537// CHECK: 2: [B1.1] (ImplicitCastExpr, LValueToRValue, _Bool)
538// CHECK: T: do ... while [B1.2]
539// CHECK: Preds (1): B2
540// CHECK: Succs (2): B3 B0
541// CHECK: [B2]
542// CHECK: 1: (CXXConstructExpr, class A)
543// CHECK: 2: A a;
544// CHECK: 3: [B2.2].~A() (Implicit destructor)
545// CHECK: Preds (2): B3 B4
546// CHECK: Succs (1): B1
547// CHECK: [B3]
548// CHECK: Preds (1): B1
549// CHECK: Succs (1): B2
550// CHECK: [B0 (EXIT)]
551// CHECK: Preds (1): B1
552// CHECK: [B12 (ENTRY)]
553// CHECK: Succs (1): B11
554// CHECK: [B1]
555// CHECK: 1: (CXXConstructExpr, class A)
556// CHECK: 2: A d;
557// CHECK: 3: [B1.2].~A() (Implicit destructor)
558// CHECK: 4: [B11.2].~A() (Implicit destructor)
559// CHECK: Preds (2): B8 B2
560// CHECK: Succs (1): B0
561// CHECK: [B2]
562// CHECK: 1: UV
563// CHECK: 2: [B2.1] (ImplicitCastExpr, LValueToRValue, _Bool)
564// CHECK: T: do ... while [B2.2]
565// CHECK: Preds (2): B3 B6
566// CHECK: Succs (2): B10 B1
567// CHECK: [B3]
568// CHECK: 1: (CXXConstructExpr, class A)
569// CHECK: 2: A c;
570// CHECK: 3: [B3.2].~A() (Implicit destructor)
571// CHECK: 4: [B9.2].~A() (Implicit destructor)
572// CHECK: Preds (1): B5
573// CHECK: Succs (1): B2
574// CHECK: [B4]
575// CHECK: 1: return;
576// CHECK: 2: [B9.2].~A() (Implicit destructor)
577// CHECK: 3: [B11.2].~A() (Implicit destructor)
578// CHECK: Preds (1): B5
579// CHECK: Succs (1): B0
580// CHECK: [B5]
581// CHECK: 1: UV
582// CHECK: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
583// CHECK: T: if [B5.2]
584// CHECK: Preds (1): B7
585// CHECK: Succs (2): B4 B3
586// CHECK: [B6]
587// CHECK: 1: [B9.2].~A() (Implicit destructor)
588// CHECK: T: continue;
589// CHECK: Preds (1): B7
590// CHECK: Succs (1): B2
591// CHECK: [B7]
592// CHECK: 1: UV
593// CHECK: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
594// CHECK: T: if [B7.2]
595// CHECK: Preds (1): B9
596// CHECK: Succs (2): B6 B5
597// CHECK: [B8]
598// CHECK: 1: [B9.2].~A() (Implicit destructor)
599// CHECK: T: break;
600// CHECK: Preds (1): B9
601// CHECK: Succs (1): B1
602// CHECK: [B9]
603// CHECK: 1: (CXXConstructExpr, class A)
604// CHECK: 2: A b;
605// CHECK: 3: UV
606// CHECK: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
607// CHECK: T: if [B9.4]
608// CHECK: Preds (2): B10 B11
609// CHECK: Succs (2): B8 B7
610// CHECK: [B10]
611// CHECK: Preds (1): B2
612// CHECK: Succs (1): B9
613// CHECK: [B11]
614// CHECK: 1: (CXXConstructExpr, class A)
615// CHECK: 2: A a;
616// CHECK: Preds (1): B12
617// CHECK: Succs (1): B9
618// CHECK: [B0 (EXIT)]
619// CHECK: Preds (2): B1 B4
620// CHECK: [B4 (ENTRY)]
621// CHECK: Succs (1): B2
622// CHECK: [B1]
623// CHECK: 1: [B2.6].~A() (Implicit destructor)
624// CHECK: 2: [B2.2].~A() (Implicit destructor)
625// CHECK: Preds (2): B3 B2
626// CHECK: Succs (1): B0
627// CHECK: [B2]
628// CHECK: 1: (CXXConstructExpr, class A)
629// CHECK: 2: A a;
630// CHECK: 3: a
631// CHECK: 4: [B2.3] (ImplicitCastExpr, NoOp, const class A)
632// CHECK: 5: [B2.4] (CXXConstructExpr, class A)
633// CHECK: 6: A b = a;
634// CHECK: 7: b
635// CHECK: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
636// CHECK: 9: [B2.8].operator int
637// CHECK: 10: [B2.9]()
638// CHECK: 11: [B2.10] (ImplicitCastExpr, UserDefinedConversion, int)
639// CHECK: T: switch [B2.11]
640// CHECK: Preds (1): B4
641// CHECK: Succs (1): B1
642// CHECK: [B3]
643// CHECK: 1: (CXXConstructExpr, class A)
644// CHECK: 2: A c;
645// CHECK: 3: [B3.2].~A() (Implicit destructor)
646// CHECK: Succs (1): B1
647// CHECK: [B0 (EXIT)]
648// CHECK: Preds (1): B1
649// CHECK: [B9 (ENTRY)]
650// CHECK: Succs (1): B2
651// CHECK: [B1]
652// CHECK: 1: [B2.6].~A() (Implicit destructor)
653// CHECK: 2: (CXXConstructExpr, class A)
654// CHECK: 3: A g;
655// CHECK: 4: [B1.3].~A() (Implicit destructor)
656// CHECK: 5: [B2.2].~A() (Implicit destructor)
657// CHECK: Preds (3): B3 B7 B2
658// CHECK: Succs (1): B0
659// CHECK: [B2]
660// CHECK: 1: (CXXConstructExpr, class A)
661// CHECK: 2: A a;
662// CHECK: 3: a
663// CHECK: 4: [B2.3] (ImplicitCastExpr, NoOp, const class A)
664// CHECK: 5: [B2.4] (CXXConstructExpr, class A)
665// CHECK: 6: A b = a;
666// CHECK: 7: b
667// CHECK: 8: [B2.7] (ImplicitCastExpr, NoOp, const class A)
668// CHECK: 9: [B2.8].operator int
669// CHECK: 10: [B2.9]()
670// CHECK: 11: [B2.10] (ImplicitCastExpr, UserDefinedConversion, int)
671// CHECK: T: switch [B2.11]
672// CHECK: Preds (1): B9
673// CHECK: Succs (3): B3 B8
Ted Kremenek88299892011-07-28 23:07:59 +0000674// CHECK: B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000675// CHECK: [B3]
676// CHECK: case 1:
677// CHECK: T: break;
678// CHECK: Preds (2): B2 B4
679// CHECK: Succs (1): B1
680// CHECK: [B4]
681// CHECK: 1: (CXXConstructExpr, class A)
682// CHECK: 2: A f;
683// CHECK: 3: [B4.2].~A() (Implicit destructor)
684// CHECK: 4: [B8.2].~A() (Implicit destructor)
685// CHECK: Preds (1): B6
686// CHECK: Succs (1): B3
687// CHECK: [B5]
688// CHECK: 1: return;
689// CHECK: 2: [B8.2].~A() (Implicit destructor)
690// CHECK: 3: [B2.6].~A() (Implicit destructor)
691// CHECK: 4: [B2.2].~A() (Implicit destructor)
692// CHECK: Preds (1): B6
693// CHECK: Succs (1): B0
694// CHECK: [B6]
695// CHECK: 1: UV
696// CHECK: 2: [B6.1] (ImplicitCastExpr, LValueToRValue, _Bool)
697// CHECK: T: if [B6.2]
698// CHECK: Preds (1): B8
699// CHECK: Succs (2): B5 B4
700// CHECK: [B7]
701// CHECK: 1: [B8.2].~A() (Implicit destructor)
702// CHECK: T: break;
703// CHECK: Preds (1): B8
704// CHECK: Succs (1): B1
705// CHECK: [B8]
706// CHECK: case 0:
707// CHECK: 1: (CXXConstructExpr, class A)
708// CHECK: 2: A c;
709// CHECK: 3: UV
710// CHECK: 4: [B8.3] (ImplicitCastExpr, LValueToRValue, _Bool)
711// CHECK: T: if [B8.4]
712// CHECK: Preds (1): B2
713// CHECK: Succs (2): B7 B6
714// CHECK: [B0 (EXIT)]
715// CHECK: Preds (2): B1 B5
716// CHECK: [B6 (ENTRY)]
717// CHECK: Succs (1): B5
718// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000719// CHECK: 1: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000720// CHECK: 2: [B5.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000721// CHECK: Preds (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000722// CHECK: Succs (1): B0
723// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000724// CHECK: Preds (1): B3
725// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000726// CHECK: [B3]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000727// CHECK: 1: (CXXConstructExpr, class A)
728// CHECK: 2: A c;
729// CHECK: 3: [B3.2].~A() (Implicit destructor)
730// CHECK: 4: [B4.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000731// CHECK: Preds (1): B4
732// CHECK: Succs (1): B2
733// CHECK: [B4]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000734// CHECK: 1: a
735// CHECK: 2: [B4.1] (ImplicitCastExpr, NoOp, const class A)
736// CHECK: 3: [B4.2] (CXXConstructExpr, class A)
737// CHECK: 4: A b = a;
738// CHECK: 5: b
739// CHECK: 6: [B4.5] (ImplicitCastExpr, NoOp, const class A)
740// CHECK: 7: [B4.6].operator int
741// CHECK: 8: [B4.7]()
742// CHECK: 9: [B4.8] (ImplicitCastExpr, UserDefinedConversion, int)
743// CHECK: 10: [B4.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
744// CHECK: T: for (...; [B4.10]; )
745// CHECK: Preds (2): B2 B5
746// CHECK: Succs (2): B3 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000747// CHECK: [B5]
748// CHECK: 1: (CXXConstructExpr, class A)
749// CHECK: 2: A a;
750// CHECK: Preds (1): B6
Ted Kremenek3f635c02012-07-14 05:04:10 +0000751// CHECK: Succs (1): B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000752// CHECK: [B0 (EXIT)]
753// CHECK: Preds (1): B1
754// CHECK: [B12 (ENTRY)]
755// CHECK: Succs (1): B11
756// CHECK: [B1]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000757// CHECK: 1: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000758// CHECK: 2: [B11.4].~A() (Implicit destructor)
759// CHECK: 3: (CXXConstructExpr, class A)
760// CHECK: 4: A f;
761// CHECK: 5: [B1.4].~A() (Implicit destructor)
762// CHECK: 6: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000763// CHECK: Preds (2): B8 B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000764// CHECK: Succs (1): B0
765// CHECK: [B2]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000766// CHECK: Preds (2): B3 B6
767// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000768// CHECK: [B3]
Ted Kremenek682060c2011-12-22 23:33:52 +0000769// CHECK: 1: (CXXConstructExpr, class A)
770// CHECK: 2: A e;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000771// CHECK: 3: [B3.2].~A() (Implicit destructor)
772// CHECK: 4: [B9.2].~A() (Implicit destructor)
773// CHECK: 5: [B10.4].~A() (Implicit destructor)
774// CHECK: Preds (1): B5
775// CHECK: Succs (1): B2
776// CHECK: [B4]
Ted Kremenek682060c2011-12-22 23:33:52 +0000777// CHECK: 1: return;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000778// CHECK: 2: [B9.2].~A() (Implicit destructor)
779// CHECK: 3: [B10.4].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000780// CHECK: 4: [B11.4].~A() (Implicit destructor)
781// CHECK: 5: [B11.2].~A() (Implicit destructor)
Ted Kremenek3f635c02012-07-14 05:04:10 +0000782// CHECK: Preds (1): B5
Ted Kremenek682060c2011-12-22 23:33:52 +0000783// CHECK: Succs (1): B0
Ted Kremenek3f635c02012-07-14 05:04:10 +0000784// CHECK: [B5]
785// CHECK: 1: UV
786// CHECK: 2: [B5.1] (ImplicitCastExpr, LValueToRValue, _Bool)
787// CHECK: T: if [B5.2]
788// CHECK: Preds (1): B7
789// CHECK: Succs (2): B4 B3
Ted Kremenek682060c2011-12-22 23:33:52 +0000790// CHECK: [B6]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000791// CHECK: 1: [B9.2].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000792// CHECK: T: continue;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000793// CHECK: Preds (1): B7
794// CHECK: Succs (1): B2
795// CHECK: [B7]
Ted Kremenek682060c2011-12-22 23:33:52 +0000796// CHECK: 1: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000797// CHECK: 2: [B7.1] (ImplicitCastExpr, LValueToRValue, _Bool)
798// CHECK: T: if [B7.2]
799// CHECK: Preds (1): B9
800// CHECK: Succs (2): B6 B5
801// CHECK: [B8]
802// CHECK: 1: [B9.2].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000803// CHECK: T: break;
Ted Kremenek3f635c02012-07-14 05:04:10 +0000804// CHECK: Preds (1): B9
Ted Kremenek682060c2011-12-22 23:33:52 +0000805// CHECK: Succs (1): B1
Ted Kremenek3f635c02012-07-14 05:04:10 +0000806// CHECK: [B9]
Ted Kremenek682060c2011-12-22 23:33:52 +0000807// CHECK: 1: (CXXConstructExpr, class A)
808// CHECK: 2: A d;
809// CHECK: 3: UV
Ted Kremenek3f635c02012-07-14 05:04:10 +0000810// CHECK: 4: [B9.3] (ImplicitCastExpr, LValueToRValue, _Bool)
811// CHECK: T: if [B9.4]
812// CHECK: Preds (1): B10
813// CHECK: Succs (2): B8 B7
814// CHECK: [B10]
815// CHECK: 1: b
816// CHECK: 2: [B10.1] (ImplicitCastExpr, NoOp, const class A)
817// CHECK: 3: [B10.2] (CXXConstructExpr, class A)
818// CHECK: 4: A c = b;
819// CHECK: 5: c
820// CHECK: 6: [B10.5] (ImplicitCastExpr, NoOp, const class A)
821// CHECK: 7: [B10.6].operator int
822// CHECK: 8: [B10.7]()
823// CHECK: 9: [B10.8] (ImplicitCastExpr, UserDefinedConversion, int)
824// CHECK: 10: [B10.9] (ImplicitCastExpr, IntegralToBoolean, _Bool)
825// CHECK: T: for (...; [B10.10]; )
826// CHECK: Preds (2): B2 B11
827// CHECK: Succs (2): B9 B1
Ted Kremenek682060c2011-12-22 23:33:52 +0000828// CHECK: [B11]
829// CHECK: 1: (CXXConstructExpr, class A)
830// CHECK: 2: A a;
831// CHECK: 3: (CXXConstructExpr, class A)
832// CHECK: 4: A b;
833// CHECK: Preds (1): B12
Ted Kremenek3f635c02012-07-14 05:04:10 +0000834// CHECK: Succs (1): B10
Ted Kremenek682060c2011-12-22 23:33:52 +0000835// CHECK: [B0 (EXIT)]
Ted Kremenek3f635c02012-07-14 05:04:10 +0000836// CHECK: Preds (2): B1 B4
Ted Kremenek682060c2011-12-22 23:33:52 +0000837// CHECK: [B3 (ENTRY)]
838// CHECK: Succs (1): B0
839// CHECK: [B1]
840// CHECK: T: try ...
841// CHECK: Succs (2): B2 B0
842// CHECK: [B2]
843// CHECK: catch (const A &e):
Ted Kremenek337e4db2012-03-10 01:34:17 +0000844// CHECK: 1: catch (const A &e) {
845// CHECK: }
Ted Kremenek682060c2011-12-22 23:33:52 +0000846// CHECK: Preds (1): B1
847// CHECK: Succs (1): B0
848// CHECK: [B0 (EXIT)]
849// CHECK: Preds (3): B2 B1 B3
850// CHECK: [B3 (ENTRY)]
851// CHECK: Succs (1): B0
852// CHECK: [B1]
853// CHECK: T: try ...
854// CHECK: Succs (2): B2 B0
855// CHECK: [B2]
856// CHECK: catch (A e):
Ted Kremenek337e4db2012-03-10 01:34:17 +0000857// CHECK: 1: catch (A e) {
858// CHECK: }
859// CHECK: 2: [B2.1].~A() (Implicit destructor)
Ted Kremenek682060c2011-12-22 23:33:52 +0000860// CHECK: Preds (1): B1
861// CHECK: Succs (1): B0
862// CHECK: [B0 (EXIT)]
863// CHECK: Preds (3): B2 B1 B3
Ted Kremenek3f635c02012-07-14 05:04:10 +0000864