summaryrefslogtreecommitdiff
path: root/test/CodeGenObjC/objc2-strong-cast-block-import.m
diff options
context:
space:
mode:
authorFariborz Jahanian <fjahanian@apple.com>2011-09-23 18:57:30 +0000
committerFariborz Jahanian <fjahanian@apple.com>2011-09-23 18:57:30 +0000
commite3f834950801f1334f1b3f3f7e9a34062905fe1d (patch)
tree54836f79c99733e468c513de1b4bd642d023b3d4 /test/CodeGenObjC/objc2-strong-cast-block-import.m
parent966a8a5fdc9266152cc099ac7279e3d1f989b0fb (diff)
downloadclang-e3f834950801f1334f1b3f3f7e9a34062905fe1d.tar.gz
objc-gc: Fix a corner case where clang fails to generate GC
write barrier with captured pointer to object. // rdar://10150823 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@140399 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenObjC/objc2-strong-cast-block-import.m')
-rw-r--r--test/CodeGenObjC/objc2-strong-cast-block-import.m25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/CodeGenObjC/objc2-strong-cast-block-import.m b/test/CodeGenObjC/objc2-strong-cast-block-import.m
new file mode 100644
index 0000000000..29218a3779
--- /dev/null
+++ b/test/CodeGenObjC/objc2-strong-cast-block-import.m
@@ -0,0 +1,25 @@
+// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc-only -fblocks -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s
+// rdar://10150823
+
+@interface Test {
+@package
+ Test ** __strong objects;
+}
+@end
+
+id newObject();
+void runWithBlock(void(^)(int i));
+
+@implementation Test
+
+- (void)testWithObjectInBlock {
+ Test **children = objects;
+ runWithBlock(^(int i){
+ children[i] = newObject();
+ });
+}
+
+@end
+// CHECK: call i8* @objc_assign_strongCast
+// CHECK: call i8* @objc_assign_strongCast
+