1 // RUN: %clang_cc1 -no-opaque-pointers %s -triple i386-unknown-unknown -Wno-strict-prototypes -emit-llvm -o - -verify | FileCheck %s 2 3 int g(); 4 5 int foo(int i) { 6 return g(i); 7 } 8 9 int g(int i) { 10 return g(i); 11 } 12 13 // rdar://6110827 14 typedef void T(void); 15 void test3(T f) { 16 f(); 17 } 18 19 void f0(void) {} 20 // CHECK-LABEL: define{{.*}} void @f0() 21 22 void f1(); 23 void f2(void) { 24 // CHECK: call void @f1() 25 f1(1, 2, 3); 26 } 27 // CHECK-LABEL: define{{.*}} void @f1() 28 void f1() {} 29 30 // CHECK: define {{.*}} @f3{{\(\)|\(.*sret.*\)}} 31 struct foo { int X, Y, Z; } f3(void) { 32 while (1) {} 33 } 34 35 // PR4423 - This shouldn't crash in codegen 36 void f4() {} 37 void f5(void) { f4(42); } //expected-warning {{too many arguments}} 38 39 // Qualifiers on parameter types shouldn't make a difference. 40 static void f6(const float f, const float g) { 41 } 42 void f7(float f, float g) { 43 f6(f, g); 44 // CHECK: define{{.*}} void @f7(float{{.*}}, float{{.*}}) 45 // CHECK: call void @f6(float{{.*}}, float{{.*}}) 46 } 47 48 // PR6911 - incomplete function types 49 struct Incomplete; 50 void f8_callback(struct Incomplete); 51 void f8_user(void (*callback)(struct Incomplete)); 52 void f8_test(void) { 53 f8_user(&f8_callback); 54 // CHECK-LABEL: define{{.*}} void @f8_test() 55 // CHECK: call void @f8_user({{.*}}* noundef bitcast (void ()* @f8_callback to {{.*}}*)) 56 // CHECK: declare void @f8_user({{.*}}* noundef) 57 // CHECK: declare void @f8_callback() 58 } 59 60 // PR10204: don't crash 61 static void test9_helper(void) {} 62 void test9(void) { 63 (void) test9_helper; 64 } 65