1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -funknown-anytype -emit-llvm -o %t %s
2 // RUN: FileCheck -check-prefix COMMON %s < %t
3 // RUN: FileCheck -check-prefix X86_64 %s < %t
4 // RUN: %clang_cc1 -triple i386-apple-darwin10 -funknown-anytype -emit-llvm -o %t %s
5 // RUN: FileCheck -check-prefix COMMON %s < %t
6 // RUN: FileCheck -check-prefix I386 %s < %t
8 // x86-64 is the special case here because of its variadic convention.
9 // We want to ensure that it always uses a variadic convention even if
10 // other platforms do not.
14 extern __unknown_anytype test0_any
;
15 // COMMON: load i32, i32* @test0_any
16 return (int) test0_any
;
20 extern __unknown_anytype
test1_any();
21 // COMMON: call noundef i32 @_Z9test1_anyv()
22 return (int) test1_any();
25 extern "C" __unknown_anytype
test2_any(...);
27 // X86_64: call float (double, ...) @test2_any(double {{[^,]+}})
28 // I386: call float (double, ...) @test2_any(double {{[^,]+}})
29 return (float) test2_any(0.5f
);
32 extern "C" __unknown_anytype
test2a_any(...);
34 // X86_64: call float (float, ...) @test2a_any(float {{[^,]+}})
35 // I386: call float (float, ...) @test2a_any(float {{[^,]+}})
36 return (float) test2a_any((float) 0.5f
);
40 extern __unknown_anytype test3_any
;
41 // COMMON: [[FN:%.*]] = load float (i32)*, float (i32)** @test3_any,
42 // COMMON: call noundef float [[FN]](i32 noundef 5)
43 return ((float(*)(int)) test3_any
)(5);
47 extern __unknown_anytype test4_any1
;
48 extern __unknown_anytype test4_any2
;
51 // COMMON: load i32, i32* @_ZN5test410test4_any1E
52 // COMMON: load i8, i8* @_ZN5test410test4_any2E
53 return (int) test4_any1
+ (char) test4_any2
;
57 extern "C" __unknown_anytype
test5_any();
59 // COMMON: call void @test5_any()
60 return (void) test5_any();
63 extern "C" __unknown_anytype
test6_any(float *);
65 // COMMON: call i64 @test6_any(float* noundef null)
66 return (long long) test6_any(0);
72 extern "C" __unknown_anytype
test7_any(int);
74 // COMMON: call void @test7_any({{%.*}}* sret({{%.*}}) align 1 {{%.*}}, i32 noundef 5)
75 return (Test7
) test7_any(5);
79 __unknown_anytype
foo();
80 __unknown_anytype
foo(int);
86 // COMMON: call noundef i32 @_ZN5Test83fooEv(
88 // COMMON: call noundef i32 @_ZN5Test83fooEi(
90 // COMMON: call noundef i32 @_ZN5Test83fooEv(
91 f
= (float) this->foo();
92 // COMMON: call noundef i32 @_ZN5Test83fooEi(
93 f
= (float) this->foo(5);
95 void test8(Test8
*p
) {
97 // COMMON: call noundef i32 @_ZN5Test83fooEv(
98 d
= (double) p
->foo();
99 // COMMON: call noundef i32 @_ZN5Test83fooEi(
100 d
= (double) p
->foo(5);
101 // COMMON: call noundef i32 @_ZN5Test83fooEv(
102 d
= (bool) (*p
).foo();
103 // COMMON: call noundef i32 @_ZN5Test83fooEi(
104 d
= (bool) (*p
).foo(5);
107 extern "C" __unknown_anytype test9_foo
;
109 // COMMON: ret i8* bitcast (i32* @test9_foo to i8*)
110 return (int*) &test9_foo
;
113 // Don't explode on this.
114 extern "C" __unknown_anytype
test10_any(...);
116 (void) test10_any(), (void) test10_any();
119 extern "C" __unknown_anytype
malloc(...);
121 void *s
= (void*)malloc(12);
122 // COMMON: call i8* (i32, ...) @malloc(i32 noundef 12)
123 void *d
= (void*)malloc(435);
124 // COMMON: call i8* (i32, ...) @malloc(i32 noundef 435)