Home | History | Annotate | Download | only in CodeGen
      1 // RUN: %clang_cc1 %s -triple i386-unknown-unknown -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 int a(int);
     20 int a() {return 1;}
     21 
     22 void f0() {}
     23 // CHECK-LABEL: define void @f0()
     24 
     25 void f1();
     26 void f2(void) {
     27 // CHECK: call void @f1()
     28   f1(1, 2, 3);
     29 }
     30 // CHECK-LABEL: define void @f1()
     31 void f1() {}
     32 
     33 // CHECK: define {{.*}} @f3{{\(\)|\(.*sret.*\)}}
     34 struct foo { int X, Y, Z; } f3() {
     35   while (1) {}
     36 }
     37 
     38 // PR4423 - This shouldn't crash in codegen
     39 void f4() {}
     40 void f5() { f4(42); } //expected-warning {{too many arguments}}
     41 
     42 // Qualifiers on parameter types shouldn't make a difference.
     43 static void f6(const float f, const float g) {
     44 }
     45 void f7(float f, float g) {
     46   f6(f, g);
     47 // CHECK: define void @f7(float{{.*}}, float{{.*}})
     48 // CHECK: call void @f6(float{{.*}}, float{{.*}})
     49 }
     50 
     51 // PR6911 - incomplete function types
     52 struct Incomplete;
     53 void f8_callback(struct Incomplete);
     54 void f8_user(void (*callback)(struct Incomplete));
     55 void f8_test() {
     56   f8_user(&f8_callback);
     57 // CHECK-LABEL: define void @f8_test()
     58 // CHECK: call void @f8_user({{.*}}* bitcast (void ()* @f8_callback to {{.*}}*))
     59 // CHECK: declare void @f8_user({{.*}}*)
     60 // CHECK: declare void @f8_callback()
     61 }
     62 
     63 // PR10204: don't crash
     64 static void test9_helper(void) {}
     65 void test9() {
     66   (void) test9_helper;
     67 }
     68