Testcase for 6522054.
authorDale Johannesen <dalej@apple.com>
Mon, 26 Jan 2009 23:22:19 +0000 (23:22 +0000)
committerDale Johannesen <dalej@apple.com>
Mon, 26 Jan 2009 23:22:19 +0000 (23:22 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@63067 91177308-0d34-0410-b5e6-96231b3b80d8

test/FrontendObjC/2009-01-26-WriteBarrier-2.m [new file with mode: 0644]

diff --git a/test/FrontendObjC/2009-01-26-WriteBarrier-2.m b/test/FrontendObjC/2009-01-26-WriteBarrier-2.m
new file mode 100644 (file)
index 0000000..32833a8
--- /dev/null
@@ -0,0 +1,14 @@
+// RUN: %llvmgcc -x objective-c -S %s -fobjc-gc -o - | grep objc_assign_strongCast
+// rdar://5541393
+
+typedef struct {
+    void (^ivarBlock)(void);
+} StructWithBlock_t;
+
+int main(char *argc, char *argv[]) {
+   StructWithBlock_t *swbp = (StructWithBlock_t *)malloc(sizeof(StructWithBlock_t*));
+   __block   int i = 10;
+   // assigning a Block into an struct slot should elicit a write-barrier under GC
+   swbp->ivarBlock = ^ { ++i; }; 
+   return 0;
+}