1// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - -verify | FileCheck %s
2
3int g();
4
5int foo(int i) {
6  return g(i);
7}
8
9int g(int i) {
10  return g(i);
11}
12
13// rdar://6110827
14typedef void T(void);
15void test3(T f) {
16  f();
17}
18
19int a(int);
20int a() {return 1;}
21
22void f0() {}
23// CHECK: define void @f0()
24
25void f1();
26void f2(void) {
27// CHECK: call void @f1()
28  f1(1, 2, 3);
29}
30// CHECK: define void @f1()
31void f1() {}
32
33// CHECK: define {{.*}} @f3{{\(\)|\(.*sret.*\)}}
34struct foo { int X, Y, Z; } f3() {
35  while (1) {}
36}
37
38// PR4423 - This shouldn't crash in codegen
39void f4() {}
40void f5() { f4(42); } //expected-warning {{too many arguments}}
41
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}
50
51// PR6911 - incomplete function types
52struct Incomplete;
53void f8_callback(struct Incomplete);
54void f8_user(void (*callback)(struct Incomplete));
55void f8_test() {
56  f8_user(&f8_callback);
57// CHECK: 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
64static void test9_helper(void) {}
65void test9() {
66  (void) test9_helper;
67}
68