blob: 1e79f0150142cbba0a34a8609a71142ae5d8dd8c [file] [log] [blame]
John McCall18269802010-02-24 07:33:39 +00001// RUN: %clang_cc1 %s -emit-llvm -o - -verify | 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 Dunbarf0acf7b2009-02-19 07:15:39 +000022void f0() {}
John McCall18269802010-02-24 07:33:39 +000023// CHECK: define void @f0()
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000024
25void f1();
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000026void f2(void) {
John McCall18269802010-02-24 07:33:39 +000027// CHECK: call void @f1()
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000028 f1(1, 2, 3);
29}
John McCall18269802010-02-24 07:33:39 +000030// CHECK: define void @f1()
Daniel Dunbarf0acf7b2009-02-19 07:15:39 +000031void f1() {}
Chris Lattner75acb0c2009-03-22 19:35:37 +000032
John McCall18269802010-02-24 07:33:39 +000033// CHECK: define {{.*}} @f3()
Chris Lattner75acb0c2009-03-22 19:35:37 +000034struct 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() {}
John McCall18269802010-02-24 07:33:39 +000040void f5() { f4(42); } //expected-warning {{too many arguments}}
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}