diff options
author | dim <dim@FreeBSD.org> | 2011-02-26 22:09:03 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2011-02-26 22:09:03 +0000 |
commit | a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51 (patch) | |
tree | abae0246ec9156cc1a7cbb947b2b0dfe95fa3189 /test/CodeGenObjC | |
parent | 39fcc9a984e2820e4ea0fa2ac4abd17d9f3a31df (diff) | |
download | FreeBSD-src-a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51.zip FreeBSD-src-a0fb00f9837bd0d2e5948f16f6a6b82a7a628f51.tar.gz |
Vendor import of clang trunk r126547:
http://llvm.org/svn/llvm-project/cfe/trunk@126547
Diffstat (limited to 'test/CodeGenObjC')
-rw-r--r-- | test/CodeGenObjC/2008-08-25-incompatible-cond-expr.m | 10 | ||||
-rw-r--r-- | test/CodeGenObjC/2009-01-21-invalid-debug-info.m | 16 | ||||
-rw-r--r-- | test/CodeGenObjC/2010-02-09-DbgSelf.m | 14 | ||||
-rw-r--r-- | test/CodeGenObjC/2010-02-15-Dbg-MethodStart.m | 15 | ||||
-rw-r--r-- | test/CodeGenObjC/blocks-3.m | 6 | ||||
-rw-r--r-- | test/CodeGenObjC/blocks-4.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/blocks.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/exceptions-nonfragile.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/exceptions.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/for-in.m | 6 | ||||
-rw-r--r-- | test/CodeGenObjC/function-decay.m | 10 | ||||
-rw-r--r-- | test/CodeGenObjC/gnu-exceptions.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/illegal-UTF8.m | 6 | ||||
-rw-r--r-- | test/CodeGenObjC/messages-2.m | 23 | ||||
-rw-r--r-- | test/CodeGenObjC/messages.m | 33 | ||||
-rw-r--r-- | test/CodeGenObjC/metadata_symbols.m | 6 | ||||
-rw-r--r-- | test/CodeGenObjC/nested-rethrow.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/rdr-6732143-dangling-block-reference.m | 10 | ||||
-rw-r--r-- | test/CodeGenObjC/try.m | 4 | ||||
-rw-r--r-- | test/CodeGenObjC/unwind-fn.m | 4 |
20 files changed, 155 insertions, 20 deletions
diff --git a/test/CodeGenObjC/2008-08-25-incompatible-cond-expr.m b/test/CodeGenObjC/2008-08-25-incompatible-cond-expr.m new file mode 100644 index 0000000..f285cca --- /dev/null +++ b/test/CodeGenObjC/2008-08-25-incompatible-cond-expr.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -emit-llvm -o %t %s + +@protocol P0 +@end +@interface A <P0> +@end + +id f0(int a, id<P0> x, A* p) { + return a ? x : p; +} diff --git a/test/CodeGenObjC/2009-01-21-invalid-debug-info.m b/test/CodeGenObjC/2009-01-21-invalid-debug-info.m new file mode 100644 index 0000000..af912e2 --- /dev/null +++ b/test/CodeGenObjC/2009-01-21-invalid-debug-info.m @@ -0,0 +1,16 @@ +// RUN: %clang_cc1 -S -g -o %t.s %s + +// FIXME: This test case can be removed at some point (since it will +// no longer effectively test anything). The reason it was causing +// trouble was the synthesized self decl in im1 was causing the debug +// info for I1* to be generated, but referring to an invalid compile +// unit. This was later referred to by f1 and created ill formed debug +// information. + +@interface I1 @end + +@implementation I1 +-im0 { return 0; } +@end + +I1 *f1(void) { return 0; } diff --git a/test/CodeGenObjC/2010-02-09-DbgSelf.m b/test/CodeGenObjC/2010-02-09-DbgSelf.m new file mode 100644 index 0000000..e09adac --- /dev/null +++ b/test/CodeGenObjC/2010-02-09-DbgSelf.m @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | grep "\"self\", metadata" +// Test to check that "self" argument is assigned a location. + +@interface Foo +-(void) Bar: (int)x ; +@end + + +@implementation Foo +-(void) Bar: (int)x +{ +} +@end + diff --git a/test/CodeGenObjC/2010-02-15-Dbg-MethodStart.m b/test/CodeGenObjC/2010-02-15-Dbg-MethodStart.m new file mode 100644 index 0000000..5186b20 --- /dev/null +++ b/test/CodeGenObjC/2010-02-15-Dbg-MethodStart.m @@ -0,0 +1,15 @@ +// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | grep subprogram | grep "i32 9" +// Test to check that subprogram start location. + +@interface Foo +-(int) barMethod; +@end + +@implementation Foo +-(int) barMethod { + int i = 0; + int j = 1; + int k = 1; + return i + j + k; +} +@end diff --git a/test/CodeGenObjC/blocks-3.m b/test/CodeGenObjC/blocks-3.m index d8379b9..a0b693d 100644 --- a/test/CodeGenObjC/blocks-3.m +++ b/test/CodeGenObjC/blocks-3.m @@ -1,5 +1,11 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -fblocks -o %t %s + +// 1x for the declaration +// 1x for the object-pointer byref copy helper +// 1x for the block-pointer byref copy helper +// 8x for the block copy helper // RUN: grep 'object_assign' %t | count 11 + // RUN: grep 'object_dispose' %t | count 29 int main() { diff --git a/test/CodeGenObjC/blocks-4.m b/test/CodeGenObjC/blocks-4.m index d945ed4..f2d6e21 100644 --- a/test/CodeGenObjC/blocks-4.m +++ b/test/CodeGenObjC/blocks-4.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fblocks -o %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fobjc-exceptions -fblocks -o %t %s // rdar://7590273 void EXIT(id e); diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m index 11fb55b..06dc908 100644 --- a/test/CodeGenObjC/blocks.m +++ b/test/CodeGenObjC/blocks.m @@ -72,8 +72,8 @@ void test2(Test2 *x) { // CHECK-NEXT: store i8* bitcast (void (i8*)* @__Block_byref_object_dispose_{{.*}} to i8*), i8** [[T5]] // Actually capture the value. - // CHECK-NEXT: [[CAPTURE:%.*]] = load [[TEST2]]** [[X]] // CHECK-NEXT: [[T6:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 6 + // CHECK-NEXT: [[CAPTURE:%.*]] = load [[TEST2]]** [[X]] // CHECK-NEXT: store [[TEST2]]* [[CAPTURE]], [[TEST2]]** [[T6]] // Then we initialize the block, blah blah blah. diff --git a/test/CodeGenObjC/exceptions-nonfragile.m b/test/CodeGenObjC/exceptions-nonfragile.m index 57ed1d9..280b5d4 100644 --- a/test/CodeGenObjC/exceptions-nonfragile.m +++ b/test/CodeGenObjC/exceptions-nonfragile.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -O2 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -fobjc-exceptions -O2 -o - %s | FileCheck %s // rdar://problem/8535238 // CHECK: declare void @objc_exception_rethrow() diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m index 31805cb..d378f84 100644 --- a/test/CodeGenObjC/exceptions.m +++ b/test/CodeGenObjC/exceptions.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -O2 -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -O2 -o - %s | FileCheck %s // // <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes diff --git a/test/CodeGenObjC/for-in.m b/test/CodeGenObjC/for-in.m index 7e6098a..26fe792 100644 --- a/test/CodeGenObjC/for-in.m +++ b/test/CodeGenObjC/for-in.m @@ -42,3 +42,9 @@ void t1() { break; } } + +// rdar://problem/9027663 +void t2(NSArray *array) { + for (NSArray *array in array) { // expected-warning {{collection expression type 'NSArray *' may not respond}} + } +} diff --git a/test/CodeGenObjC/function-decay.m b/test/CodeGenObjC/function-decay.m new file mode 100644 index 0000000..161f907 --- /dev/null +++ b/test/CodeGenObjC/function-decay.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - + +@interface I0 @end +@implementation I0 +- (void) im0: (int (void)) a0 { +} +@end + +void func(int pf(void)) { +} diff --git a/test/CodeGenObjC/gnu-exceptions.m b/test/CodeGenObjC/gnu-exceptions.m index 6790a29..7f3ae9d 100644 --- a/test/CodeGenObjC/gnu-exceptions.m +++ b/test/CodeGenObjC/gnu-exceptions.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fgnu-runtime -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -emit-llvm -fexceptions -fobjc-exceptions -fgnu-runtime -o - %s | FileCheck %s void opaque(void); void log(int i); diff --git a/test/CodeGenObjC/illegal-UTF8.m b/test/CodeGenObjC/illegal-UTF8.m new file mode 100644 index 0000000..4762e80 --- /dev/null +++ b/test/CodeGenObjC/illegal-UTF8.m @@ -0,0 +1,6 @@ +// RUN: %clang %s -S -m64 -o - + +@class NSString; + + +NSString *S = @"\xff\xff___WAIT___"; // expected-warning {{input conversion stopped due to an input byte that does not belong to the input codeset UTF-8}} diff --git a/test/CodeGenObjC/messages-2.m b/test/CodeGenObjC/messages-2.m index 05e30ab..5ef2261 100644 --- a/test/CodeGenObjC/messages-2.m +++ b/test/CodeGenObjC/messages-2.m @@ -1,4 +1,7 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-NF + +// Most of this test is apparently just verifying that we don't crash. int printf(const char *, ...); @@ -140,3 +143,21 @@ typedef struct { return 5; } @end + +// rdar://problem/7854674 +// CHECK: define void @test0([[A:%.*]]* +// CHECK-NF: define void @test0([[A:%.*]]* +void test0(A *a) { + // CHECK: alloca [[A]]* + // CHECK-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]], + // CHECK-NF: alloca [[A]]* + // CHECK-NF-NEXT: [[POINT:%.*]] = alloca [[POINT_T:%.*]], + + // CHECK: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8* + // CHECK-NEXT: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 48, i32 4, i1 false) + // CHECK-NEXT: call {{.*}} @objc_msgSend_stret to + // CHECK-NF: [[T0:%.*]] = bitcast [[POINT_T]]* [[POINT]] to i8* + // CHECK-NF-NEXT: call void @llvm.memset.p0i8.i64(i8* [[T0]], i8 0, i64 48, i32 4, i1 false) + // CHECK-NF-NEXT: call {{.*}} @objc_msgSend_stret to + MyPoint point = [a returnAPoint]; +} diff --git a/test/CodeGenObjC/messages.m b/test/CodeGenObjC/messages.m index 5f77a8e..b36fe5b 100644 --- a/test/CodeGenObjC/messages.m +++ b/test/CodeGenObjC/messages.m @@ -1,9 +1,7 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s -// RUN: grep "objc_msgSend" %t | count 6 -// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s -// RUN: grep "objc_msg_lookup" %t | count 6 -// RUN: %clang_cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o %t %s -// RUN: grep "objc_msg_lookup_sender" %t | count 6 +// RUN: %clang_cc1 -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-MAC +// RUN: %clang_cc1 -emit-llvm -fobjc-nonfragile-abi -o - %s | FileCheck %s -check-prefix=CHECK-MAC-NF +// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK-GNU +// RUN: %clang_cc1 -fgnu-runtime -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s -check-prefix CHECK-GNU-NF typedef struct { int x; @@ -15,12 +13,35 @@ void f0(id a) { int i; MyPoint pt = { 1, 2}; + // CHECK-MAC: call {{.*}} @objc_msgSend( + // CHECK-MAC-NF: call {{.*}} @objc_msgSend( + // CHECK-GNU: call {{.*}} @objc_msg_lookup( + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender( [a print0]; + + // CHECK-MAC: call {{.*}} @objc_msgSend to + // CHECK-MAC-NF: call {{.*}} @objc_msgSend to + // CHECK-GNU: call {{.*}} @objc_msg_lookup to + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to [a print1: 10]; + + // CHECK-MAC: call {{.*}} @objc_msgSend to + // CHECK-MAC-NF: call {{.*}} @objc_msgSend to + // CHECK-GNU: call {{.*}} @objc_msg_lookup to + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to [a print2: 10 and: "hello" and: 2.2]; + + // CHECK-MAC: call {{.*}} @objc_msgSend to + // CHECK-MAC-NF: call {{.*}} @objc_msgSend to + // CHECK-GNU: call {{.*}} @objc_msg_lookup to + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to [a takeStruct: pt ]; void *s = @selector(print0); for (i=0; i<2; ++i) + // CHECK-MAC: call {{.*}} @objc_msgSend to + // CHECK-MAC-NF: call {{.*}} @objc_msgSend to + // CHECK-GNU: call {{.*}} @objc_msg_lookup to + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to [a performSelector:s]; } diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m index 3163946..d864229 100644 --- a/test/CodeGenObjC/metadata_symbols.m +++ b/test/CodeGenObjC/metadata_symbols.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -fexceptions -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -fexceptions -fobjc-exceptions -o %t %s // RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s // RUN: grep '@"OBJC_EHTYPE_$_EH3"' %t | count 3 @@ -12,7 +12,7 @@ // CHECK-X86_64: define internal void @"\01-[A im0]" // CHECK-X86_64: define internal void @"\01-[A(Cat) im1]" -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fvisibility hidden -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -fobjc-exceptions -fvisibility hidden -emit-llvm -o %t %s // RUN: FileCheck -check-prefix=CHECK-X86_64-HIDDEN < %t %s // CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8 @@ -23,7 +23,7 @@ // CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]" // CHECK-X86_64-HIDDEN: define internal void @"\01-[A(Cat) im1]" -// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -emit-llvm -o %t %s +// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-nonfragile-abi -fobjc-exceptions -emit-llvm -o %t %s // RUN: FileCheck -check-prefix=CHECK-ARMV6 < %t %s // CHECK-ARMV6: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4 diff --git a/test/CodeGenObjC/nested-rethrow.m b/test/CodeGenObjC/nested-rethrow.m index 627b913..af5154a 100644 --- a/test/CodeGenObjC/nested-rethrow.m +++ b/test/CodeGenObjC/nested-rethrow.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -fobjc-exceptions %s -o - | FileCheck %s extern int printf(const char*, ...); diff --git a/test/CodeGenObjC/rdr-6732143-dangling-block-reference.m b/test/CodeGenObjC/rdr-6732143-dangling-block-reference.m new file mode 100644 index 0000000..fd812dd --- /dev/null +++ b/test/CodeGenObjC/rdr-6732143-dangling-block-reference.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin9 -emit-llvm -fobjc-exceptions %s -o - + +void f0(id x) { + @synchronized (x) { + do { ; } while(0); + @try { + } @finally { + } + } +} diff --git a/test/CodeGenObjC/try.m b/test/CodeGenObjC/try.m index 884e33a..ba79d62 100644 --- a/test/CodeGenObjC/try.m +++ b/test/CodeGenObjC/try.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 %s -S -o - -triple=i686-apple-darwin9 -// RUN: %clang_cc1 %s -S -o - -triple=x86_64-apple-darwin9 +// RUN: %clang_cc1 %s -fobjc-exceptions -S -o - -triple=i686-apple-darwin9 +// RUN: %clang_cc1 %s -fobjc-exceptions -S -o - -triple=x86_64-apple-darwin9 // rdar://6757213 - Don't crash if the internal proto for // __objc_personality_v0 mismatches with an actual one. diff --git a/test/CodeGenObjC/unwind-fn.m b/test/CodeGenObjC/unwind-fn.m index 5bfc7dc..5e4a7a5 100644 --- a/test/CodeGenObjC/unwind-fn.m +++ b/test/CodeGenObjC/unwind-fn.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -fexceptions -o - %s | FileCheck --check-prefix=DEFAULT_EH %s -// RUN: %clang_cc1 -fsjlj-exceptions -fobjc-nonfragile-abi -fexceptions -emit-llvm -o - %s | FileCheck --check-prefix=SJLJ_EH %s +// RUN: %clang_cc1 -fobjc-nonfragile-abi -emit-llvm -fexceptions -fobjc-exceptions -o - %s | FileCheck --check-prefix=DEFAULT_EH %s +// RUN: %clang_cc1 -fsjlj-exceptions -fobjc-nonfragile-abi -fexceptions -fobjc-exceptions -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_or_Rethrow(i8*) |