aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-08-20 00:49:25 +0000
committerEric Christopher <echristo@apple.com>2011-08-20 00:49:25 +0000
commita1032cca3efc3d9cd92580c90c6009a6962821e0 (patch)
treef6ca0e0249a4b09e46baffc1b6902c8fdd010de8
parent7bc54e543fff2e48ea25e63011983b41e7fe5f58 (diff)
Migrate, update and FileCheckize:
2008-11-25-Blocks.m 2009-01-26-WriteBarrier-2.m 2009-02-05-VolatileProp.m 2009-08-05-utf16.m from llvm/test/FrontendObjC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138175 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGenObjC/2008-11-25-Blocks.m17
-rw-r--r--test/CodeGenObjC/2009-01-26-WriteBarrier-2.m19
-rw-r--r--test/CodeGenObjC/2009-02-05-VolatileProp.m10
-rw-r--r--test/CodeGenObjC/2009-08-05-utf16.m5
4 files changed, 51 insertions, 0 deletions
diff --git a/test/CodeGenObjC/2008-11-25-Blocks.m b/test/CodeGenObjC/2008-11-25-Blocks.m
new file mode 100644
index 0000000000..39364d5de0
--- /dev/null
+++ b/test/CodeGenObjC/2008-11-25-Blocks.m
@@ -0,0 +1,17 @@
+// RUN: %clang_cc1 -fblocks -emit-llvm %s -o /dev/null
+// rdar://6394879
+
+@interface bork
+- (id)B:(void (^)())blk;
+- (void)C;
+@end
+@implementation bork
+- (id)B:(void (^)())blk {
+ __attribute__((__blocks__(byref))) bork* new = ((void *)0);
+ blk();
+}
+- (void)C {
+ __attribute__((__blocks__(byref))) id var;
+ [self B:^() {}];
+}
+@end
diff --git a/test/CodeGenObjC/2009-01-26-WriteBarrier-2.m b/test/CodeGenObjC/2009-01-26-WriteBarrier-2.m
new file mode 100644
index 0000000000..d7219f185b
--- /dev/null
+++ b/test/CodeGenObjC/2009-01-26-WriteBarrier-2.m
@@ -0,0 +1,19 @@
+// RUN: %clang_cc1 -fblocks -emit-llvm %s -fobjc-gc -o - | FileCheck %s
+
+// CHECK: objc_assign_strongCast
+// rdar://5541393
+
+typedef __SIZE_TYPE__ size_t;
+void * malloc(size_t size);
+
+typedef struct {
+ void (^ivarBlock)(void);
+} StructWithBlock_t;
+
+int main(int 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;
+}
diff --git a/test/CodeGenObjC/2009-02-05-VolatileProp.m b/test/CodeGenObjC/2009-02-05-VolatileProp.m
new file mode 100644
index 0000000000..1f696ac7c2
--- /dev/null
+++ b/test/CodeGenObjC/2009-02-05-VolatileProp.m
@@ -0,0 +1,10 @@
+// RUN: %clang -fexceptions -S -emit-llvm %s -o /dev/null -pedantic-errors
+// rdar://6551276
+
+void foo(const unsigned short *);
+void bar() {
+ unsigned short *s[3];
+ int i;
+ @try { } @catch (id anException) { }
+ foo(2+s[i]);
+}
diff --git a/test/CodeGenObjC/2009-08-05-utf16.m b/test/CodeGenObjC/2009-08-05-utf16.m
new file mode 100644
index 0000000000..38c9c82e78
--- /dev/null
+++ b/test/CodeGenObjC/2009-08-05-utf16.m
@@ -0,0 +1,5 @@
+// RUN: %clang_cc1 -emit-llvm -w -x objective-c %s -o - | FileCheck %s
+// rdar://7095855 rdar://7115749
+
+// CHECK: internal unnamed_addr constant [12 x i8]
+void *P = @"iPod™";