aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEric Christopher <echristo@apple.com>2011-08-20 00:37:56 +0000
committerEric Christopher <echristo@apple.com>2011-08-20 00:37:56 +0000
commit7bc54e543fff2e48ea25e63011983b41e7fe5f58 (patch)
tree0f70350f778658d303069223a519eb96f5f3522e
parentbaa15d6b53c6fabeed69e433d4d7c77c6726fcc1 (diff)
Migrate, FileCheckize and update:
2007-04-03-ObjcEH.m 2007-05-02-Strong.m 2007-10-18-ProDescriptor.m 2007-10-23-GC-WriteBarrier.m 2008-10-3-EhValue.m 2008-11-12-Metadata.m 2008-11-24-ConstCFStrings.m from llvm/test/FrontendObjC. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@138172 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--test/CodeGenObjC/2007-04-03-ObjcEH.m27
-rw-r--r--test/CodeGenObjC/2007-05-02-Strong.m23
-rw-r--r--test/CodeGenObjC/2007-10-18-ProDescriptor.m18
-rw-r--r--test/CodeGenObjC/2007-10-23-GC-WriteBarrier.m9
-rw-r--r--test/CodeGenObjC/2008-10-3-EhValue.m50
-rw-r--r--test/CodeGenObjC/2008-11-12-Metadata.m14
-rw-r--r--test/CodeGenObjC/2008-11-24-ConstCFStrings.m13
7 files changed, 154 insertions, 0 deletions
diff --git a/test/CodeGenObjC/2007-04-03-ObjcEH.m b/test/CodeGenObjC/2007-04-03-ObjcEH.m
new file mode 100644
index 0000000000..f86ff49bbb
--- /dev/null
+++ b/test/CodeGenObjC/2007-04-03-ObjcEH.m
@@ -0,0 +1,27 @@
+// RUN: %clang -fexceptions -S -emit-llvm %s -o -
+
+@interface B
+-(int)bar;
+@end
+
+@interface A
+-(void) Foo:(int) state;
+@end
+
+@implementation A
+- (void) Foo:(int) state {
+
+ int wasResponded = 0;
+ @try {
+ if (state) {
+ B * b = 0;
+ @try { }
+ @finally {
+ wasResponded = ![b bar];
+ }
+ }
+ }
+ @finally {
+ }
+}
+@end
diff --git a/test/CodeGenObjC/2007-05-02-Strong.m b/test/CodeGenObjC/2007-05-02-Strong.m
new file mode 100644
index 0000000000..31553df613
--- /dev/null
+++ b/test/CodeGenObjC/2007-05-02-Strong.m
@@ -0,0 +1,23 @@
+// RUN: %clang_cc1 -S %s -fobjc-gc -o /dev/null
+typedef int NSInteger;
+typedef struct _NSRect {
+ int origin;
+ int size;
+} NSRect;
+
+__attribute__((objc_gc(strong))) NSRect *_cachedRectArray;
+extern const NSRect NSZeroRect;
+@interface A{
+}
+-(void)bar:(NSInteger *)rectCount;
+@end
+
+@implementation A
+
+-(void)bar:(NSInteger *)rectCount {
+ NSRect appendRect = NSZeroRect;
+
+ _cachedRectArray[*rectCount - 1] = NSZeroRect;
+}
+
+@end
diff --git a/test/CodeGenObjC/2007-10-18-ProDescriptor.m b/test/CodeGenObjC/2007-10-18-ProDescriptor.m
new file mode 100644
index 0000000000..35a0df3a1a
--- /dev/null
+++ b/test/CodeGenObjC/2007-10-18-ProDescriptor.m
@@ -0,0 +1,18 @@
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null
+@protocol O
+@end
+@interface O < O > {
+}
+@end
+struct A {
+};
+@protocol AB
+- (unsigned) ver;
+@end
+@interface AGy:O < AB > {
+}
+@end
+@implementation AGy
+- (unsigned) ver {
+}
+@end
diff --git a/test/CodeGenObjC/2007-10-23-GC-WriteBarrier.m b/test/CodeGenObjC/2007-10-23-GC-WriteBarrier.m
new file mode 100644
index 0000000000..af8508b646
--- /dev/null
+++ b/test/CodeGenObjC/2007-10-23-GC-WriteBarrier.m
@@ -0,0 +1,9 @@
+// RUN: %clang_cc1 -emit-llvm %s -o /dev/null -fobjc-gc
+// rdar://5541393
+
+typedef unsigned int NSUInteger;
+__attribute__((objc_gc(strong))) float *_scores;
+
+void foo(int i, float f) {
+ _scores[i] = f;
+}
diff --git a/test/CodeGenObjC/2008-10-3-EhValue.m b/test/CodeGenObjC/2008-10-3-EhValue.m
new file mode 100644
index 0000000000..0ed0d89939
--- /dev/null
+++ b/test/CodeGenObjC/2008-10-3-EhValue.m
@@ -0,0 +1,50 @@
+// RUN: %clang -fexceptions -S -emit-llvm %s -o /dev/null
+
+@interface Object {
+@public
+ Class isa;
+}
++initialize;
++alloc;
++new;
++free;
+-free;
++(Class)class;
+-(Class)class;
+-init;
+-superclass;
+-(const char *)name;
+@end
+
+@interface Frob: Object
+@end
+
+@implementation Frob: Object
+@end
+
+static Frob* _connection = ((void *)0);
+
+extern void abort(void);
+
+void test (Object* sendPort)
+{
+ int cleanupPorts = 1;
+ Frob* receivePort = ((void *)0);
+
+ @try {
+ receivePort = (Frob *) -1;
+ _connection = (Frob *) -1;
+ receivePort = ((void *)0);
+ sendPort = ((void *)0);
+ cleanupPorts = 0;
+ @throw [Object new];
+ }
+ @catch(Frob *obj) {
+ if(!(0)) abort();
+ }
+ @catch(id exc) {
+ if(!(!receivePort)) abort();
+ if(!(!sendPort)) abort();
+ if(!(!cleanupPorts)) abort();
+ }
+}
diff --git a/test/CodeGenObjC/2008-11-12-Metadata.m b/test/CodeGenObjC/2008-11-12-Metadata.m
new file mode 100644
index 0000000000..29c7087b07
--- /dev/null
+++ b/test/CodeGenObjC/2008-11-12-Metadata.m
@@ -0,0 +1,14 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o /dev/null
+
+@interface A
+@end
+@protocol P
+@end
+@interface B : A <P>
+{
+}
+@end
+@implementation B
+- (void)test {
+}
+@end
diff --git a/test/CodeGenObjC/2008-11-24-ConstCFStrings.m b/test/CodeGenObjC/2008-11-24-ConstCFStrings.m
new file mode 100644
index 0000000000..3a69109968
--- /dev/null
+++ b/test/CodeGenObjC/2008-11-24-ConstCFStrings.m
@@ -0,0 +1,13 @@
+// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o - | FileCheck %s
+
+// CHECK: _unnamed_cfstring_
+
+@class NSString;
+
+@interface A
+- (void)bork:(NSString*)msg;
+@end
+
+void func(A *a) {
+ [a bork:@"Hello world!"];
+}