Daniel Dunbar | d7d5f02 | 2009-03-24 02:24:46 +0000 | [diff] [blame] | 1 | // RUN: clang-cc %s -emit-llvm -o - |
Devang Patel | a2c5342 | 2007-10-09 20:37:41 +0000 | [diff] [blame] | 2 | |
3 | int bar(); | ||||
Chris Lattner | 1e9660e | 2008-07-25 23:40:10 +0000 | [diff] [blame] | 4 | int test0() { |
Devang Patel | a2c5342 | 2007-10-09 20:37:41 +0000 | [diff] [blame] | 5 | int i; |
6 | i = 1 + 2; | ||||
7 | do { | ||||
8 | i = bar(); | ||||
9 | i = bar(); | ||||
10 | } while(0); | ||||
11 | return i; | ||||
12 | } | ||||
13 | |||||
14 | |||||
Chris Lattner | 1e9660e | 2008-07-25 23:40:10 +0000 | [diff] [blame] | 15 | int test1() { |
Devang Patel | a2c5342 | 2007-10-09 20:37:41 +0000 | [diff] [blame] | 16 | int i; |
17 | i = 1 + 2; | ||||
18 | do { | ||||
19 | i = bar(); | ||||
20 | if (i == 42) | ||||
21 | break; | ||||
22 | i = bar(); | ||||
23 | } while(1); | ||||
24 | return i; | ||||
25 | } | ||||
26 | |||||
27 | |||||
Chris Lattner | 1e9660e | 2008-07-25 23:40:10 +0000 | [diff] [blame] | 28 | int test2() { |
Devang Patel | a2c5342 | 2007-10-09 20:37:41 +0000 | [diff] [blame] | 29 | int i; |
30 | i = 1 + 2; | ||||
31 | do { | ||||
32 | i = bar(); | ||||
33 | if (i == 42) | ||||
34 | continue; | ||||
35 | i = bar(); | ||||
36 | } while(1); | ||||
37 | return i; | ||||
38 | } | ||||
39 | |||||
40 | |||||
Chris Lattner | 1e9660e | 2008-07-25 23:40:10 +0000 | [diff] [blame] | 41 | int test3() { |
Devang Patel | a2c5342 | 2007-10-09 20:37:41 +0000 | [diff] [blame] | 42 | int i; |
43 | i = 1 + 2; | ||||
44 | do { | ||||
45 | i = bar(); | ||||
46 | if (i == 42) | ||||
47 | break; | ||||
48 | } while(0); | ||||
49 | return i; | ||||
50 | } | ||||
51 | |||||
52 | |||||
Chris Lattner | 1e9660e | 2008-07-25 23:40:10 +0000 | [diff] [blame] | 53 | int test4() { |
Devang Patel | a2c5342 | 2007-10-09 20:37:41 +0000 | [diff] [blame] | 54 | int i; |
55 | i = 1 + 2; | ||||
56 | do { | ||||
57 | i = bar(); | ||||
58 | if (i == 42) | ||||
59 | continue; | ||||
60 | } while(0); | ||||
61 | return i; | ||||
62 | } | ||||
Chris Lattner | 1e9660e | 2008-07-25 23:40:10 +0000 | [diff] [blame] | 63 | |
64 | // rdar://6103124 | ||||
65 | void test5() { | ||||
66 | do { break; } while(0); | ||||
67 | } | ||||
68 | |||||
69 | |||||
70 |