2011-09-21 16:08:30 +08:00
|
|
|
// RUN: %clang_cc1 %s -triple i386-unknown-unknown -emit-llvm -o - -verify | FileCheck %s
|
2009-02-19 15:15:39 +08:00
|
|
|
|
2007-12-02 14:27:33 +08:00
|
|
|
int g();
|
|
|
|
|
|
|
|
int foo(int i) {
|
2009-09-09 23:08:12 +08:00
|
|
|
return g(i);
|
2007-12-02 14:27:33 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
int g(int i) {
|
2009-09-09 23:08:12 +08:00
|
|
|
return g(i);
|
2007-12-02 14:27:33 +08:00
|
|
|
}
|
|
|
|
|
2008-07-31 12:58:58 +08:00
|
|
|
// rdar://6110827
|
|
|
|
typedef void T(void);
|
|
|
|
void test3(T f) {
|
|
|
|
f();
|
|
|
|
}
|
|
|
|
|
2009-02-17 04:58:07 +08:00
|
|
|
int a(int);
|
|
|
|
int a() {return 1;}
|
2009-02-19 15:15:39 +08:00
|
|
|
|
|
|
|
void f0() {}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @f0()
|
2009-02-19 15:15:39 +08:00
|
|
|
|
|
|
|
void f1();
|
|
|
|
void f2(void) {
|
2012-12-13 06:21:47 +08:00
|
|
|
// CHECK: call void @f1()
|
2009-02-19 15:15:39 +08:00
|
|
|
f1(1, 2, 3);
|
|
|
|
}
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @f1()
|
2009-02-19 15:15:39 +08:00
|
|
|
void f1() {}
|
2009-03-23 03:35:37 +08:00
|
|
|
|
2010-02-24 16:14:27 +08:00
|
|
|
// CHECK: define {{.*}} @f3{{\(\)|\(.*sret.*\)}}
|
2009-03-23 03:35:37 +08:00
|
|
|
struct foo { int X, Y, Z; } f3() {
|
2009-07-22 04:52:43 +08:00
|
|
|
while (1) {}
|
2009-03-23 03:35:37 +08:00
|
|
|
}
|
2009-06-23 09:38:41 +08:00
|
|
|
|
|
|
|
// PR4423 - This shouldn't crash in codegen
|
|
|
|
void f4() {}
|
2010-02-24 15:33:39 +08:00
|
|
|
void f5() { f4(42); } //expected-warning {{too many arguments}}
|
2010-02-24 15:14:12 +08:00
|
|
|
|
|
|
|
// Qualifiers on parameter types shouldn't make a difference.
|
|
|
|
static void f6(const float f, const float g) {
|
|
|
|
}
|
|
|
|
void f7(float f, float g) {
|
|
|
|
f6(f, g);
|
|
|
|
// CHECK: define void @f7(float{{.*}}, float{{.*}})
|
|
|
|
// CHECK: call void @f6(float{{.*}}, float{{.*}})
|
|
|
|
}
|
2010-04-28 08:00:30 +08:00
|
|
|
|
|
|
|
// PR6911 - incomplete function types
|
|
|
|
struct Incomplete;
|
|
|
|
void f8_callback(struct Incomplete);
|
|
|
|
void f8_user(void (*callback)(struct Incomplete));
|
|
|
|
void f8_test() {
|
|
|
|
f8_user(&f8_callback);
|
2013-08-15 14:47:53 +08:00
|
|
|
// CHECK-LABEL: define void @f8_test()
|
2010-04-28 08:00:30 +08:00
|
|
|
// CHECK: call void @f8_user({{.*}}* bitcast (void ()* @f8_callback to {{.*}}*))
|
|
|
|
// CHECK: declare void @f8_user({{.*}}*)
|
|
|
|
// CHECK: declare void @f8_callback()
|
|
|
|
}
|
2011-06-28 06:57:05 +08:00
|
|
|
|
|
|
|
// PR10204: don't crash
|
|
|
|
static void test9_helper(void) {}
|
|
|
|
void test9() {
|
|
|
|
(void) test9_helper;
|
|
|
|
}
|