]> granicus.if.org Git - clang/commitdiff
Migrate, update and FileCheckize:
authorEric Christopher <echristo@apple.com>
Sat, 20 Aug 2011 00:49:25 +0000 (00:49 +0000)
committerEric Christopher <echristo@apple.com>
Sat, 20 Aug 2011 00:49:25 +0000 (00:49 +0000)
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

test/CodeGenObjC/2008-11-25-Blocks.m [new file with mode: 0644]
test/CodeGenObjC/2009-01-26-WriteBarrier-2.m [new file with mode: 0644]
test/CodeGenObjC/2009-02-05-VolatileProp.m [new file with mode: 0644]
test/CodeGenObjC/2009-08-05-utf16.m [new file with mode: 0644]

diff --git a/test/CodeGenObjC/2008-11-25-Blocks.m b/test/CodeGenObjC/2008-11-25-Blocks.m
new file mode 100644 (file)
index 0000000..39364d5
--- /dev/null
@@ -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 (file)
index 0000000..d7219f1
--- /dev/null
@@ -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 (file)
index 0000000..1f696ac
--- /dev/null
@@ -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 (file)
index 0000000..38c9c82
--- /dev/null
@@ -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™";