From 00b2bbb7bb5a02306095db2b39d7bf9bc12df90d Mon Sep 17 00:00:00 2001 From: John McCall Date: Thu, 19 Nov 2015 02:28:03 +0000 Subject: Don't actually add the __unsafe_unretained qualifier in MRC; driving a canonical difference between that and an unqualified type is a really bad idea when both are valid. Instead, remember that it was there in a non-canonical way, then look for that in the one place we really care about it: block captures. The net effect closely resembles the behavior of a decl attribute, except still closely following ARC's standard qualifier parsing rules. llvm-svn: 253534 --- clang/test/CodeGenObjC/mrc-weak.m | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) (limited to 'clang/test/CodeGenObjC/mrc-weak.m') diff --git a/clang/test/CodeGenObjC/mrc-weak.m b/clang/test/CodeGenObjC/mrc-weak.m index 9072b1a0832..e2c78f07336 100644 --- a/clang/test/CodeGenObjC/mrc-weak.m +++ b/clang/test/CodeGenObjC/mrc-weak.m @@ -160,3 +160,32 @@ void test8(void) { // CHECK-LABEL: define internal void @__Block_byref_object_dispose // CHECK: call void @objc_destroyWeak + +// CHECK-LABEL: define void @test9_baseline() +// CHECK: define internal void @__copy_helper +// CHECK: define internal void @__destroy_helper +void test9_baseline(void) { + Foo *p = get_object(); + use_block(^{ [p run]; }); +} + +// CHECK-LABEL: define void @test9() +// CHECK-NOT: define internal void @__copy_helper +// CHECK-NOT: define internal void @__destroy_helper +// CHECK: define void @test9_fin() +void test9(void) { + __unsafe_unretained Foo *p = get_object(); + use_block(^{ [p run]; }); +} +void test9_fin() {} + +// CHECK-LABEL: define void @test10() +// CHECK-NOT: define internal void @__copy_helper +// CHECK-NOT: define internal void @__destroy_helper +// CHECK: define void @test10_fin() +void test10(void) { + typedef __unsafe_unretained Foo *UnsafeFooPtr; + UnsafeFooPtr p = get_object(); + use_block(^{ [p run]; }); +} +void test10_fin() {} -- cgit v1.2.3