blob: 10842e8b295d1607be2f7970f1089f1653b82289 [file] [log] [blame]
Douglas Gregor025452f2009-04-17 00:04:06 +00001// Header for PCH test stmts.c
2
3void f0(int x) {
4 // NullStmt
5 ;
6 // IfStmt
7 if (x) {
8 } else if (x + 1) {
9 }
10
11 switch (x) {
12 case 0:
13 x = 17;
14 break;
15
16 case 1:
17 break;
18
19 default:
Douglas Gregor0de9d882009-04-17 16:34:57 +000020 switch (x >> 1) {
21 case 7:
22 // fall through
23 case 9:
24 break;
25 }
26 x += 2;
Douglas Gregor025452f2009-04-17 00:04:06 +000027 break;
28 }
Douglas Gregord921cf92009-04-17 00:16:09 +000029
30 while (x > 20) {
31 if (x > 30) {
32 --x;
33 continue;
Douglas Gregor67d82492009-04-17 00:29:51 +000034 } else if (x < 5)
35 break;
Douglas Gregor1de05fe2009-04-17 18:18:49 +000036 else
37 goto done;
Douglas Gregord921cf92009-04-17 00:16:09 +000038 }
Douglas Gregor67d82492009-04-17 00:29:51 +000039
40 do {
41 x++;
42 } while (x < 10);
43
Douglas Gregor1de05fe2009-04-17 18:18:49 +000044 almost_done:
Douglas Gregor84f21702009-04-17 16:55:36 +000045 for (int y = x; y < 20; ++y) {
46 if (x + y == 12)
Douglas Gregor0de9d882009-04-17 16:34:57 +000047 return;
Douglas Gregor1de05fe2009-04-17 18:18:49 +000048 else if (x - y == 7)
49 goto almost_done;
Douglas Gregor0de9d882009-04-17 16:34:57 +000050 }
Douglas Gregor84f21702009-04-17 16:55:36 +000051
Douglas Gregor1de05fe2009-04-17 18:18:49 +000052 done:
53 x = x + 2;
54
Douglas Gregor84f21702009-04-17 16:55:36 +000055 int z = x, *y, j = 5;
Douglas Gregor0de9d882009-04-17 16:34:57 +000056}
57
58int f1(int x) {
59 switch (x) {
60 case 17:
61 return 12;
62
63 default:
64 break;
65 }
66
67 return x*2;
Douglas Gregor025452f2009-04-17 00:04:06 +000068}
Douglas Gregor84f21702009-04-17 16:55:36 +000069
70const char* what_is_my_name(void) { return __func__; }
Douglas Gregor7d5c2f22009-04-17 18:58:21 +000071
72int computed_goto(int x) {
73 start:
74 x = x << 1;
75 void *location = &&start;
76
77 if (x > 17)
78 location = &&done;
79
80 while (x > 12) {
81 --x;
82 if (x == 15)
83 goto *location;
84 }
85
86 done:
87 return 5;
88}