1 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -no-opaque-pointers -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NF
4 // Most of this test is apparently just verifying that we don't crash.
6 int printf(const char *, ...);
19 +(void) printThisInt: (int) arg0 andThatFloat: (float) arg1 andADouble: (double) arg2 andAPoint: (MyPoint) arg3;
20 +(float) returnAFloat;
21 +(double) returnADouble;
22 +(MyPoint) returnAPoint;
23 +(void) printThisSize: (MySize) arg0;
24 +(MySize) returnASize;
26 -(void) printThisInt: (int) arg0 andThatFloat: (float) arg1 andADouble: (double) arg2 andAPoint: (MyPoint) arg3;
27 -(float) returnAFloat;
28 -(double) returnADouble;
29 -(MyPoint) returnAPoint;
30 -(void) printThisSize: (MySize) arg0;
31 -(MySize) returnASize;
37 +(void) printThisInt: (int) arg0 andThatFloat: (float) arg1 andADouble: (double) arg2 andAPoint: (MyPoint) arg3 {
38 printf("(CLASS) theInt: %d, theFloat: %f, theDouble: %f, thePoint: { %d, %d }\n",
39 arg0, arg1, arg2, arg3.x, arg3.y);
41 +(float) returnAFloat {
44 +(double) returnADouble {
47 +(MyPoint) returnAPoint {
48 MyPoint x = { 35, 45 };
51 +(void) printThisSize: (MySize) arg0 {
52 printf("(CLASS) theSize: { %f, %f }\n",
53 arg0.width, arg0.height);
55 +(MySize) returnASize {
56 MySize x = { 32, 44 };
60 -(void) printThisInt: (int) arg0 andThatFloat: (float) arg1 andADouble: (double) arg2 andAPoint: (MyPoint) arg3 {
61 printf("theInt: %d, theFloat: %f, theDouble: %f, thePoint: { %d, %d }\n",
62 arg0, arg1, arg2, arg3.x, arg3.y);
64 -(float) returnAFloat {
67 -(double) returnADouble {
70 -(MyPoint) returnAPoint {
71 MyPoint x = { 30, 40 };
74 -(void) printThisSize: (MySize) arg0 {
75 printf("theSize: { %f, %f }\n",
76 arg0.width, arg0.height);
78 -(MySize) returnASize {
79 MySize x = { 22, 34 };
85 +(void) printThisInt: (int) arg0 andThatFloat: (float) arg1 andADouble: (double) arg2 andAPoint: (MyPoint) arg3 {
88 [ super printThisInt: arg0*2 andThatFloat: arg1*2 andADouble: arg2*2 andAPoint: arg3 ];
90 +(void) printThisSize: (MySize) arg0 {
93 [ super printThisSize: arg0 ];
95 +(float) returnAFloat {
96 return [ super returnAFloat ]*2;
98 +(double) returnADouble {
99 return [ super returnADouble ]*2;
101 +(MyPoint) returnAPoint {
102 MyPoint x = [ super returnAPoint ];
107 +(MySize) returnASize {
108 MySize x = [ super returnASize ];
114 -(void) printThisInt: (int) arg0 andThatFloat: (float) arg1 andADouble: (double) arg2 andAPoint: (MyPoint) arg3 {
117 [ super printThisInt: arg0*2 andThatFloat: arg1*2 andADouble: arg2*2 andAPoint: arg3 ];
119 -(void) printThisSize: (MySize) arg0 {
122 [ super printThisSize: arg0 ];
124 -(float) returnAFloat {
125 return [ super returnAFloat ]*2;
127 -(double) returnADouble {
128 return [ super returnADouble ]*2;
130 -(MyPoint) returnAPoint {
131 MyPoint x = [ super returnAPoint ];
136 -(MySize) returnASize {
137 MySize x = [ super returnASize ];
142 -(const float) returnAConstFloat {
147 // rdar://problem/7854674
148 // CHECK: define{{.*}} void @test0([[A:%.*]]*
149 // CHECK-NF: define{{.*}} void @test0([[A:%.*]]*
151 // CHECK: [[X:%.*]] = alloca [[A]]*
152 // CHECK-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]],
153 // CHECK: [[T0:%.*]] = load [[A]]*, [[A]]** [[X]]
154 // CHECK: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8*
155 // CHECK-NEXT: icmp eq i8* [[T1]], null
157 // CHECK: call {{.*}} @objc_msgSend_stret to
158 // CHECK-NEXT: br label
159 // CHECK: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8*
160 // CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[T0]], i8 0, i64 48, i1 false)
161 // CHECK-NEXT: br label
163 // CHECK-NF: [[X:%.*]] = alloca [[A]]*
164 // CHECK-NF-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]],
165 // CHECK-NF: [[T0:%.*]] = load [[A]]*, [[A]]** [[X]]
166 // CHECK-NF: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8*
167 // CHECK-NF-NEXT: icmp eq i8* [[T1]], null
168 // CHECK-NF-NEXT: br i1
169 // CHECK-NF: call {{.*}} @objc_msgSend_stret to
170 // CHECK-NF-NEXT: br label
171 // CHECK-NF: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8*
172 // CHECK-NF-NEXT: call void @llvm.memset.p0i8.i64(i8* align 4 [[T0]], i8 0, i64 48, i1 false)
173 // CHECK-NF-NEXT: br label
174 MyPoint point = [x returnAPoint];