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.
13 extern __unknown_anytype test0_any
;
14 // COMMON: load i32, ptr @test0_any
15 return (int) test0_any
;
19 extern __unknown_anytype
test1_any();
20 // COMMON: call noundef i32 @_Z9test1_anyv()
21 return (int) test1_any();
24 extern "C" __unknown_anytype
test2_any(...);
26 // X86_64: call float (double, ...) @test2_any(double {{[^,]+}})
27 // I386: call float (double, ...) @test2_any(double {{[^,]+}})
28 return (float) test2_any(0.5f
);
31 extern "C" __unknown_anytype
test2a_any(...);
33 // X86_64: call float (float, ...) @test2a_any(float {{[^,]+}})
34 // I386: call float (float, ...) @test2a_any(float {{[^,]+}})
35 return (float) test2a_any((float) 0.5f
);
39 extern __unknown_anytype test3_any
;
40 // COMMON: [[FN:%.*]] = load ptr, ptr @test3_any,
41 // COMMON: call noundef float [[FN]](i32 noundef 5)
42 return ((float(*)(int)) test3_any
)(5);
46 extern __unknown_anytype test4_any1
;
47 extern __unknown_anytype test4_any2
;
50 // COMMON: load i32, ptr @_ZN5test410test4_any1E
51 // COMMON: load i8, ptr @_ZN5test410test4_any2E
52 return (int) test4_any1
+ (char) test4_any2
;
56 extern "C" __unknown_anytype
test5_any();
58 // COMMON: call void @test5_any()
59 return (void) test5_any();
62 extern "C" __unknown_anytype
test6_any(float *);
64 // COMMON: call i64 @test6_any(ptr noundef null)
65 return (long long) test6_any(0);
71 extern "C" __unknown_anytype
test7_any(int);
73 // COMMON: call void @test7_any(ptr dead_on_unwind writable sret({{%.*}}) align 1 {{%.*}}, i32 noundef 5)
74 return (Test7
) test7_any(5);
78 __unknown_anytype
foo();
79 __unknown_anytype
foo(int);
85 // COMMON: call noundef i32 @_ZN5Test83fooEv(
87 // COMMON: call noundef i32 @_ZN5Test83fooEi(
89 // COMMON: call noundef i32 @_ZN5Test83fooEv(
90 f
= (float) this->foo();
91 // COMMON: call noundef i32 @_ZN5Test83fooEi(
92 f
= (float) this->foo(5);
94 void test8(Test8
*p
) {
96 // COMMON: call noundef i32 @_ZN5Test83fooEv(
97 d
= (double) p
->foo();
98 // COMMON: call noundef i32 @_ZN5Test83fooEi(
99 d
= (double) p
->foo(5);
100 // COMMON: call noundef i32 @_ZN5Test83fooEv(
101 d
= (bool) (*p
).foo();
102 // COMMON: call noundef i32 @_ZN5Test83fooEi(
103 d
= (bool) (*p
).foo(5);
106 extern "C" __unknown_anytype test9_foo
;
108 // COMMON: ret ptr @test9_foo
109 return (int*) &test9_foo
;
112 // Don't explode on this.
113 extern "C" __unknown_anytype
test10_any(...);
115 (void) test10_any(), (void) test10_any();
118 extern "C" __unknown_anytype
malloc(...);
120 void *s
= (void*)malloc(12);
121 // COMMON: call ptr (i32, ...) @malloc(i32 noundef 12)
122 void *d
= (void*)malloc(435);
123 // COMMON: call ptr (i32, ...) @malloc(i32 noundef 435)