diff options
Diffstat (limited to 'test/CodeGenObjC')
-rw-r--r-- | test/CodeGenObjC/PR4894-recursive-debug-crash.m | 40 | ||||
-rw-r--r-- | test/CodeGenObjC/blocks-4.m | 21 | ||||
-rw-r--r-- | test/CodeGenObjC/debug-info-crash.m (renamed from test/CodeGenObjC/PR4541.m) | 27 | ||||
-rw-r--r-- | test/CodeGenObjC/id-isa-codegen.m | 14 | ||||
-rw-r--r-- | test/CodeGenObjC/image-info.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/objc2-legacy-dispatch.m | 26 | ||||
-rw-r--r-- | test/CodeGenObjC/objc2-weak-block-call.m | 29 | ||||
-rw-r--r-- | test/CodeGenObjC/unwind-fn.m | 14 |
8 files changed, 129 insertions, 44 deletions
diff --git a/test/CodeGenObjC/PR4894-recursive-debug-crash.m b/test/CodeGenObjC/PR4894-recursive-debug-crash.m deleted file mode 100644 index 5d2327ad274b..000000000000 --- a/test/CodeGenObjC/PR4894-recursive-debug-crash.m +++ /dev/null @@ -1,40 +0,0 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -g -emit-llvm %s -o - | FileCheck %s -// PR4894 -// -// This test is actually just making sure we can generate the debug info for the -// return type from im0 without crashing. -// XFAIL: * - -@interface I0 { - I0 *_iv0; -} -@end -@protocol P0 @end - -@interface I1 @end -@implementation I1 -- (I0<P0> *) im0 { -// CHECK: @"\01-[I1 im0]" -// CHECK: llvm.dbg.func.start - return 0; -} -@end - -// FIXME: This was another PR4894 test case, which is crashing somewhere -// else. PR5025. -#if 0 -typedef const struct objc_selector { - void *sel_id; - const char *sel_types; -} *SEL; - -@interface I2 -+(id) dictionary; -@end - -@implementation I3; -+(void) initialize { - I2 *a0 = [I2 dictionary]; -} -@end -#endif diff --git a/test/CodeGenObjC/blocks-4.m b/test/CodeGenObjC/blocks-4.m new file mode 100644 index 000000000000..d945ed44fac0 --- /dev/null +++ b/test/CodeGenObjC/blocks-4.m @@ -0,0 +1,21 @@ +// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s +// rdar://7590273 + +void EXIT(id e); + +@interface NSBlockOperation { +} ++(id)blockOperationWithBlock:(void (^)(void))block ; +@end + +void FUNC() { + [NSBlockOperation blockOperationWithBlock:^{ + @try { + + } + @catch (id exception) { + EXIT(exception); + } + }]; + +} diff --git a/test/CodeGenObjC/PR4541.m b/test/CodeGenObjC/debug-info-crash.m index 84218a968cc8..92f9c0eda316 100644 --- a/test/CodeGenObjC/PR4541.m +++ b/test/CodeGenObjC/debug-info-crash.m @@ -1,6 +1,29 @@ -// RUN: %clang_cc1 -o %t -w -g %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -fblocks -g -S %s -o - +// rdar://7556129 +@implementation test +- (void)wait { + ^{}; +} +@end + +// PR4894 +@interface I0 { + I0 *_iv0; +} +@end +@protocol P0 @end +@interface I1 @end +@implementation I1 +- (I0<P0> *) im0 { + // CHECK: @"\01-[I1 im0]" + // CHECK: llvm.dbg.func.start + return 0; +} +@end + +// PR4541 @class NSString; @interface NSAttributedString - (NSString *)string; @@ -15,5 +38,3 @@ NSMutableAttributedString *attrStr; } @end - - diff --git a/test/CodeGenObjC/id-isa-codegen.m b/test/CodeGenObjC/id-isa-codegen.m index 89e992209071..3179e11b7f39 100644 --- a/test/CodeGenObjC/id-isa-codegen.m +++ b/test/CodeGenObjC/id-isa-codegen.m @@ -34,3 +34,17 @@ Class Test(const void *inObject1) { return ((id)inObject1)->isa; return (id)0; } + +// rdar 7609722 +@interface Foo { +@public + id isa; +} ++(id)method; +@end + +id Test2() { + if([Foo method]->isa) + return (*[Foo method]).isa; + return [Foo method]->isa; +} diff --git a/test/CodeGenObjC/image-info.m b/test/CodeGenObjC/image-info.m index 17f75319a0da..8916d0053fed 100644 --- a/test/CodeGenObjC/image-info.m +++ b/test/CodeGenObjC/image-info.m @@ -1,2 +1,2 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin-10 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // RUN: grep -F '@"\01L_OBJC_IMAGE_INFO" = internal constant [2 x i32] [i32 0, i32 16], section "__OBJC, __image_info,regular"' %t diff --git a/test/CodeGenObjC/objc2-legacy-dispatch.m b/test/CodeGenObjC/objc2-legacy-dispatch.m new file mode 100644 index 000000000000..4c37573ad564 --- /dev/null +++ b/test/CodeGenObjC/objc2-legacy-dispatch.m @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s +// +// CHECK_NEW_DISPATCH: define void @f0 +// CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc +// CHECK_NEW_DISPATCH: define void @f1 +// CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES +// +// RUN: %clang_cc1 -fobjc-nonfragile-abi -fobjc-legacy-dispatch -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s +// +// CHECK_OLD_DISPATCH: define void @f0 +// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES +// CHECK_OLD_DISPATCH: define void @f1 +// CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES + +@interface A ++(id) alloc; +-(int) im0; +@end + +void f0(void) { + [A alloc]; +} + +void f1(A *a) { + [a im0]; +} diff --git a/test/CodeGenObjC/objc2-weak-block-call.m b/test/CodeGenObjC/objc2-weak-block-call.m new file mode 100644 index 000000000000..a3514b0caa0c --- /dev/null +++ b/test/CodeGenObjC/objc2-weak-block-call.m @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -S %s -o %t-64.s +// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -S %s -o %t-32.s +// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s + +@interface MyView +- (void)MyView_sharedInit; +@end + +void foo(MyView *(^obj)(void)) ; + +@implementation MyView +- (void)MyView_sharedInit { + + __block __weak MyView *weakSelf = self; + foo( + ^{ + return weakSelf; + }); + +} +@end + +// CHECK-LP64: callq _objc_read_weak +// CHECK-LP64: callq _objc_read_weak + +// CHECK-LP32: call L_objc_read_weak +// CHECK-LP32: call L_objc_read_weak + diff --git a/test/CodeGenObjC/unwind-fn.m b/test/CodeGenObjC/unwind-fn.m new file mode 100644 index 000000000000..0aa8cde024da --- /dev/null +++ b/test/CodeGenObjC/unwind-fn.m @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck --check-prefix=DEFAULT_EH %s +// RUN: %clang_cc1 -fsjlj-exceptions -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck --check-prefix=SJLJ_EH %s + +// DEFAULT_EH: declare void @_Unwind_Resume_or_Rethrow(i8*) +// SJLJ_EH: declare void @_Unwind_SjLj_Resume(i8*) + +void f1(), f2(); +void f0() { + @try { + f1(); + } @catch (...) { + f2(); + } +} |