diff options
author | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2012-12-02 13:20:44 +0000 |
commit | 056abd2059c65a3e908193aeae16fad98017437c (patch) | |
tree | 2732d02d7d51218d6eed98ac7fcfc5b8794896b5 /test/CodeGenObjCXX | |
parent | cc73504950eb7b5dff2dded9bedd67bc36d64641 (diff) | |
download | FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.zip FreeBSD-src-056abd2059c65a3e908193aeae16fad98017437c.tar.gz |
Vendor import of clang release_32 branch r168974 (effectively, 3.2 RC2):
http://llvm.org/svn/llvm-project/cfe/branches/release_32@168974
Diffstat (limited to 'test/CodeGenObjCXX')
-rw-r--r-- | test/CodeGenObjCXX/address-safety-attr.mm | 2 | ||||
-rw-r--r-- | test/CodeGenObjCXX/arc-exceptions.mm | 10 | ||||
-rw-r--r-- | test/CodeGenObjCXX/arc-new-delete.mm | 5 | ||||
-rw-r--r-- | test/CodeGenObjCXX/arc-references.mm | 2 | ||||
-rw-r--r-- | test/CodeGenObjCXX/arc-special-member-functions.mm | 7 | ||||
-rw-r--r-- | test/CodeGenObjCXX/block-var-layout.mm | 6 | ||||
-rw-r--r-- | test/CodeGenObjCXX/implementation-in-extern-c.mm | 17 | ||||
-rw-r--r-- | test/CodeGenObjCXX/implicit-copy-assign-operator.mm | 95 | ||||
-rw-r--r-- | test/CodeGenObjCXX/property-objects.mm | 22 |
9 files changed, 128 insertions, 38 deletions
diff --git a/test/CodeGenObjCXX/address-safety-attr.mm b/test/CodeGenObjCXX/address-safety-attr.mm index a54ca99..a3824b9 100644 --- a/test/CodeGenObjCXX/address-safety-attr.mm +++ b/test/CodeGenObjCXX/address-safety-attr.mm @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -// RUN: %clang_cc1 -emit-llvm -o - %s -faddress-sanitizer | FileCheck -check-prefix ASAN %s +// RUN: %clang_cc1 -emit-llvm -o - %s -fsanitize=address | FileCheck -check-prefix ASAN %s @interface MyClass + (int) addressSafety:(int*)a; diff --git a/test/CodeGenObjCXX/arc-exceptions.mm b/test/CodeGenObjCXX/arc-exceptions.mm index b1fa8ca..fb5300d 100644 --- a/test/CodeGenObjCXX/arc-exceptions.mm +++ b/test/CodeGenObjCXX/arc-exceptions.mm @@ -20,9 +20,8 @@ void test0(void) { // CHECK-NEXT: [[T3:%.*]] = call i8* @objc_retain(i8* [[T2]]) nounwind // CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to [[ETY]]* // CHECK-NEXT: store [[ETY]]* [[T4]], [[ETY]]** [[E]] -// CHECK-NEXT: [[T0:%.*]] = load [[ETY]]** [[E]] -// CHECK-NEXT: [[T1:%.*]] = bitcast [[ETY]]* [[T0]] to i8* -// CHECK-NEXT: call void @objc_release(i8* [[T1]]) nounwind +// CHECK-NEXT: [[T0:%.*]] = bitcast [[ETY]]** [[E]] to i8** +// CHECK-NEXT: call void @objc_storeStrong(i8** [[T0]], i8* null) nounwind // CHECK-NEXT: call void @objc_end_catch() nounwind void test1_helper(void); @@ -60,9 +59,8 @@ void test2(void) { // CHECK-NEXT: [[T3:%.*]] = call i8* @objc_retain(i8* [[T2]]) nounwind // CHECK-NEXT: [[T4:%.*]] = bitcast i8* [[T3]] to [[ETY]]* // CHECK-NEXT: store [[ETY]]* [[T4]], [[ETY]]** [[E]] -// CHECK-NEXT: [[T0:%.*]] = load [[ETY]]** [[E]] -// CHECK-NEXT: [[T1:%.*]] = bitcast [[ETY]]* [[T0]] to i8* -// CHECK-NEXT: call void @objc_release(i8* [[T1]]) nounwind +// CHECK-NEXT: [[T0:%.*]] = bitcast [[ETY]]** [[E]] to i8** +// CHECK-NEXT: call void @objc_storeStrong(i8** [[T0]], i8* null) nounwind // CHECK-NEXT: call void @__cxa_end_catch() nounwind void test3_helper(void); diff --git a/test/CodeGenObjCXX/arc-new-delete.mm b/test/CodeGenObjCXX/arc-new-delete.mm index a778bca..ce7eb3d 100644 --- a/test/CodeGenObjCXX/arc-new-delete.mm +++ b/test/CodeGenObjCXX/arc-new-delete.mm @@ -35,7 +35,7 @@ void test_new(id invalue) { // CHECK: call i8* @objc_initWeak new __weak id(invalue); - // CHECK: call void @objc_release + // CHECK: call void @objc_storeStrong // CHECK: ret void } @@ -76,8 +76,7 @@ void test_array_delete(__strong id *sptr, __weak id *wptr) { // CHECK-NEXT: icmp eq i8** [[BEGIN]], [[END]] // CHECK: [[PAST:%.*]] = phi i8** [ [[END]], {{%.*}} ], [ [[CUR:%.*]], // CHECK-NEXT: [[CUR]] = getelementptr inbounds i8** [[PAST]], i64 -1 - // CHECK-NEXT: [[T0:%.*]] = load i8** [[CUR]] - // CHECK-NEXT: call void @objc_release(i8* [[T0]]) + // CHECK-NEXT: call void @objc_storeStrong(i8** [[CUR]], i8* null) // CHECK-NEXT: icmp eq i8** [[CUR]], [[BEGIN]] // CHECK: call void @_ZdaPv delete [] sptr; diff --git a/test/CodeGenObjCXX/arc-references.mm b/test/CodeGenObjCXX/arc-references.mm index 954c02a..1210774 100644 --- a/test/CodeGenObjCXX/arc-references.mm +++ b/test/CodeGenObjCXX/arc-references.mm @@ -10,7 +10,7 @@ void callee(); // CHECK: define void @_Z5test0v() void test0() { // CHECK: call i8* @_Z9getObjectv - // CHECK-NEXT:: call i8* @objc_retainAutoreleasedReturnValue + // CHECK-NEXT: call i8* @objc_retainAutoreleasedReturnValue const __strong id &ref1 = getObject(); // CHECK: call void @_Z6calleev callee(); diff --git a/test/CodeGenObjCXX/arc-special-member-functions.mm b/test/CodeGenObjCXX/arc-special-member-functions.mm index 421a9fe..0b34538 100644 --- a/test/CodeGenObjCXX/arc-special-member-functions.mm +++ b/test/CodeGenObjCXX/arc-special-member-functions.mm @@ -111,7 +111,7 @@ void test_ObjCBlockMember_copy_assign(ObjCBlockMember m1, ObjCBlockMember m2) { // Implicitly-generated destructor for ObjCBlockMember // CHECK: define linkonce_odr void @_ZN15ObjCBlockMemberD2Ev -// CHECK: call void @objc_release(i8* +// CHECK: call void @objc_storeStrong(i8* // CHECK: ret // Implicitly-generated default constructor for ObjCBlockMember @@ -134,8 +134,7 @@ void test_ObjCBlockMember_copy_assign(ObjCBlockMember m1, ObjCBlockMember m2) { // CHECK-NEXT: br label // CHECK: [[PAST:%.*]] = phi i8** [ [[END]], {{%.*}} ], [ [[CUR:%.*]], {{%.*}} ] // CHECK-NEXT: [[CUR]] = getelementptr inbounds i8** [[PAST]], i64 -1 -// CHECK-NEXT: [[T0:%.*]] = load i8** [[CUR]] -// CHECK-NEXT: call void @objc_release(i8* [[T0]]) +// CHECK-NEXT: call void @objc_storeStrong(i8** [[CUR]], i8* null) // CHECK-NEXT: [[T1:%.*]] = icmp eq i8** [[CUR]], [[BEGIN]] // CHECK-NEXT: br i1 [[T1]], // CHECK: ret void @@ -154,7 +153,7 @@ void test_ObjCBlockMember_copy_assign(ObjCBlockMember m1, ObjCBlockMember m2) { // Implicitly-generated destructor for ObjCMember // CHECK: define linkonce_odr void @_ZN10ObjCMemberD2Ev -// CHECK: call void @objc_release +// CHECK: call void @objc_storeStrong // CHECK: ret void // Implicitly-generated default constructor for ObjCMember diff --git a/test/CodeGenObjCXX/block-var-layout.mm b/test/CodeGenObjCXX/block-var-layout.mm index 00dd2c0..f8b6b9c 100644 --- a/test/CodeGenObjCXX/block-var-layout.mm +++ b/test/CodeGenObjCXX/block-var-layout.mm @@ -80,7 +80,7 @@ void (^d)() = ^{ // Test4 // struct S (int, id, int, id, int, id) -// 01 41 11 11 +// 01 41 11 11 00 // CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\01A\11\11\00" struct S s2; void (^e)() = ^{ @@ -118,8 +118,8 @@ void Test5() { union U u2; // struct s2 (int, id, int, id, int, id?), union u2 (id?) -// 01 41 11 12 70 00 -// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [6 x i8] c"\01A\11\12p\00" +// 01 41 11 12 00 +// CHECK-LP64: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global [5 x i8] c"\01A\11\12\00" void (^c)() = ^{ x(s2.ui.o1); x(u2.o1); diff --git a/test/CodeGenObjCXX/implementation-in-extern-c.mm b/test/CodeGenObjCXX/implementation-in-extern-c.mm new file mode 100644 index 0000000..4c1ee25 --- /dev/null +++ b/test/CodeGenObjCXX/implementation-in-extern-c.mm @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -emit-llvm %s -o /dev/null +// rdar://12581683 + +extern "C" { +@interface RetainBucket ++ (id) sharedRetainBucket; +@end + +@implementation RetainBucket ++ (id) sharedRetainBucket +{ + static id sharedBucket = (id)0; + return sharedBucket; +} +@end +} + diff --git a/test/CodeGenObjCXX/implicit-copy-assign-operator.mm b/test/CodeGenObjCXX/implicit-copy-assign-operator.mm index 29ec9ac..a5ce789 100644 --- a/test/CodeGenObjCXX/implicit-copy-assign-operator.mm +++ b/test/CodeGenObjCXX/implicit-copy-assign-operator.mm @@ -1,4 +1,6 @@ -// RUN: %clang_cc1 -fobjc-gc -emit-llvm -triple x86_64-apple-darwin10.0.0 -fobjc-runtime=macosx-fragile-10.5 -o - %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-gc -emit-llvm -triple x86_64-apple-darwin10.0.0 -fobjc-runtime=macosx-fragile-10.5 -o - %s | FileCheck %s -check-prefix=CHECK-OBJ +// RUN: %clang_cc1 -x c++ -emit-llvm -triple x86_64-apple-darwin10.0.0 -o - %s | FileCheck %s -check-prefix=CHECK-CPP +#ifdef __OBJC__ struct A { A &operator=(const A&); A &operator=(A&); @@ -41,17 +43,82 @@ void test_D(D d1, D d2) { d1 = d2; } -// CHECK: define linkonce_odr %struct.D* @_ZN1DaSERS_ -// CHECK: {{call.*_ZN1AaSERS_}} -// CHECK: {{call.*_ZN1BaSERS_}} -// CHECK: {{call.*_ZN1CaSERKS_}} -// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 24}} -// CHECK: {{call.*_ZN1BaSERS_}} -// CHECK: br -// CHECK: {{call.*_ZN1CaSERKS_}} -// CHECK: {{call.*@objc_memmove_collectable}} -// CHECK: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 12}} -// CHECK: call void @_ZN11CopyByValueC1ERKS_ -// CHECK: {{call.*_ZN11CopyByValueaSES_}} -// CHECK: ret +// CHECK-OBJ: define linkonce_odr %struct.D* @_ZN1DaSERS_ +// CHECK-OBJ: {{call.*_ZN1AaSERS_}} +// CHECK-OBJ: {{call.*_ZN1BaSERS_}} +// CHECK-OBJ: {{call.*_ZN1CaSERKS_}} +// CHECK-OBJ: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 24}} +// CHECK-OBJ: {{call.*_ZN1BaSERS_}} +// CHECK-OBJ: br +// CHECK-OBJ: {{call.*_ZN1CaSERKS_}} +// CHECK-OBJ: {{call.*@objc_memmove_collectable}} +// CHECK-OBJ: {{call void @llvm.memcpy.p0i8.p0i8.i64.*i64 12}} +// CHECK-OBJ: call void @_ZN11CopyByValueC1ERKS_ +// CHECK-OBJ: {{call.*_ZN11CopyByValueaSES_}} +// CHECK-OBJ: ret +#endif +namespace PR13329 { +#ifndef __OBJC__ + typedef void* id; +#endif + struct POD { + id i; + short s; + }; + + struct NonPOD { + id i; + short s; + + NonPOD(); + }; + + struct DerivedNonPOD: NonPOD { + char c; + }; + + struct DerivedPOD: POD { + char c; + }; + + void testPOD() { + POD a; + POD b; + // CHECK-OBJ: @objc_memmove_collectable{{.*}}i64 16 + // CHECK-CPP: @llvm.memcpy{{.*}}i64 16 + b = a; + } + + void testNonPOD() { + NonPOD a; + NonPOD b; + // CHECK-OBJ: @objc_memmove_collectable{{.*}}i64 10 + // CHECK-CPP: @llvm.memcpy{{.*}}i64 10 + b = a; + } + + void testDerivedNonPOD() { + DerivedNonPOD a; + NonPOD b; + DerivedNonPOD c; + // CHECK-OBJ: @objc_memmove_collectable{{.*}}i64 10 + // CHECK-CPP: @llvm.memcpy{{.*}}i64 10 + (NonPOD&) a = b; + // CHECK-OBJ: @objc_memmove_collectable{{.*}}i64 11 + // CHECK-CPP: @llvm.memcpy{{.*}}i64 11 + a = c; + }; + + void testDerivedPOD() { + DerivedPOD a; + POD b; + DerivedPOD c; + // CHECK-OBJ: @objc_memmove_collectable{{.*}}i64 16 + // CHECK-CPP: @llvm.memcpy{{.*}}i64 16 + (POD&) a = b; + // CHECK-OBJ: @objc_memmove_collectable{{.*}}i64 17 + // CHECK-CPP: @llvm.memcpy{{.*}}i64 17 + a = c; + }; +} diff --git a/test/CodeGenObjCXX/property-objects.mm b/test/CodeGenObjCXX/property-objects.mm index 6dfcc27..a3c2ed3 100644 --- a/test/CodeGenObjCXX/property-objects.mm +++ b/test/CodeGenObjCXX/property-objects.mm @@ -1,8 +1,4 @@ // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s -// CHECK-NOT: callq _objc_msgSend_stret -// CHECK: call void @_ZN1SC1ERKS_ -// CHECK: call %class.S* @_ZN1SaSERKS_ -// CHECK: call %struct.CGRect* @_ZN6CGRectaSERKS_ class S { public: @@ -19,13 +15,14 @@ struct CGRect { S position; CGRect bounds; } + @property(assign, nonatomic) S position; @property CGRect bounds; @property CGRect frame; - (void)setFrame:(CGRect)frameRect; - (CGRect)frame; - (void) initWithOwner; -- (struct CGRect)extent; +- (CGRect)extent; - (void)dealloc; @end @@ -33,6 +30,11 @@ struct CGRect { @synthesize position; @synthesize bounds; @synthesize frame; + +// CHECK: define internal void @"\01-[I setPosition:]" +// CHECK: call %class.S* @_ZN1SaSERKS_ +// CHECK-NEXT: ret void + - (void)setFrame:(CGRect)frameRect {} - (CGRect)frame {return bounds;} @@ -42,14 +44,20 @@ struct CGRect { labelLayerFrame = self.bounds; _labelLayer.frame = labelLayerFrame; } + // rdar://8366604 - (void)dealloc { CGRect cgrect = self.extent; } - (struct CGRect)extent {return bounds;} + @end +// CHECK: define i32 @main +// CHECK: call void @_ZN1SC1ERKS_(%class.S* [[AGGTMP:%[a-zA-Z0-9\.]+]], %class.S* {{%[a-zA-Z0-9\.]+}}) +// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %class.S*)*)(i8* {{%[a-zA-Z0-9\.]+}}, i8* {{%[a-zA-Z0-9\.]+}}, %class.S* [[AGGTMP]]) +// CHECK-NEXT: ret i32 0 int main() { I *i; S s1; @@ -59,7 +67,9 @@ int main() { // rdar://8379892 // CHECK: define void @_Z1fP1A -// CHECK: @objc_msgSend to void +// CHECK: call void @_ZN1XC1Ev(%struct.X* [[LVTEMP:%[a-zA-Z0-9\.]+]]) +// CHECK: call void @_ZN1XC1ERKS_(%struct.X* [[AGGTMP:%[a-zA-Z0-9\.]+]], %struct.X* [[LVTEMP]]) +// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, %struct.X*)*)({{.*}} %struct.X* [[AGGTMP]]) struct X { X(); X(const X&); |