blob: cb9a4ef81f139e8b594aa5ccd471280bb75a411d [file] [log] [blame]
Daniel Dunbara5728872009-12-15 20:14:24 +00001// RUN: %clang_cc1 %s -emit-llvm -o %t
Daniel Dunbard5d31802009-02-19 07:15:39 +00002
Chris Lattner58c3f9e2007-12-02 06:27:33 +00003int g();
4
5int foo(int i) {
Mike Stump1eb44332009-09-09 15:08:12 +00006 return g(i);
Chris Lattner58c3f9e2007-12-02 06:27:33 +00007}
8
9int g(int i) {
Mike Stump1eb44332009-09-09 15:08:12 +000010 return g(i);
Chris Lattner58c3f9e2007-12-02 06:27:33 +000011}
12
Chris Lattner05d2fb42008-07-31 04:58:58 +000013// rdar://6110827
14typedef void T(void);
15void test3(T f) {
16 f();
17}
18
Douglas Gregor450da982009-02-16 20:58:07 +000019int a(int);
20int a() {return 1;}
Daniel Dunbard5d31802009-02-19 07:15:39 +000021
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000022// RUN: grep 'define void @f0()' %t
Daniel Dunbard5d31802009-02-19 07:15:39 +000023void f0() {}
24
25void f1();
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000026// RUN: grep 'call void @f1()' %t
Daniel Dunbard5d31802009-02-19 07:15:39 +000027void f2(void) {
28 f1(1, 2, 3);
29}
Daniel Dunbar4fcfde42009-11-08 01:45:36 +000030// RUN: grep 'define void @f1()' %t
Daniel Dunbard5d31802009-02-19 07:15:39 +000031void f1() {}
Chris Lattnerff75e1d2009-03-22 19:35:37 +000032
33// RUN: grep 'define .* @f3' %t | not grep -F '...'
34struct foo { int X, Y, Z; } f3() {
Mike Stumpc36541e2009-07-21 20:52:43 +000035 while (1) {}
Chris Lattnerff75e1d2009-03-22 19:35:37 +000036}
Chris Lattnerd6bebbf2009-06-23 01:38:41 +000037
38// PR4423 - This shouldn't crash in codegen
39void f4() {}
40void f5() { f4(42); }