blob: d9c87d53edb0510ec5837dcf4a110f6cc4468f1f [file] [log] [blame]
John McCall8ee376f2010-02-24 07:14:12 +00001// RUN: %clang_cc1 %s -emit-llvm -o - | FileCheck %s
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +00002
Chris Lattner41af8182007-12-02 06:27:33 +00003int g();
4
5int foo(int i) {
Mike Stump11289f42009-09-09 15:08:12 +00006 return g(i);
Chris Lattner41af8182007-12-02 06:27:33 +00007}
8
9int g(int i) {
Mike Stump11289f42009-09-09 15:08:12 +000010 return g(i);
Chris Lattner41af8182007-12-02 06:27:33 +000011}
12
Chris Lattner330f0f22008-07-31 04:58:58 +000013// rdar://6110827
14typedef void T(void);
15void test3(T f) {
16 f();
17}
18
Douglas Gregorbfdd6072009-02-16 20:58:07 +000019int a(int);
20int a() {return 1;}
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000021
Daniel Dunbar8b576972009-11-08 01:45:36 +000022// RUN: grep 'define void @f0()' %t
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000023void f0() {}
24
25void f1();
Daniel Dunbar8b576972009-11-08 01:45:36 +000026// RUN: grep 'call void @f1()' %t
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000027void f2(void) {
28 f1(1, 2, 3);
29}
Daniel Dunbar8b576972009-11-08 01:45:36 +000030// RUN: grep 'define void @f1()' %t
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000031void f1() {}
Chris Lattner75acb0c2009-03-22 19:35:37 +000032
33// RUN: grep 'define .* @f3' %t | not grep -F '...'
34struct foo { int X, Y, Z; } f3() {
Mike Stump5e7869f2009-07-21 20:52:43 +000035 while (1) {}
Chris Lattner75acb0c2009-03-22 19:35:37 +000036}
Chris Lattner4c8da962009-06-23 01:38:41 +000037
38// PR4423 - This shouldn't crash in codegen
39void f4() {}
40void f5() { f4(42); }
John McCall8ee376f2010-02-24 07:14:12 +000041
42// Qualifiers on parameter types shouldn't make a difference.
43static void f6(const float f, const float g) {
44}
45void f7(float f, float g) {
46 f6(f, g);
47// CHECK: define void @f7(float{{.*}}, float{{.*}})
48// CHECK: call void @f6(float{{.*}}, float{{.*}})
49}