xref: /minix3/external/bsd/llvm/dist/clang/test/CodeGen/dostmt.c (revision f4a2713ac843a11c696ec80c0a5e3e5d80b4d338)
1*f4a2713aSLionel Sambuc // RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
2*f4a2713aSLionel Sambuc 
3*f4a2713aSLionel Sambuc int bar();
test0()4*f4a2713aSLionel Sambuc int test0() {
5*f4a2713aSLionel Sambuc   int i;
6*f4a2713aSLionel Sambuc   i = 1 + 2;
7*f4a2713aSLionel Sambuc   do {
8*f4a2713aSLionel Sambuc     i = bar();
9*f4a2713aSLionel Sambuc     i = bar();
10*f4a2713aSLionel Sambuc   } while(0);
11*f4a2713aSLionel Sambuc   return i;
12*f4a2713aSLionel Sambuc }
13*f4a2713aSLionel Sambuc 
14*f4a2713aSLionel Sambuc 
test1()15*f4a2713aSLionel Sambuc int test1() {
16*f4a2713aSLionel Sambuc   int i;
17*f4a2713aSLionel Sambuc   i = 1 + 2;
18*f4a2713aSLionel Sambuc   do {
19*f4a2713aSLionel Sambuc     i = bar();
20*f4a2713aSLionel Sambuc     if (i == 42)
21*f4a2713aSLionel Sambuc       break;
22*f4a2713aSLionel Sambuc     i = bar();
23*f4a2713aSLionel Sambuc   } while(1);
24*f4a2713aSLionel Sambuc   return i;
25*f4a2713aSLionel Sambuc }
26*f4a2713aSLionel Sambuc 
27*f4a2713aSLionel Sambuc 
test2()28*f4a2713aSLionel Sambuc int test2() {
29*f4a2713aSLionel Sambuc   int i;
30*f4a2713aSLionel Sambuc   i = 1 + 2;
31*f4a2713aSLionel Sambuc   do {
32*f4a2713aSLionel Sambuc     i = bar();
33*f4a2713aSLionel Sambuc     if (i == 42)
34*f4a2713aSLionel Sambuc       continue;
35*f4a2713aSLionel Sambuc     i = bar();
36*f4a2713aSLionel Sambuc   } while(1);
37*f4a2713aSLionel Sambuc   return i;
38*f4a2713aSLionel Sambuc }
39*f4a2713aSLionel Sambuc 
40*f4a2713aSLionel Sambuc 
test3()41*f4a2713aSLionel Sambuc int test3() {
42*f4a2713aSLionel Sambuc   int i;
43*f4a2713aSLionel Sambuc   i = 1 + 2;
44*f4a2713aSLionel Sambuc   do {
45*f4a2713aSLionel Sambuc     i = bar();
46*f4a2713aSLionel Sambuc     if (i == 42)
47*f4a2713aSLionel Sambuc       break;
48*f4a2713aSLionel Sambuc   } while(0);
49*f4a2713aSLionel Sambuc   return i;
50*f4a2713aSLionel Sambuc }
51*f4a2713aSLionel Sambuc 
52*f4a2713aSLionel Sambuc 
test4()53*f4a2713aSLionel Sambuc int test4() {
54*f4a2713aSLionel Sambuc   int i;
55*f4a2713aSLionel Sambuc   i = 1 + 2;
56*f4a2713aSLionel Sambuc   do {
57*f4a2713aSLionel Sambuc     i = bar();
58*f4a2713aSLionel Sambuc     if (i == 42)
59*f4a2713aSLionel Sambuc       continue;
60*f4a2713aSLionel Sambuc   } while(0);
61*f4a2713aSLionel Sambuc   return i;
62*f4a2713aSLionel Sambuc }
63*f4a2713aSLionel Sambuc 
64*f4a2713aSLionel Sambuc // rdar://6103124
test5()65*f4a2713aSLionel Sambuc void test5() {
66*f4a2713aSLionel Sambuc   do { break; } while(0);
67*f4a2713aSLionel Sambuc }
68*f4a2713aSLionel Sambuc 
69*f4a2713aSLionel Sambuc // PR14191
70*f4a2713aSLionel Sambuc void test6f(void);
test6()71*f4a2713aSLionel Sambuc void test6() {
72*f4a2713aSLionel Sambuc   do {
73*f4a2713aSLionel Sambuc   } while (test6f(), 0);
74*f4a2713aSLionel Sambuc   // CHECK: call void @test6f()
75*f4a2713aSLionel Sambuc }
76*f4a2713aSLionel Sambuc 
77