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