diff options
author | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-28 19:55:59 +0000 |
---|---|---|
committer | Fariborz Jahanian <fjahanian@apple.com> | 2011-02-28 19:55:59 +0000 |
commit | 3d04a0e534b43504f6879657d47891625bd63352 (patch) | |
tree | 9401192733febe9c306f17095a888004a1130548 /test | |
parent | c4d2c9074be6eb2091086eddd6c8f052f3b245c8 (diff) |
objc IRGen for Next runtime message API.
The prototype for objc_msgSend() is technically variadic -
`id objc_msgSend(id, SEL, ...)`.
But all method calls should use a prototype that matches the method,
not the prototype for objc_msgSend itself().
// rdar://9048030
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@126678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r-- | test/CodeGenObjC/fpret.m | 18 | ||||
-rw-r--r-- | test/CodeGenObjC/nonvararg-messaging-call.m | 18 | ||||
-rw-r--r-- | test/CodeGenObjC/property-type-mismatch.m | 4 | ||||
-rw-r--r-- | test/CodeGenObjC/property.m | 8 | ||||
-rw-r--r-- | test/CodeGenObjC/variadic-sends.m | 20 | ||||
-rw-r--r-- | test/CodeGenObjCXX/property-dot-reference.mm | 6 | ||||
-rw-r--r-- | test/CodeGenObjCXX/property-object-conditional-exp.mm | 2 |
7 files changed, 47 insertions, 29 deletions
diff --git a/test/CodeGenObjC/fpret.m b/test/CodeGenObjC/fpret.m index 48848885c1..015a042756 100644 --- a/test/CodeGenObjC/fpret.m +++ b/test/CodeGenObjC/fpret.m @@ -15,21 +15,21 @@ // CHECK-X86_32: define void @t0() -// CHECK-X86_32: call float bitcast {{.*}} @objc_msgSend_fpret to -// CHECK-X86_32: call double {{.*}} @objc_msgSend_fpret( -// CHECK-X86_32: call x86_fp80 bitcast {{.*}} @objc_msgSend_fpret to +// CHECK-X86_32: call float bitcast (double (i8*, i8*)* @objc_msgSend_fpret to +// CHECK-X86_32: call double @objc_msgSend_fpret( +// CHECK-X86_32: call x86_fp80 bitcast (double (i8*, i8*)* @objc_msgSend_fpret to // CHECK-X86_32: } // // CHECK-X86_64: define void @t0() -// CHECK-X86_64: call float bitcast {{.*}} @objc_msgSend to -// CHECK-X86_64: call double bitcast {{.*}} @objc_msgSend to -// CHECK-X86_64: call x86_fp80 bitcast {{.*}} @objc_msgSend_fpret to +// CHECK-X86_64: call float bitcast (i8* (i8*, i8*)* @objc_msgSend to +// CHECK-X86_64: call double bitcast (i8* (i8*, i8*)* @objc_msgSend to +// CHECK-X86_64: call x86_fp80 bitcast (double (i8*, i8*)* @objc_msgSend_fpret to // CHECK-X86_64: } // // CHECK-ARMV7: define void @t0() -// CHECK-ARMV7: call float bitcast {{.*}} @objc_msgSend to -// CHECK-ARMV7: call double bitcast {{.*}} @objc_msgSend to -// CHECK-ARMV7: call double bitcast {{.*}} @objc_msgSend to +// CHECK-ARMV7: call float bitcast (i8* (i8*, i8*)* @objc_msgSend to +// CHECK-ARMV7: call double bitcast (i8* (i8*, i8*)* @objc_msgSend to +// CHECK-ARMV7: call double bitcast (i8* (i8*, i8*)* @objc_msgSend to // CHECK-ARMV7: } void t0() { [(A*)0 floatValue]; diff --git a/test/CodeGenObjC/nonvararg-messaging-call.m b/test/CodeGenObjC/nonvararg-messaging-call.m new file mode 100644 index 0000000000..fecfdac0ea --- /dev/null +++ b/test/CodeGenObjC/nonvararg-messaging-call.m @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s +// rdar://9048030 + +@interface Foo ++(id)alloc; +-(id)init; +-(id)self; +-(id)retain; +-(void)release; +-(id)autorelease; +@end + +void test(void) +{ + [[[[[[Foo alloc] init] retain] autorelease] self] release]; +} + +// CHECK-NOT: call i8* (i8*, i8*, ...)* @objc_msgSend diff --git a/test/CodeGenObjC/property-type-mismatch.m b/test/CodeGenObjC/property-type-mismatch.m index 7045947b1a..9cccdede97 100644 --- a/test/CodeGenObjC/property-type-mismatch.m +++ b/test/CodeGenObjC/property-type-mismatch.m @@ -10,8 +10,8 @@ void bar(Foo *x) { x.myfo++; } -// CHECK: [[C1:%.*]] = call float bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: [[C1:%.*]] = call float bitcast (i8* (i8*, i8*)* @objc_msgSend // CHECK: [[I:%.*]] = fadd float [[C1]], 1.000000e+00 // CHECK: [[CONV:%.*]] = fptosi float [[I]] to i32 // CHECK: [[T3:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_2" -// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: call void bitcast (i8* (i8*, i8*)* @objc_msgSend diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m index dd0786eb30..8ffcc00697 100644 --- a/test/CodeGenObjC/property.m +++ b/test/CodeGenObjC/property.m @@ -60,21 +60,21 @@ void test2() { // CHECK: [[BASE:%.*]] = call [[A:%.*]]* @test2_helper() // CHECK-NEXT: [[SEL:%.*]] = load i8** // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[BASETMP]], i8* [[SEL]]) + // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[BASETMP]], i8* [[SEL]]) // CHECK-NEXT: [[ADD:%.*]] = add nsw i32 [[LD]], 1 // CHECK-NEXT: [[SEL:%.*]] = load i8** // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* [[BASETMP]], i8* [[SEL]], i32 [[ADD]]) + // CHECK-NEXT: call void bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* [[BASETMP]], i8* [[SEL]], i32 [[ADD]]) test2_helper().dyn++; // CHECK: [[BASE:%.*]] = call [[A]]* @test2_helper() // CHECK-NEXT: [[SEL:%.*]] = load i8** // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[BASETMP]], i8* [[SEL]]) + // CHECK-NEXT: [[LD:%.*]] = call i32 bitcast (i8* (i8*, i8*)* @objc_msgSend to i32 (i8*, i8*)*)(i8* [[BASETMP]], i8* [[SEL]]) // CHECK-NEXT: [[ADD:%.*]] = mul nsw i32 [[LD]], 10 // CHECK-NEXT: [[SEL:%.*]] = load i8** // CHECK-NEXT: [[BASETMP:%.*]] = bitcast [[A]]* [[BASE]] to i8* - // CHECK-NEXT: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* [[BASETMP]], i8* [[SEL]], i32 [[ADD]]) + // CHECK-NEXT: call void bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*, i32)*)(i8* [[BASETMP]], i8* [[SEL]], i32 [[ADD]]) test2_helper().dyn *= 10; } diff --git a/test/CodeGenObjC/variadic-sends.m b/test/CodeGenObjC/variadic-sends.m index ea13823bc7..083a8568b9 100644 --- a/test/CodeGenObjC/variadic-sends.m +++ b/test/CodeGenObjC/variadic-sends.m @@ -8,33 +8,33 @@ @end void f0(A *a) { - // CHECK-X86-32: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*)*) - // CHECK-X86-64: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*)*) + // CHECK-X86-32: call void bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*)*) + // CHECK-X86-64: call void bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*)*) [a im0]; } void f1(A *a) { - // CHECK-X86-32: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*) - // CHECK-X86-64: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32)*) + // CHECK-X86-32: call void bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*, i32)*) + // CHECK-X86-64: call void bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*, i32)*) [a im1: 1]; } void f2(A *a) { - // CHECK-X86-32: call void (i8*, i8*, i32, i32, ...)* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32, i32, ...)*) - // CHECK-X86-64: call void (i8*, i8*, i32, i32, ...)* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, i32, i32, ...)*) + // CHECK-X86-32: call void (i8*, i8*, i32, i32, ...)* bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*, i32, i32, ...)*) + // CHECK-X86-64: call void (i8*, i8*, i32, i32, ...)* bitcast (i8* (i8*, i8*)* @objc_msgSend to void (i8*, i8*, i32, i32, ...)*) [a im2: 1, 2]; } @interface B : A @end @implementation B : A -(void) foo { - // CHECK-X86-32: call void bitcast (i8* (%struct._objc_method_description*, i8*, ...)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32)*) - // CHECK-X86-64: call void bitcast (i8* (%struct._objc_method_description*, i8*, ...)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32)*) + // CHECK-X86-32: call void bitcast (i8* (%struct._objc_method_description*, i8*)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32)*) + // CHECK-X86-64: call void bitcast (i8* (%struct._objc_method_description*, i8*)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32)*) [super im1: 1]; } -(void) bar { - // CHECK-X86-32: call void (%struct._objc_method_description*, i8*, i32, i32, ...)* bitcast (i8* (%struct._objc_method_description*, i8*, ...)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32, i32, ...)*) - // CHECK-X86-64: call void (%struct._objc_method_description*, i8*, i32, i32, ...)* bitcast (i8* (%struct._objc_method_description*, i8*, ...)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32, i32, ...)*) + // CHECK-X86-32: call void (%struct._objc_method_description*, i8*, i32, i32, ...)* bitcast (i8* (%struct._objc_method_description*, i8*)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32, i32, ...)*) + // CHECK-X86-64: call void (%struct._objc_method_description*, i8*, i32, i32, ...)* bitcast (i8* (%struct._objc_method_description*, i8*)* @objc_msgSendSuper to void (%struct._objc_method_description*, i8*, i32, i32, ...)*) [super im2: 1, 2]; } diff --git a/test/CodeGenObjCXX/property-dot-reference.mm b/test/CodeGenObjCXX/property-dot-reference.mm index 6b53639f54..820525c9ca 100644 --- a/test/CodeGenObjCXX/property-dot-reference.mm +++ b/test/CodeGenObjCXX/property-dot-reference.mm @@ -11,7 +11,7 @@ void GetURL() const; @implementation TNodeIconAndNameCell - (const TFENode&) node { -// CHECK: call %struct.TFENode* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: call %struct.TFENode* bitcast (i8* (i8*, i8*)* @objc_msgSend // CHECK-NEXT: call void @_ZNK7TFENode6GetURLEv(%struct.TFENode* %{{.*}}) self.node.GetURL(); } // expected-warning {{control reaches end of non-void function}} @@ -27,11 +27,11 @@ void f0(const X &parent); - (const X&) target; @end void f1(A *a) { -// CHECK: [[PRP:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: [[PRP:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*)* @objc_msgSend // CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[PRP]]) f0(a.target); -// CHECK: [[MSG:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: [[MSG:%.*]] = call %struct.X* bitcast (i8* (i8*, i8*)* @objc_msgSend // CHECK-NEXT:call void @_Z2f0RK1X(%struct.X* [[MSG]]) f0([a target]); } diff --git a/test/CodeGenObjCXX/property-object-conditional-exp.mm b/test/CodeGenObjCXX/property-object-conditional-exp.mm index 826c351e79..631158135b 100644 --- a/test/CodeGenObjCXX/property-object-conditional-exp.mm +++ b/test/CodeGenObjCXX/property-object-conditional-exp.mm @@ -22,7 +22,7 @@ extern "C" bool CGRectIsEmpty(CGRect); CGRect dataRect; CGRect virtualBounds; -// CHECK: [[SRC:%.*]] = call %struct.CGRect bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: [[SRC:%.*]] = call %struct.CGRect bitcast (i8* (i8*, i8*)* @objc_msgSend // CHECK-NEXT:store %struct.CGRect [[SRC]], %struct.CGRect* dataRect = CGRectIsEmpty(virtualBounds) ? self.bounds : virtualBounds; dataRect = CGRectIsEmpty(virtualBounds) ? [self bounds] : virtualBounds; |