diff options
author | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
---|---|---|
committer | dim <dim@FreeBSD.org> | 2013-12-22 00:07:40 +0000 |
commit | 952eddef9aff85b1e92626e89baaf7a360e2ac85 (patch) | |
tree | df8df0b0067b381eab470a3b8f28d14a552a6340 /test/CodeGenObjC | |
parent | ea266cad53e3d49771fa38103913d3ec7a166694 (diff) | |
download | FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.zip FreeBSD-src-952eddef9aff85b1e92626e89baaf7a360e2ac85.tar.gz |
Vendor import of clang release_34 branch r197841 (effectively, 3.4 RC3):
https://llvm.org/svn/llvm-project/cfe/branches/release_34@197841
Diffstat (limited to 'test/CodeGenObjC')
85 files changed, 555 insertions, 228 deletions
diff --git a/test/CodeGenObjC/2010-02-09-DbgSelf.m b/test/CodeGenObjC/2010-02-09-DbgSelf.m index e09adac..9aebe3d 100644 --- a/test/CodeGenObjC/2010-02-09-DbgSelf.m +++ b/test/CodeGenObjC/2010-02-09-DbgSelf.m @@ -1,5 +1,7 @@ -// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | grep "\"self\", metadata" +// RUN: %clang_cc1 -x objective-c -emit-llvm -g < %s | FileCheck %s // Test to check that "self" argument is assigned a location. +// CHECK: call void @llvm.dbg.declare(metadata !{%0** %{{[^}]+}}}, metadata [[SELF:![0-9]*]]) +// CHECK: [[SELF]] = {{.*}} ; [ DW_TAG_arg_variable ] [self] @interface Foo -(void) Bar: (int)x ; diff --git a/test/CodeGenObjC/arc-block-copy-escape.m b/test/CodeGenObjC/arc-block-copy-escape.m index 3ba7426..afe7c0b 100644 --- a/test/CodeGenObjC/arc-block-copy-escape.m +++ b/test/CodeGenObjC/arc-block-copy-escape.m @@ -8,14 +8,14 @@ void use_int(int); void test0(int i) { block_t block = ^{ use_int(i); }; - // CHECK: define void @test0( + // CHECK-LABEL: define void @test0( // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) [[NUW:#[0-9]+]], !clang.arc.copy_on_escape // CHECK: ret void } void test1(int i) { id block = ^{ use_int(i); }; - // CHECK: define void @test1( + // CHECK-LABEL: define void @test1( // CHECK: call i8* @objc_retainBlock(i8* {{%.*}}) [[NUW]] // CHECK-NOT: !clang.arc.copy_on_escape // CHECK: ret void diff --git a/test/CodeGenObjC/arc-blocks.m b/test/CodeGenObjC/arc-blocks.m index c9ba2f6..4ba3f05 100644 --- a/test/CodeGenObjC/arc-blocks.m +++ b/test/CodeGenObjC/arc-blocks.m @@ -7,7 +7,7 @@ void test0(id (^maker)(void)) { } int (^test1(int x))(void) { - // CHECK: define i32 ()* @test1( + // CHECK-LABEL: define i32 ()* @test1( // CHECK: [[X:%.*]] = alloca i32, // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK-NEXT: store i32 {{%.*}}, i32* [[X]] @@ -23,7 +23,7 @@ int (^test1(int x))(void) { } void test2(id x) { -// CHECK: define void @test2( +// CHECK-LABEL: define void @test2( // CHECK: [[X:%.*]] = alloca i8*, // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK-NEXT: [[PARM:%.*]] = call i8* @objc_retain(i8* {{%.*}}) @@ -43,7 +43,7 @@ void test2(id x) { extern void test2_helper(id (^)(void)); test2_helper(^{ return x; }); -// CHECK: define internal void @__copy_helper_block_ +// CHECK-LABEL: define internal void @__copy_helper_block_ // CHECK: [[T0:%.*]] = load i8** // CHECK-NEXT: [[SRC:%.*]] = bitcast i8* [[T0]] to [[BLOCK_T]]* // CHECK-NEXT: [[T0:%.*]] = load i8** @@ -53,7 +53,7 @@ void test2(id x) { // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retain(i8* [[T1]]) [[NUW]] // CHECK-NEXT: ret void -// CHECK: define internal void @__destroy_helper_block_ +// CHECK-LABEL: define internal void @__destroy_helper_block_ // CHECK: [[T0:%.*]] = load i8** // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to [[BLOCK_T]]* // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[T1]], i32 0, i32 5 @@ -66,7 +66,7 @@ void test3(void (^sink)(id*)) { __strong id strong; sink(&strong); - // CHECK: define void @test3( + // CHECK-LABEL: define void @test3( // CHECK: [[SINK:%.*]] = alloca void (i8**)* // CHECK-NEXT: [[STRONG:%.*]] = alloca i8* // CHECK-NEXT: [[TEMP:%.*]] = alloca i8* @@ -108,7 +108,7 @@ void test4(void) { __block id var = test4_source(); test4_helper(^{ var = 0; }); - // CHECK: define void @test4() + // CHECK-LABEL: define void @test4() // CHECK: [[VAR:%.*]] = alloca [[BYREF_T:%.*]], // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* [[VAR]], i32 0, i32 2 @@ -130,7 +130,7 @@ void test4(void) { // CHECK-NEXT: call void @objc_release(i8* [[T0]]) // CHECK: ret void - // CHECK: define internal void @__Block_byref_object_copy_ + // CHECK-LABEL: define internal void @__Block_byref_object_copy_ // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* {{%.*}}, i32 0, i32 6 // CHECK-NEXT: load i8** // CHECK-NEXT: bitcast i8* {{%.*}} to [[BYREF_T]]* @@ -139,22 +139,22 @@ void test4(void) { // CHECK-NEXT: store i8* [[T2]], i8** [[T0]] // CHECK-NEXT: store i8* null, i8** [[T1]] - // CHECK: define internal void @__Block_byref_object_dispose_ + // CHECK-LABEL: define internal void @__Block_byref_object_dispose_ // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* {{%.*}}, i32 0, i32 6 // CHECK-NEXT: [[T1:%.*]] = load i8** [[T0]] // CHECK-NEXT: call void @objc_release(i8* [[T1]]) - // CHECK: define internal void @__test4_block_invoke + // CHECK-LABEL: define internal void @__test4_block_invoke // CHECK: [[SLOT:%.*]] = getelementptr inbounds {{.*}}, i32 0, i32 6 // CHECK-NEXT: [[T0:%.*]] = load i8** [[SLOT]], align 8 // CHECK-NEXT: store i8* null, i8** [[SLOT]], // CHECK-NEXT: call void @objc_release(i8* [[T0]]) // CHECK-NEXT: ret void - // CHECK: define internal void @__copy_helper_block_ + // CHECK-LABEL: define internal void @__copy_helper_block_ // CHECK: call void @_Block_object_assign(i8* {{%.*}}, i8* {{%.*}}, i32 8) - // CHECK: define internal void @__destroy_helper_block_ + // CHECK-LABEL: define internal void @__destroy_helper_block_ // CHECK: call void @_Block_object_dispose(i8* {{%.*}}, i32 8) } @@ -164,7 +164,7 @@ void test5(void) { __unsafe_unretained id var = test5_source(); test5_helper(^{ (void) var; }); - // CHECK: define void @test5() + // CHECK-LABEL: define void @test5() // CHECK: [[VAR:%.*]] = alloca i8* // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK: [[T0:%.*]] = call i8* @test5_source() @@ -187,7 +187,7 @@ void test6(void) { __block __weak id var = test6_source(); test6_helper(^{ var = 0; }); - // CHECK: define void @test6() + // CHECK-LABEL: define void @test6() // CHECK: [[VAR:%.*]] = alloca [[BYREF_T:%.*]], // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* [[VAR]], i32 0, i32 2 @@ -209,27 +209,27 @@ void test6(void) { // CHECK-NEXT: call void @objc_destroyWeak(i8** [[SLOT]]) // CHECK: ret void - // CHECK: define internal void @__Block_byref_object_copy_ + // CHECK-LABEL: define internal void @__Block_byref_object_copy_ // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* {{%.*}}, i32 0, i32 6 // CHECK-NEXT: load i8** // CHECK-NEXT: bitcast i8* {{%.*}} to [[BYREF_T]]* // CHECK-NEXT: [[T1:%.*]] = getelementptr inbounds [[BYREF_T]]* {{%.*}}, i32 0, i32 6 // CHECK-NEXT: call void @objc_moveWeak(i8** [[T0]], i8** [[T1]]) - // CHECK: define internal void @__Block_byref_object_dispose_ + // CHECK-LABEL: define internal void @__Block_byref_object_dispose_ // CHECK: [[T0:%.*]] = getelementptr inbounds [[BYREF_T]]* {{%.*}}, i32 0, i32 6 // CHECK-NEXT: call void @objc_destroyWeak(i8** [[T0]]) - // CHECK: define internal void @__test6_block_invoke + // CHECK-LABEL: define internal void @__test6_block_invoke // CHECK: [[SLOT:%.*]] = getelementptr inbounds {{.*}}, i32 0, i32 6 // CHECK-NEXT: call i8* @objc_storeWeak(i8** [[SLOT]], i8* null) // CHECK-NEXT: ret void - // CHECK: define internal void @__copy_helper_block_ + // CHECK-LABEL: define internal void @__copy_helper_block_ // 0x8 - FIELD_IS_BYREF (no FIELD_IS_WEAK because clang in control) // CHECK: call void @_Block_object_assign(i8* {{%.*}}, i8* {{%.*}}, i32 8) - // CHECK: define internal void @__destroy_helper_block_ + // CHECK-LABEL: define internal void @__destroy_helper_block_ // 0x8 - FIELD_IS_BYREF (no FIELD_IS_WEAK because clang in control) // CHECK: call void @_Block_object_dispose(i8* {{%.*}}, i32 8) } @@ -241,7 +241,7 @@ void test7(void) { __weak id var = test7_source(); test7_helper(^{ test7_consume(var); }); - // CHECK: define void @test7() + // CHECK-LABEL: define void @test7() // CHECK: [[VAR:%.*]] = alloca i8*, // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK: [[T0:%.*]] = call i8* @test7_source() @@ -258,19 +258,19 @@ void test7(void) { // CHECK-NEXT: call void @objc_destroyWeak(i8** [[VAR]]) // CHECK: ret void - // CHECK: define internal void @__test7_block_invoke + // CHECK-LABEL: define internal void @__test7_block_invoke // CHECK: [[SLOT:%.*]] = getelementptr inbounds [[BLOCK_T]]* {{%.*}}, i32 0, i32 5 // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_loadWeakRetained(i8** [[SLOT]]) // CHECK-NEXT: call void @test7_consume(i8* [[T0]]) // CHECK-NEXT: call void @objc_release(i8* [[T0]]) // CHECK: ret void - // CHECK: define internal void @__copy_helper_block_ + // CHECK-LABEL: define internal void @__copy_helper_block_ // CHECK: getelementptr // CHECK-NEXT: getelementptr // CHECK-NEXT: call void @objc_copyWeak( - // CHECK: define internal void @__destroy_helper_block_ + // CHECK-LABEL: define internal void @__destroy_helper_block_ // CHECK: getelementptr // CHECK-NEXT: call void @objc_destroyWeak( } @@ -311,7 +311,7 @@ id test9(void) { return test9_produce(); }(); -// CHECK: define i8* @test9( +// CHECK-LABEL: define i8* @test9( // CHECK: load i8** getelementptr // CHECK-NEXT: bitcast i8* // CHECK-NEXT: call i8* @@ -328,7 +328,7 @@ id test9(void) { // when the initialization captures the variable. void test10a(void) { __block void (^block)(void) = ^{ block(); }; - // CHECK: define void @test10a() + // CHECK-LABEL: define void @test10a() // CHECK: [[BYREF:%.*]] = alloca [[BYREF_T:%.*]], // Zero-initialization before running the initializer. @@ -362,7 +362,7 @@ void test10a(void) { // We can also use _Block_object_assign/destroy with // BLOCK_FIELD_IS_BLOCK as long as we don't pass BLOCK_BYREF_CALLER. -// CHECK: define internal void @__Block_byref_object_copy +// CHECK-LABEL: define internal void @__Block_byref_object_copy // CHECK: [[D0:%.*]] = load i8** {{%.*}} // CHECK-NEXT: [[D1:%.*]] = bitcast i8* [[D0]] to [[BYREF_T]]* // CHECK-NEXT: [[D2:%.*]] = getelementptr inbounds [[BYREF_T]]* [[D1]], i32 0, i32 6 @@ -376,7 +376,7 @@ void test10a(void) { // CHECK-NEXT: store void ()* [[T3]], void ()** [[D2]], align 8 // CHECK: ret void -// CHECK: define internal void @__Block_byref_object_dispose +// CHECK-LABEL: define internal void @__Block_byref_object_dispose // CHECK: [[T0:%.*]] = load i8** {{%.*}} // CHECK-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to [[BYREF_T]]* // CHECK-NEXT: [[T2:%.*]] = getelementptr inbounds [[BYREF_T]]* [[T1]], i32 0, i32 6 @@ -391,7 +391,7 @@ void test10b(void) { __block void (^block)(void); block = ^{ block(); }; - // CHECK: define void @test10b() + // CHECK-LABEL: define void @test10b() // CHECK: [[BYREF:%.*]] = alloca [[BYREF_T:%.*]], // Zero-initialize. @@ -427,7 +427,7 @@ void test11a(void) { int x; test11_helper(^{ (void) x; }); - // CHECK: define void @test11a() + // CHECK-LABEL: define void @test11a() // CHECK: [[X:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], align 8 // CHECK: [[T0:%.*]] = bitcast [[BLOCK_T]]* [[BLOCK]] to void ()* @@ -444,7 +444,7 @@ void test11b(void) { int x; id b = ^{ (void) x; }; - // CHECK: define void @test11b() + // CHECK-LABEL: define void @test11b() // CHECK: [[X:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[B:%.*]] = alloca i8*, align 8 // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], align 8 @@ -487,7 +487,7 @@ void test13(id x) { void (^b)(void) = (x ? ^{test13_helper(x);} : 0); test13_use(b); - // CHECK: define void @test13( + // CHECK-LABEL: define void @test13( // CHECK: [[X:%.*]] = alloca i8*, align 8 // CHECK-NEXT: [[B:%.*]] = alloca void ()*, align 8 // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:.*]], align 8 @@ -547,7 +547,7 @@ void test15(int a) { void test16() { void (^BLKVAR)(void) = ^{ BLKVAR(); }; - // CHECK: define void @test16( + // CHECK-LABEL: define void @test16( // CHECK: [[BLKVAR:%.*]] = alloca void ()*, align 8 // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK-NEXT: [[SLOTREL:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5 @@ -567,7 +567,7 @@ id (^test17(id self, int which))(void) { } return (void*) 0; } -// CHECK: define i8* ()* @test17( +// CHECK-LABEL: define i8* ()* @test17( // CHECK: [[RET:%.*]] = alloca i8* ()*, align // CHECK-NEXT: [[SELF:%.*]] = alloca i8*, // CHECK: [[B0:%.*]] = alloca [[BLOCK:<.*>]], align @@ -612,7 +612,7 @@ id (^test17(id self, int which))(void) { // CHECK-NEXT: br label void test18(id x) { -// CHECK-UNOPT: define void @test18( +// CHECK-UNOPT-LABEL: define void @test18( // CHECK-UNOPT: [[X:%.*]] = alloca i8*, // CHECK-UNOPT-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], // CHECK-UNOPT-NEXT: store i8* null, i8** [[X]] @@ -630,7 +630,7 @@ void test18(id x) { extern void test18_helper(id (^)(void)); test18_helper(^{ return x; }); -// CHECK-UNOPT: define internal void @__copy_helper_block_ +// CHECK-UNOPT-LABEL: define internal void @__copy_helper_block_ // CHECK-UNOPT: [[T0:%.*]] = load i8** // CHECK-UNOPT-NEXT: [[SRC:%.*]] = bitcast i8* [[T0]] to [[BLOCK_T]]* // CHECK-UNOPT-NEXT: [[T0:%.*]] = load i8** @@ -642,7 +642,7 @@ void test18(id x) { // CHECK-UNOPT-NEXT: call void @objc_storeStrong(i8** [[T1]], i8* [[T2]]) [[NUW]] // CHECK-UNOPT-NEXT: ret void -// CHECK-UNOPT: define internal void @__destroy_helper_block_ +// CHECK-UNOPT-LABEL: define internal void @__destroy_helper_block_ // CHECK-UNOPT: [[T0:%.*]] = load i8** // CHECK-UNOPT-NEXT: [[T1:%.*]] = bitcast i8* [[T0]] to [[BLOCK_T]]* // CHECK-UNOPT-NEXT: [[T2:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[T1]], i32 0, i32 5 @@ -653,7 +653,7 @@ void test18(id x) { // rdar://13588325 void test19_sink(void (^)(int)); void test19(void (^b)(void)) { -// CHECK: define void @test19( +// CHECK-LABEL: define void @test19( // Prologue. // CHECK: [[B:%.*]] = alloca void ()*, // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], diff --git a/test/CodeGenObjC/arc-bridged-cast.m b/test/CodeGenObjC/arc-bridged-cast.m index eb9045d..cdfe1db 100644 --- a/test/CodeGenObjC/arc-bridged-cast.m +++ b/test/CodeGenObjC/arc-bridged-cast.m @@ -14,7 +14,7 @@ CFStringRef CFGetString(void); id CreateSomething(void); NSString *CreateNSString(void); -// CHECK: define void @bridge_transfer_from_cf +// CHECK-LABEL: define void @bridge_transfer_from_cf void bridge_transfer_from_cf(int *i) { // CHECK: store i32 7 *i = 7; @@ -34,7 +34,7 @@ void bridge_transfer_from_cf(int *i) { // CHECK-NEXT: ret void } -// CHECK: define void @bridge_from_cf +// CHECK-LABEL: define void @bridge_from_cf void bridge_from_cf(int *i) { // CHECK: store i32 7 *i = 7; @@ -53,7 +53,7 @@ void bridge_from_cf(int *i) { // CHECK-NEXT: ret void } -// CHECK: define void @bridge_retained_of_cf +// CHECK-LABEL: define void @bridge_retained_of_cf void bridge_retained_of_cf(int *i) { *i = 7; // CHECK: call i8* @CreateSomething() @@ -70,7 +70,7 @@ void bridge_retained_of_cf(int *i) { // CHECK-NEXT: ret void } -// CHECK: define void @bridge_of_cf +// CHECK-LABEL: define void @bridge_of_cf void bridge_of_cf(int *i) { // CHECK: store i32 7 *i = 7; diff --git a/test/CodeGenObjC/arc-captured-32bit-block-var-layout-2.m b/test/CodeGenObjC/arc-captured-32bit-block-var-layout-2.m index 3072316..6ab02a9 100644 --- a/test/CodeGenObjC/arc-captured-32bit-block-var-layout-2.m +++ b/test/CodeGenObjC/arc-captured-32bit-block-var-layout-2.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout // RUN: FileCheck --input-file=%t-32.layout %s // rdar://12184410 // rdar://12752901 diff --git a/test/CodeGenObjC/arc-captured-32bit-block-var-layout.m b/test/CodeGenObjC/arc-captured-32bit-block-var-layout.m index 7ecdb4b..45a894c 100644 --- a/test/CodeGenObjC/arc-captured-32bit-block-var-layout.m +++ b/test/CodeGenObjC/arc-captured-32bit-block-var-layout.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout // RUN: FileCheck --input-file=%t-32.layout %s // rdar://12184410 // rdar://12752901 diff --git a/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m b/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m index 28c5bb4..89e2b57 100644 --- a/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m +++ b/test/CodeGenObjC/arc-captured-block-var-inlined-layout.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout // RUN: FileCheck --input-file=%t-64.layout %s -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout // RUN: FileCheck -check-prefix=CHECK-i386 --input-file=%t-32.layout %s // rdar://12184410 diff --git a/test/CodeGenObjC/arc-captured-block-var-layout.m b/test/CodeGenObjC/arc-captured-block-var-layout.m index bc20307..42e6060 100644 --- a/test/CodeGenObjC/arc-captured-block-var-layout.m +++ b/test/CodeGenObjC/arc-captured-block-var-layout.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.layout %s +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.layout %s // rdar://12184410 // rdar://12752901 diff --git a/test/CodeGenObjC/arc-exceptions.m b/test/CodeGenObjC/arc-exceptions.m index aa3d2f3..dafffd8 100644 --- a/test/CodeGenObjC/arc-exceptions.m +++ b/test/CodeGenObjC/arc-exceptions.m @@ -11,7 +11,7 @@ void test0(void) { } @catch (Ety *e) { } } -// CHECK: define void @test0() +// CHECK-LABEL: define void @test0() // CHECK: [[E:%.*]] = alloca [[ETY:%.*]]*, align 8 // CHECK-NEXT: invoke void @test0_helper() // CHECK: [[T0:%.*]] = call i8* @objc_begin_catch( @@ -31,7 +31,7 @@ void test1(void) { } @catch (__weak Ety *e) { } } -// CHECK: define void @test1() +// CHECK-LABEL: define void @test1() // CHECK: [[E:%.*]] = alloca [[ETY:%.*]]*, align 8 // CHECK-NEXT: invoke void @test1_helper() // CHECK: [[T0:%.*]] = call i8* @objc_begin_catch( diff --git a/test/CodeGenObjC/arc-foreach.m b/test/CodeGenObjC/arc-foreach.m index 176b28d..4456181 100644 --- a/test/CodeGenObjC/arc-foreach.m +++ b/test/CodeGenObjC/arc-foreach.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -emit-llvm %s -o %t-64.s -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -emit-llvm %s -o %t-64.s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s // rdar://9503326 // rdar://9606600 @@ -22,7 +22,7 @@ void test0(NSArray *array) { } } -// CHECK-LP64: define void @test0( +// CHECK-LP64-LABEL: define void @test0( // CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T:%.*]]*, // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]], @@ -82,7 +82,7 @@ void test0(NSArray *array) { // CHECK-LP64-NEXT: call void @objc_storeStrong(i8** [[T0]], i8* null) // CHECK-LP64-NEXT: ret void -// CHECK-LP64: define internal void @__test0_block_invoke +// CHECK-LP64-LABEL: define internal void @__test0_block_invoke // CHECK-LP64: [[BLOCK:%.*]] = bitcast i8* {{%.*}} to [[BLOCK_T]]* // CHECK-LP64-NOT: ret // CHECK-LP64: [[T0:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5 @@ -95,7 +95,7 @@ void test1(NSArray *array) { } } -// CHECK-LP64: define void @test1( +// CHECK-LP64-LABEL: define void @test1( // CHECK-LP64: alloca [[ARRAY_T:%.*]]*, // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, // CHECK-LP64-NEXT: [[STATE:%.*]] = alloca [[STATE_T:%.*]], @@ -128,7 +128,7 @@ void test2(Test2 *a) { } } -// CHECK-LP64: define void @test2( +// CHECK-LP64-LABEL: define void @test2( // CHECK-LP64: [[T0:%.*]] = call [[ARRAY_T]]* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to [[ARRAY_T]]* (i8*, i8*)*)( // CHECK-LP64-NEXT: [[T1:%.*]] = bitcast [[ARRAY_T]]* [[T0]] to i8* // CHECK-LP64-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) @@ -160,7 +160,7 @@ void test3(NSArray *array) { use(x); } - // CHECK-LP64: define void @test3( + // CHECK-LP64-LABEL: define void @test3( // CHECK-LP64: [[ARRAY:%.*]] = alloca [[ARRAY_T]]*, align 8 // CHECK-LP64-NEXT: [[X:%.*]] = alloca i8*, align 8 // CHECK-LP64: [[T0:%.*]] = load i8** [[X]], align 8 diff --git a/test/CodeGenObjC/arc-ivar-layout.m b/test/CodeGenObjC/arc-ivar-layout.m index 9068314..62428f5 100644 --- a/test/CodeGenObjC/arc-ivar-layout.m +++ b/test/CodeGenObjC/arc-ivar-layout.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -S %s -o %t-64.s -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -S %s -o %t-64.s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s // REQUIRES: x86-64-registered-target // rdar://8991729 diff --git a/test/CodeGenObjC/arc-linetable-autorelease.m b/test/CodeGenObjC/arc-linetable-autorelease.m new file mode 100644 index 0000000..be05ec2 --- /dev/null +++ b/test/CodeGenObjC/arc-linetable-autorelease.m @@ -0,0 +1,40 @@ +// RUN: %clang_cc1 -emit-llvm -fobjc-arc -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// Ensure that the line info is making sense: +// ARC cleanups should be at the closing '}'. +@protocol NSObject +@end + +@interface NSObject <NSObject> {} +@end + +@protocol NSCopying +@end + +@protocol NSCoding +@end + +typedef double CGFloat; +struct CGRect {}; +typedef struct CGRect CGRect; +typedef CGRect NSRect; +NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h); +@interface NSBezierPath : NSObject <NSCopying, NSCoding> ++ (NSBezierPath *)bezierPathWithRoundedRect:(NSRect)rect xRadius:(CGFloat)xRadius yRadius:(CGFloat)yRadius; +@end +@implementation AppDelegate : NSObject {} +- (NSBezierPath *)_createBezierPathWithWidth:(CGFloat)width height:(CGFloat)height radius:(CGFloat)radius lineWidth:(CGFloat)lineWidth +{ + NSRect rect = NSMakeRect(0, 0, width, height); + NSBezierPath *path = [NSBezierPath bezierPathWithRoundedRect:rect xRadius:radius yRadius:radius]; + CGFloat pattern[2]; + // CHECK: define {{.*}}_createBezierPathWithWidth + // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]] + // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC1:[0-9]+]] + // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC2:[0-9]+]] + // CHECK: ret {{.*}} !dbg ![[ARC2]] + // CHECK: ![[RET]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null} + return path; + // CHECK: ![[ARC1]] = metadata !{i32 [[@LINE+2]], i32 0, metadata !{{.*}}, null} + // CHECK: ![[ARC2]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null} +} +@end diff --git a/test/CodeGenObjC/arc-literals.m b/test/CodeGenObjC/arc-literals.m index 78c5d9d..19a5516 100644 --- a/test/CodeGenObjC/arc-literals.m +++ b/test/CodeGenObjC/arc-literals.m @@ -12,7 +12,7 @@ // CHECK: c"dictionaryWithObjects:forKeys:count:\00" // CHECK: c"prop\00" -// CHECK: define void @test_numeric() +// CHECK-LABEL: define void @test_numeric() void test_numeric() { // CHECK: {{call.*objc_msgSend.*i32 17}} // CHECK: call i8* @objc_retainAutoreleasedReturnValue @@ -33,7 +33,7 @@ void test_numeric() { // CHECK-NEXT: ret void } -// CHECK: define void @test_array +// CHECK-LABEL: define void @test_array void test_array(id a, id b) { // CHECK: [[A:%.*]] = alloca i8*, // CHECK: [[B:%.*]] = alloca i8*, @@ -65,7 +65,7 @@ void test_array(id a, id b) { // CHECK-NEXT: ret void } -// CHECK: define void @test_dictionary +// CHECK-LABEL: define void @test_dictionary void test_dictionary(id k1, id o1, id k2, id o2) { // CHECK: [[K1:%.*]] = alloca i8*, // CHECK: [[O1:%.*]] = alloca i8*, @@ -119,7 +119,7 @@ void test_dictionary(id k1, id o1, id k2, id o2) { @property (retain) A* prop; @end -// CHECK: define void @test_property +// CHECK-LABEL: define void @test_property void test_property(B *b) { // Retain parameter // CHECK: call i8* @objc_retain diff --git a/test/CodeGenObjC/arc-loadweakretained-release.m b/test/CodeGenObjC/arc-loadweakretained-release.m index 00d25fa..a84719d 100644 --- a/test/CodeGenObjC/arc-loadweakretained-release.m +++ b/test/CodeGenObjC/arc-loadweakretained-release.m @@ -42,7 +42,7 @@ void test1(int cond) { test34_sink(cond ? &weak : 0); } -// CHECK: define void @test1( +// CHECK-LABEL: define void @test1( // CHECK: [[CONDADDR:%.*]] = alloca i32 // CHECK-NEXT: [[WEAK:%.*]] = alloca i8* // CHECK-NEXT: [[INCRTEMP:%.*]] = alloca i8* diff --git a/test/CodeGenObjC/arc-no-arc-exceptions.m b/test/CodeGenObjC/arc-no-arc-exceptions.m index 008c848..681891b 100644 --- a/test/CodeGenObjC/arc-no-arc-exceptions.m +++ b/test/CodeGenObjC/arc-no-arc-exceptions.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -O2 -disable-llvm-optzns -o - %s | FileCheck %s -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -O0 -disable-llvm-optzns -o - %s | FileCheck -check-prefix=NO-METADATA %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -disable-llvm-optzns -o - %s | FileCheck -check-prefix=NO-METADATA %s // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -O2 -disable-llvm-optzns -o - %s -fobjc-arc-exceptions | FileCheck -check-prefix=NO-METADATA %s // The front-end should emit clang.arc.no_objc_arc_exceptions in -fobjc-arc-exceptions @@ -8,10 +8,10 @@ void thrower(void); void not(void) __attribute__((nothrow)); -// CHECK: define void @test0( +// CHECK-LABEL: define void @test0( // CHECK: call void @thrower(), !clang.arc.no_objc_arc_exceptions ! // CHECK: call void @not() [[NUW:#[0-9]+]], !clang.arc.no_objc_arc_exceptions ! -// NO-METADATA: define void @test0( +// NO-METADATA-LABEL: define void @test0( // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions // NO-METADATA: } void test0(void) { @@ -19,10 +19,10 @@ void test0(void) { not(); } -// CHECK: define void @test1( +// CHECK-LABEL: define void @test1( // CHECK: call void @thrower(), !clang.arc.no_objc_arc_exceptions ! // CHECK: call void @not() [[NUW]], !clang.arc.no_objc_arc_exceptions ! -// NO-METADATA: define void @test1( +// NO-METADATA-LABEL: define void @test1( // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions // NO-METADATA: } void test1(id x) { @@ -33,10 +33,10 @@ void test1(id x) { void NSLog(id, ...); -// CHECK: define void @test2( +// CHECK-LABEL: define void @test2( // CHECK: invoke void (i8*, ...)* @NSLog(i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring_ to i8*), i32* %{{.*}}) // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions ! -// NO-METADATA: define void @test2( +// NO-METADATA-LABEL: define void @test2( // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions // NO-METADATA: } void test2(void) { @@ -46,10 +46,10 @@ void test2(void) { } } -// CHECK: define void @test3( +// CHECK-LABEL: define void @test3( // CHECK: invoke void %{{.*}}(i8* %{{.*}}) // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions ! -// NO-METADATA: define void @test3( +// NO-METADATA-LABEL: define void @test3( // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions // NO-METADATA: } void test3(void) { @@ -61,10 +61,10 @@ void test3(void) { } } -// CHECK: define void @test4( +// CHECK-LABEL: define void @test4( // CHECK: invoke void %{{.*}}(i8* %{{.*}}) // CHECK: to label %{{.*}} unwind label %{{.*}}, !clang.arc.no_objc_arc_exceptions ! -// NO-METADATA: define void @test4( +// NO-METADATA-LABEL: define void @test4( // NO-METADATA-NOT: !clang.arc.no_objc_arc_exceptions // NO-METADATA: } void test4(void) { diff --git a/test/CodeGenObjC/arc-precise-lifetime.m b/test/CodeGenObjC/arc-precise-lifetime.m index 595a4f9..e15d5d4 100644 --- a/test/CodeGenObjC/arc-precise-lifetime.m +++ b/test/CodeGenObjC/arc-precise-lifetime.m @@ -25,11 +25,12 @@ void test0() { // rdar://problem/9821110 @interface Test1 - (char*) interior __attribute__((objc_returns_inner_pointer)); -// Should we allow this on properties? +// Should we allow this on properties? Yes! see // rdar://14990439 +@property (nonatomic, readonly) char * PropertyReturnsInnerPointer __attribute__((objc_returns_inner_pointer)); @end extern Test1 *test1_helper(void); -// CHECK: define void @test1a() +// CHECK-LABEL: define void @test1a() void test1a(void) { // CHECK: [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper() // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* @@ -52,7 +53,7 @@ void test1a(void) { char *c = [(ptr) interior]; } -// CHECK: define void @test1b() +// CHECK-LABEL: define void @test1b() void test1b(void) { // CHECK: [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper() // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* @@ -73,12 +74,56 @@ void test1b(void) { char *c = [ptr interior]; } +void test1c(void) { + // CHECK: [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper() + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]* + // CHECK-NEXT: store [[TEST1]]* [[T3]] + // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]** + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutorelease(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]* + // CHECK-NEXT: [[T4:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[T5:%.*]] = bitcast [[TEST1]]* [[T3]] to i8* + // CHECK-NEXT: [[T6:%.*]] = call i8* bitcast + // CHECK-NEXT: store i8* [[T6]], i8** + // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]** + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[T1]]) [[NUW]], !clang.imprecise_release + // CHECK-NEXT: ret void + Test1 *ptr = test1_helper(); + char *pc = ptr.PropertyReturnsInnerPointer; +} + +void test1d(void) { + // CHECK: [[T0:%.*]] = call [[TEST1:%.*]]* @test1_helper() + // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* + // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) + // CHECK-NEXT: [[T3:%.*]] = bitcast i8* [[T2]] to [[TEST1]]* + // CHECK-NEXT: store [[TEST1]]* [[T3]] + // CHECK-NEXT: [[T0:%.*]] = load [[TEST1]]** + // CHECK-NEXT: [[T2:%.*]] = bitcast [[TEST1]]* [[T0]] to i8* + // CHECK-NEXT: [[T3:%.*]] = call i8* @objc_retainAutorelease + // CHECK-NEXT: [[SIX:%.*]] = bitcast i8* [[T3]] to [[TEST1]]* + // CHECK-NEXT: [[SEVEN:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_ + // CHECK-NEXT: [[EIGHT:%.*]] = bitcast [[TEST1]]* [[SIX]] to i8* + // CHECK-NEXT: [[CALL1:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)(i8* [[EIGHT]], i8* [[SEVEN]]) + // CHECK-NEXT: store i8* [[CALL1]], i8** + // CHECK-NEXT: [[NINE:%.*]] = load [[TEST1]]** + // CHECK-NEXT: [[TEN:%.*]] = bitcast [[TEST1]]* [[NINE]] to i8* + // CHECK-NEXT: call void @objc_release(i8* [[TEN]]) + // CHECK-NEXT: ret void + __attribute__((objc_precise_lifetime)) Test1 *ptr = test1_helper(); + char *pc = ptr.PropertyReturnsInnerPointer; +} + @interface Test2 { @public id ivar; } @end -// CHECK: define void @test2( +// CHECK-LABEL: define void @test2( void test2(Test2 *x) { x->ivar = 0; // CHECK: [[X:%.*]] = alloca [[TEST2:%.*]]* @@ -104,7 +149,7 @@ void test2(Test2 *x) { // CHECK-NEXT: ret void } -// CHECK: define void @test3(i8* +// CHECK-LABEL: define void @test3(i8* void test3(PRECISE_LIFETIME id x) { // CHECK: [[X:%.*]] = alloca i8*, // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_retain(i8* {{%.*}}) [[NUW]] diff --git a/test/CodeGenObjC/arc-property.m b/test/CodeGenObjC/arc-property.m index dde02d7..c3c7e2b 100644 --- a/test/CodeGenObjC/arc-property.m +++ b/test/CodeGenObjC/arc-property.m @@ -7,7 +7,7 @@ void test0(Test0 *t0, id value) { t0.value = value; } -// CHECK: define void @test0( +// CHECK-LABEL: define void @test0( // CHECK: call void @objc_storeStrong // CHECK: call void @objc_storeStrong // CHECK: @objc_msgSend diff --git a/test/CodeGenObjC/arc-related-result-type.m b/test/CodeGenObjC/arc-related-result-type.m index e8b9701..72d2871 100644 --- a/test/CodeGenObjC/arc-related-result-type.m +++ b/test/CodeGenObjC/arc-related-result-type.m @@ -6,7 +6,7 @@ void test0(Test0 *val) { Test0 *x = [val self]; -// CHECK: define void @test0( +// CHECK-LABEL: define void @test0( // CHECK: [[VAL:%.*]] = alloca [[TEST0:%.*]]* // CHECK-NEXT: [[X:%.*]] = alloca [[TEST0]]* // CHECK-NEXT: store [[TEST0]]* null diff --git a/test/CodeGenObjC/arc-ternary-op.m b/test/CodeGenObjC/arc-ternary-op.m index f70e886..217db80 100644 --- a/test/CodeGenObjC/arc-ternary-op.m +++ b/test/CodeGenObjC/arc-ternary-op.m @@ -3,7 +3,7 @@ void test0(_Bool cond) { id test0_helper(void) __attribute__((ns_returns_retained)); - // CHECK: define void @test0( + // CHECK-LABEL: define void @test0( // CHECK: [[COND:%.*]] = alloca i8, // CHECK-NEXT: [[X:%.*]] = alloca i8*, // CHECK-NEXT: [[RELVAL:%.*]] = alloca i8* @@ -40,7 +40,7 @@ void test1(int cond) { test1_sink(cond ? &strong : 0); test1_sink(cond ? &weak : 0); - // CHECK: define void @test1( + // CHECK-LABEL: define void @test1( // CHECK: [[COND:%.*]] = alloca i32 // CHECK-NEXT: [[STRONG:%.*]] = alloca i8* // CHECK-NEXT: [[WEAK:%.*]] = alloca i8* @@ -106,7 +106,7 @@ void test2(int cond) { for (id obj in cond ? test2_producer() : (void*) 0) { } - // CHECK: define void @test2( + // CHECK-LABEL: define void @test2( // CHECK: [[COND:%.*]] = alloca i32, // CHECK: alloca i8* // CHECK: [[CLEANUP_SAVE:%.*]] = alloca i8* diff --git a/test/CodeGenObjC/arc-unopt.m b/test/CodeGenObjC/arc-unopt.m index 84f5d34..c0e67df 100644 --- a/test/CodeGenObjC/arc-unopt.m +++ b/test/CodeGenObjC/arc-unopt.m @@ -55,7 +55,7 @@ void test5(void) { if ((x = y)) y = 0; -// CHECK: define void @test5() +// CHECK-LABEL: define void @test5() // CHECK: [[X:%.*]] = alloca [[TEST5:%.*]]*, // CHECK-NEXT: [[Y:%.*]] = alloca [[TEST5:%.*]]*, // CHECK-NEXT: store [[TEST5]]* null, [[TEST5]]** [[X]], diff --git a/test/CodeGenObjC/arc-unoptimized-byref-var.m b/test/CodeGenObjC/arc-unoptimized-byref-var.m index d3189e1..4a30c6a 100644 --- a/test/CodeGenObjC/arc-unoptimized-byref-var.m +++ b/test/CodeGenObjC/arc-unoptimized-byref-var.m @@ -3,7 +3,7 @@ void test19() { __block id x; -// CHECK-UNOPT: define internal void @__Block_byref_object_copy +// CHECK-UNOPT-LABEL: define internal void @__Block_byref_object_copy // CHECK-UNOPT: [[X:%.*]] = getelementptr inbounds [[BYREF_T:%.*]]* [[VAR:%.*]], i32 0, i32 6 // CHECK-UNOPT: [[X2:%.*]] = getelementptr inbounds [[BYREF_T:%.*]]* [[VAR1:%.*]], i32 0, i32 6 // CHECK-UNOPT-NEXT: [[SIX:%.*]] = load i8** [[X2]], align 8 diff --git a/test/CodeGenObjC/arc-with-atthrow.m b/test/CodeGenObjC/arc-with-atthrow.m index 2570376..e529515 100644 --- a/test/CodeGenObjC/arc-with-atthrow.m +++ b/test/CodeGenObjC/arc-with-atthrow.m @@ -9,7 +9,7 @@ void test() { // TODO: We should probably emit this specific pattern without the reclaim. -// CHECK: define void @test() +// CHECK-LABEL: define void @test() // CHECK: [[T0:%.*]] = call i8* @make() // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_autorelease(i8* [[T1]]) diff --git a/test/CodeGenObjC/arc.m b/test/CodeGenObjC/arc.m index 7262dc8..00cdb6f 100644 --- a/test/CodeGenObjC/arc.m +++ b/test/CodeGenObjC/arc.m @@ -32,7 +32,7 @@ // ARC-NATIVE: declare i8* @objc_autorelease(i8*) // ARC-NATIVE: declare i8* @objc_retainAutorelease(i8*) -// CHECK: define void @test0 +// CHECK-LABEL: define void @test0 void test0(id x) { // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: [[PARM:%.*]] = call i8* @objc_retain(i8* {{.*}}) @@ -42,7 +42,7 @@ void test0(id x) { // CHECK-NEXT: ret void } -// CHECK: define i8* @test1(i8* +// CHECK-LABEL: define i8* @test1(i8* id test1(id x) { // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: [[Y:%.*]] = alloca i8* @@ -94,7 +94,7 @@ id test1(id x) { - (id) copy; @end -// CHECK: define void @test3_unelided() +// CHECK-LABEL: define void @test3_unelided() void test3_unelided() { extern void test3_helper(void); @@ -125,7 +125,7 @@ void test3_unelided() { // CHECK-NEXT: ret void } -// CHECK: define void @test3() +// CHECK-LABEL: define void @test3() void test3() { // CHECK: [[X:%.*]] = alloca i8* @@ -166,7 +166,7 @@ void test3() { // CHECK-NEXT: ret void } -// CHECK: define i8* @test4() +// CHECK-LABEL: define i8* @test4() id test4() { // Call to +alloc. // CHECK: load {{.*}}* @"\01L_OBJC_CLASSLIST_REFERENCES_ @@ -197,7 +197,7 @@ id test4() { } @end -// CHECK: define void @test5 +// CHECK-LABEL: define void @test5 void test5(Test5 *x, id y) { // Prologue. // CHECK: [[X:%.*]] = alloca [[TEST5:%.*]]*, @@ -241,7 +241,7 @@ void test5(Test5 *x, id y) { } id test6_helper(void) __attribute__((ns_returns_retained)); -// CHECK: define void @test6() +// CHECK-LABEL: define void @test6() void test6() { // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: [[CALL:%.*]] = call i8* @test6_helper() @@ -253,7 +253,7 @@ void test6() { } void test7_helper(id __attribute__((ns_consumed))); -// CHECK: define void @test7() +// CHECK-LABEL: define void @test7() void test7() { // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: store i8* null, i8** [[X]] @@ -284,7 +284,7 @@ void test10() { Test10 *x; id y = x.me.me; - // CHECK: define void @test10() + // CHECK-LABEL: define void @test10() // CHECK: [[X:%.*]] = alloca [[TEST10:%.*]]*, align // CHECK-NEXT: [[Y:%.*]] = alloca i8*, align // CHECK-NEXT: store [[TEST10]]* null, [[TEST10]]** [[X]] @@ -314,7 +314,7 @@ void test10() { } void test11(id (*f)(void) __attribute__((ns_returns_retained))) { - // CHECK: define void @test11( + // CHECK-LABEL: define void @test11( // CHECK: [[F:%.*]] = alloca i8* ()*, align // CHECK-NEXT: [[X:%.*]] = alloca i8*, align // CHECK-NEXT: store i8* ()* {{%.*}}, i8* ()** [[F]], align @@ -330,7 +330,7 @@ void test11(id (*f)(void) __attribute__((ns_returns_retained))) { void test12(void) { extern id test12_helper(void); - // CHECK: define void @test12() + // CHECK-LABEL: define void @test12() // CHECK: [[X:%.*]] = alloca i8*, align // CHECK-NEXT: [[Y:%.*]] = alloca i8*, align @@ -358,7 +358,7 @@ void test12(void) { // Indirect consuming calls. void test13(void) { - // CHECK: define void @test13() + // CHECK-LABEL: define void @test13() // CHECK: [[X:%.*]] = alloca i8*, align // CHECK-NEXT: store i8* null, i8** [[X]], align id x; @@ -458,7 +458,7 @@ void test13(void) { @end void test19() { - // CHECK: define void @test19() + // CHECK-LABEL: define void @test19() // CHECK: [[X:%.*]] = alloca [5 x i8*], align 16 // CHECK: call void @llvm.lifetime.start // CHECK-NEXT: [[T0:%.*]] = bitcast [5 x i8*]* [[X]] to i8* @@ -490,7 +490,7 @@ void test19() { } void test20(unsigned n) { - // CHECK: define void @test20 + // CHECK-LABEL: define void @test20 // CHECK: [[N:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[SAVED_STACK:%.*]] = alloca i8* // CHECK-NEXT: store i32 {{%.*}}, i32* [[N]], align 4 @@ -531,7 +531,7 @@ void test20(unsigned n) { } void test21(unsigned n) { - // CHECK: define void @test21 + // CHECK-LABEL: define void @test21 // CHECK: [[N:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[SAVED_STACK:%.*]] = alloca i8* // CHECK-NEXT: store i32 {{%.*}}, i32* [[N]], align 4 @@ -829,7 +829,7 @@ char *helper; @end __attribute__((ns_returns_retained)) id test32(void) { -// CHECK: define i8* @test32() +// CHECK-LABEL: define i8* @test32() // CHECK: [[CALL:%.*]] = call i8* @test32_helper() // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[CALL]]) // CHECK-NEXT: ret i8* [[T0]] @@ -932,7 +932,7 @@ void test33(Test33 *ptr) { } -// CHECK: define void @test36 +// CHECK-LABEL: define void @test36 void test36(id x) { // CHECK: [[X:%.*]] = alloca i8* @@ -960,7 +960,7 @@ void test37(void) { Test37 *var; test37_helper(&var); - // CHECK: define void @test37() + // CHECK-LABEL: define void @test37() // CHECK: [[VAR:%.*]] = alloca [[TEST37:%.*]]*, // CHECK-NEXT: [[TEMP:%.*]] = alloca i8* // CHECK-NEXT: store [[TEST37]]* null, [[TEST37]]** [[VAR]] @@ -1037,7 +1037,7 @@ void test47(void) { extern id test47_helper(void); id x = x = test47_helper(); - // CHECK: define void @test47() + // CHECK-LABEL: define void @test47() // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: store i8* null, i8** [[X]] // CHECK-NEXT: [[CALL:%.*]] = call i8* @test47_helper() @@ -1057,7 +1057,7 @@ void test47(void) { void test48(void) { extern id test48_helper(void); __weak id x = x = test48_helper(); - // CHECK: define void @test48() + // CHECK-LABEL: define void @test48() // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: [[T0:%.*]] = call i8* @objc_initWeak(i8** [[X]], i8* null) // CHECK-NEXT: [[T1:%.*]] = call i8* @test48_helper() @@ -1072,7 +1072,7 @@ void test48(void) { void test49(void) { extern id test49_helper(void); __autoreleasing id x = x = test49_helper(); - // CHECK: define void @test49() + // CHECK-LABEL: define void @test49() // CHECK: [[X:%.*]] = alloca i8* // CHECK-NEXT: store i8* null, i8** [[X]] // CHECK-NEXT: [[CALL:%.*]] = call i8* @test49_helper() @@ -1113,13 +1113,16 @@ id test52(void) { id test52_helper(int) __attribute__((ns_returns_retained)); return ({ int x = 5; test52_helper(x); }); -// CHECK: define i8* @test52() +// CHECK-LABEL: define i8* @test52() // CHECK: [[X:%.*]] = alloca i32 +// CHECK-NEXT: [[TMPALLOCA:%.*]] = alloca i8* // CHECK-NEXT: store i32 5, i32* [[X]], // CHECK-NEXT: [[T0:%.*]] = load i32* [[X]], // CHECK-NEXT: [[T1:%.*]] = call i8* @test52_helper(i32 [[T0]]) -// CHECK-NEXT: [[T2:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[T1]]) -// CHECK-NEXT: ret i8* [[T2]] +// CHECK-NEXT: store i8* [[T1]], i8** [[TMPALLOCA]] +// CHECK-NEXT: [[T2:%.*]] = load i8** [[TMPALLOCA]] +// CHECK-NEXT: [[T3:%.*]] = tail call i8* @objc_autoreleaseReturnValue(i8* [[T2]]) +// CHECK-NEXT: ret i8* [[T3]] } // rdar://problem/9400644 @@ -1127,17 +1130,20 @@ void test53(void) { id test53_helper(void); id x = ({ id y = test53_helper(); y; }); (void) x; -// CHECK: define void @test53() +// CHECK-LABEL: define void @test53() // CHECK: [[X:%.*]] = alloca i8*, // CHECK-NEXT: [[Y:%.*]] = alloca i8*, +// CHECK-NEXT: [[TMPALLOCA:%.*]] = alloca i8*, // CHECK-NEXT: [[T0:%.*]] = call i8* @test53_helper() // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) // CHECK-NEXT: store i8* [[T1]], i8** [[Y]], // CHECK-NEXT: [[T0:%.*]] = load i8** [[Y]], // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retain(i8* [[T0]]) +// CHECK-NEXT: store i8* [[T1]], i8** [[TMPALLOCA]] // CHECK-NEXT: [[T2:%.*]] = load i8** [[Y]] // CHECK-NEXT: call void @objc_release(i8* [[T2]]) -// CHECK-NEXT: store i8* [[T1]], i8** [[X]], +// CHECK-NEXT: [[T3:%.*]] = load i8** [[TMPALLOCA]] +// CHECK-NEXT: store i8* [[T3]], i8** [[X]], // CHECK-NEXT: load i8** [[X]], // CHECK-NEXT: [[T0:%.*]] = load i8** [[X]] // CHECK-NEXT: call void @objc_release(i8* [[T0]]) @@ -1145,7 +1151,7 @@ void test53(void) { } // <rdar://problem/9758798> -// CHECK: define void @test54(i32 %first, ...) +// CHECK-LABEL: define void @test54(i32 %first, ...) void test54(int first, ...) { __builtin_va_list arglist; // CHECK: call void @llvm.va_start @@ -1185,7 +1191,7 @@ void test54(int first, ...) { @end void test56_test(void) { id x = [Test56 make]; - // CHECK: define void @test56_test() + // CHECK-LABEL: define void @test56_test() // CHECK: [[X:%.*]] = alloca i8*, align 8 // CHECK: [[T0:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*)*)( // CHECK-NEXT: store i8* [[T0]], i8** [[X]] @@ -1239,7 +1245,7 @@ void test59(void) { test59_body(); } - // CHECK: define void @test59() + // CHECK-LABEL: define void @test59() // CHECK: [[T0:%.*]] = call i8* @test59_getlock() // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) // CHECK-NEXT: call i32 @objc_sync_enter(i8* [[T1]]) @@ -1257,7 +1263,7 @@ void test59(void) { - (id) test61_id; @end void test61(void) { - // CHECK: define void @test61() + // CHECK-LABEL: define void @test61() // CHECK: [[Y:%.*]] = alloca i8*, align 8 extern id test61_make(void); @@ -1287,7 +1293,7 @@ void test61(void) { // rdar://problem/9891815 void test62(void) { - // CHECK: define void @test62() + // CHECK-LABEL: define void @test62() // CHECK: [[I:%.*]] = alloca i32, align 4 // CHECK-NEXT: [[CLEANUP_VALUE:%.*]] = alloca i8* // CHECK-NEXT: [[CLEANUP_REQUIRED:%.*]] = alloca i1 @@ -1359,7 +1365,7 @@ void test66(void) { extern id test66_arg(void); [test66_receiver() consume: test66_arg()]; } -// CHECK: define void @test66() +// CHECK-LABEL: define void @test66() // CHECK: [[T0:%.*]] = call [[TEST66:%.*]]* @test66_receiver() // CHECK-NEXT: [[T1:%.*]] = bitcast [[TEST66]]* [[T0]] to i8* // CHECK-NEXT: [[T2:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T1]]) @@ -1383,7 +1389,7 @@ Class test67_helper(void); void test67(void) { Class cl = test67_helper(); } -// CHECK: define void @test67() +// CHECK-LABEL: define void @test67() // CHECK: [[CL:%.*]] = alloca i8*, align 8 // CHECK-NEXT: [[T0:%.*]] = call i8* @test67_helper() // CHECK-NEXT: store i8* [[T0]], i8** [[CL]], align 8 @@ -1393,7 +1399,7 @@ Class test68_helper(void); void test68(void) { __strong Class cl = test67_helper(); } -// CHECK: define void @test68() +// CHECK-LABEL: define void @test68() // CHECK: [[CL:%.*]] = alloca i8*, align 8 // CHECK-NEXT: [[T0:%.*]] = call i8* @test67_helper() // CHECK-NEXT: [[T1:%.*]] = call i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) @@ -1415,7 +1421,7 @@ void test68(void) { // rdar://problem/10907547 void test70(id i) { - // CHECK: define void @test70 + // CHECK-LABEL: define void @test70 // CHECK: store i8* null, i8** // CHECK: store i8* null, i8** // CHECK: [[ID:%.*]] = call i8* @objc_retain(i8* diff --git a/test/CodeGenObjC/assign.m b/test/CodeGenObjC/assign.m index bdc99c6..7d0c06f 100644 --- a/test/CodeGenObjC/assign.m +++ b/test/CodeGenObjC/assign.m @@ -12,7 +12,7 @@ struct s0 { // Check that we get exactly the message sends we expect, and no more. // -// CHECK: define void @f0 +// CHECK-LABEL: define void @f0 void f0(C0 *a) { // CHECK: objc_msgSend int l0 = (a.x0 = 1); diff --git a/test/CodeGenObjC/atomic-aggregate-property.m b/test/CodeGenObjC/atomic-aggregate-property.m index 878255b..1b9cb8f 100644 --- a/test/CodeGenObjC/atomic-aggregate-property.m +++ b/test/CodeGenObjC/atomic-aggregate-property.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CHECK-LP64 %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CHECK-LP64 %s // rdar: // 7849824 // <rdar://problem/12547611> diff --git a/test/CodeGenObjC/auto-property-synthesize-protocol.m b/test/CodeGenObjC/auto-property-synthesize-protocol.m index 49a4037..e0c5489 100644 --- a/test/CodeGenObjC/auto-property-synthesize-protocol.m +++ b/test/CodeGenObjC/auto-property-synthesize-protocol.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin -fobjc-default-synthesize-properties -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s // rdar://10907410 @protocol P diff --git a/test/CodeGenObjC/autorelease.m b/test/CodeGenObjC/autorelease.m index f89b81a..4b81017 100644 --- a/test/CodeGenObjC/autorelease.m +++ b/test/CodeGenObjC/autorelease.m @@ -39,7 +39,7 @@ int tryTo(int (*f)(void)) { return 0; } } -// CHECK: define i32 @tryTo(i32 ()* +// CHECK-LABEL: define i32 @tryTo(i32 ()* // CHECK: [[RET:%.*]] = alloca i32, // CHECK: [[T0:%.*]] = call i8* @objc_autoreleasePoolPush() // CHECK-NEXT: [[T1:%.*]] = load i32 ()** {{%.*}}, diff --git a/test/CodeGenObjC/bitfield-access.m b/test/CodeGenObjC/bitfield-access.m index 597fe35..2b8039d 100644 --- a/test/CodeGenObjC/bitfield-access.m +++ b/test/CodeGenObjC/bitfield-access.m @@ -14,7 +14,7 @@ // Check that we don't try to use an i32 load here, which would reach beyond the // end of the structure. // -// CHECK-I386: define i32 @f0( +// CHECK-I386-LABEL: define i32 @f0( // CHECK-I386: [[t0_0:%.*]] = load i8* {{.*}}, align 1 // CHECK-I386: lshr i8 [[t0_0]], 7 // CHECK-I386: } @@ -24,7 +24,7 @@ int f0(I0 *a) { // Check that we can handled straddled loads. // -// CHECK-ARM: define i32 @f1( +// CHECK-ARM-LABEL: define i32 @f1( // CHECK-ARM: [[t1_ptr:%.*]] = getelementptr // CHECK-ARM: [[t1_base:%.*]] = bitcast i8* [[t1_ptr]] to i40* // CHECK-ARM: [[t1_0:%.*]] = load i40* [[t1_base]], align 1 diff --git a/test/CodeGenObjC/bitfield-ivar-offsets.m b/test/CodeGenObjC/bitfield-ivar-offsets.m index 7a07f27..f17d56a 100644 --- a/test/CodeGenObjC/bitfield-ivar-offsets.m +++ b/test/CodeGenObjC/bitfield-ivar-offsets.m @@ -6,7 +6,7 @@ // RUN: grep -F '@"OBJC_IVAR_$_I0._b3" = global i64 4, section "__DATA, __objc_ivar", align 8' %t // RUN: grep -F '@"OBJC_IVAR_$_I0._y" = global i64 6, section "__DATA, __objc_ivar", align 8' %t // RUN: grep -F '@"OBJC_IVAR_$_I0._b4" = global i64 7, section "__DATA, __objc_ivar", align 8' %t -// RUN: grep -F '@"OBJC_IVAR_$_I0." = global' %t | count 0 +// RUN: not grep -F '@"OBJC_IVAR_$_I0." = global' %t @interface I0 { unsigned _b0:4; diff --git a/test/CodeGenObjC/block-6.m b/test/CodeGenObjC/block-6.m index 57b9ea3..b04b189 100644 --- a/test/CodeGenObjC/block-6.m +++ b/test/CodeGenObjC/block-6.m @@ -2,7 +2,7 @@ // rdar://8893785 void MYFUNC() { -// CHECK: define void @MYFUNC() +// CHECK-LABEL: define void @MYFUNC() // CHECK: [[OBSERVER_SLOT:%.*]] = alloca [[OBSERVER_T:%.*]], align 8 // CHECK: [[T0:%.*]] = getelementptr inbounds [[OBSERVER_T]]* [[OBSERVER_SLOT]], i32 0, i32 1 diff --git a/test/CodeGenObjC/block-byref-debuginfo.m b/test/CodeGenObjC/block-byref-debuginfo.m new file mode 100644 index 0000000..88a8d8d --- /dev/null +++ b/test/CodeGenObjC/block-byref-debuginfo.m @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -g -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s + +// rdar://problem/14386148 +// Test that the foo is aligned at an 8 byte boundary in the DWARF +// expression (256) that locates it inside of the byref descriptor: +// CHECK: metadata !"foo", i32 0, i64 {{[0-9]+}}, i64 64, i64 256, i32 0, metadata + +struct Foo { + unsigned char *data; +}; +int func() { + __attribute__((__blocks__(byref))) struct Foo foo; + return 0; +} diff --git a/test/CodeGenObjC/block-byref-variable-layout.m b/test/CodeGenObjC/block-byref-variable-layout.m index 9c8f674..a03617b 100644 --- a/test/CodeGenObjC/block-byref-variable-layout.m +++ b/test/CodeGenObjC/block-byref-variable-layout.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -fblocks -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s // rdar://12759433 @class NSString; diff --git a/test/CodeGenObjC/block-var-layout.m b/test/CodeGenObjC/block-var-layout.m index ab95231..0ad44da 100644 --- a/test/CodeGenObjC/block-var-layout.m +++ b/test/CodeGenObjC/block-var-layout.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.layout %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.layout %s // rdar://12752901 struct S { diff --git a/test/CodeGenObjC/blocks-1.m b/test/CodeGenObjC/blocks-1.m index 99a11f9..0d2c350 100644 --- a/test/CodeGenObjC/blocks-1.m +++ b/test/CodeGenObjC/blocks-1.m @@ -4,7 +4,7 @@ // RUN: grep "__destroy_helper_block_" %t | count 4 // RUN: grep "__Block_byref_object_copy_" %t | count 2 // RUN: grep "__Block_byref_object_dispose_" %t | count 2 -// RUN: grep "i32 135)" %t | count 0 +// RUN: not grep "i32 135)" %t // RUN: grep "_Block_object_assign" %t | count 4 // RUN: grep "objc_read_weak" %t | count 2 // RUN: grep "objc_assign_weak" %t | count 3 @@ -14,7 +14,7 @@ // RUN: grep "__destroy_helper_block_" %t | count 4 // RUN: grep "__Block_byref_object_copy_" %t | count 2 // RUN: grep "__Block_byref_object_dispose_" %t | count 2 -// RUN: grep "i32 135)" %t | count 0 +// RUN: not grep "i32 135)" %t // RUN: grep "_Block_object_assign" %t | count 4 // RUN: grep "objc_read_weak" %t | count 2 // RUN: grep "objc_assign_weak" %t | count 3 diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m index 3718ad5..5245679 100644 --- a/test/CodeGenObjC/blocks.m +++ b/test/CodeGenObjC/blocks.m @@ -7,7 +7,7 @@ struct S { @interface T - - (int)foo: (T (^)(T*)) x; + - (int)foo: (T* (^)(T*)) x; @end void foo(T *P) { @@ -43,7 +43,7 @@ void foo(T *P) { @interface Test2 -(void) destroy; @end void test2(Test2 *x) { extern void test2_helper(void (^)(void)); - // CHECK: define void @test2( + // CHECK-LABEL: define void @test2( // CHECK: [[X:%.*]] = alloca [[TEST2:%.*]]*, // CHECK-NEXT: [[WEAKX:%.*]] = alloca [[WEAK_T:%.*]], // CHECK-NEXT: [[BLOCK:%.*]] = alloca [[BLOCK_T:<{.*}>]], @@ -91,7 +91,7 @@ void test2(Test2 *x) { // rdar://problem/9124263 // In the test above, check that the use in the invocation function // doesn't require a read barrier. -// CHECK: define internal void @__test2_block_invoke +// CHECK-LABEL: define internal void @__test2_block_invoke // CHECK: [[BLOCK:%.*]] = bitcast i8* {{%.*}} to [[BLOCK_T]]* // CHECK-NOT: bitcast // CHECK: [[T0:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5 @@ -107,7 +107,7 @@ void test2(Test2 *x) { void test3(void (^block)(int, ...)) { block(0, 1, 2, 3); } -// CHECK: define void @test3( +// CHECK-LABEL: define void @test3( // CHECK: [[BLOCK:%.*]] = alloca void (i32, ...)*, align 4 // CHECK-NEXT: store void (i32, ...)* // CHECK-NEXT: [[T0:%.*]] = load void (i32, ...)** [[BLOCK]], align 4 @@ -122,7 +122,7 @@ void test3(void (^block)(int, ...)) { void test4(void (^block)()) { block(0, 1, 2, 3); } -// CHECK: define void @test4( +// CHECK-LABEL: define void @test4( // CHECK: [[BLOCK:%.*]] = alloca void (...)*, align 4 // CHECK-NEXT: store void (...)* // CHECK-NEXT: [[T0:%.*]] = load void (...)** [[BLOCK]], align 4 diff --git a/test/CodeGenObjC/builtins.m b/test/CodeGenObjC/builtins.m index 0c57448..37d8c7a 100644 --- a/test/CodeGenObjC/builtins.m +++ b/test/CodeGenObjC/builtins.m @@ -3,5 +3,5 @@ void test0(id receiver, SEL sel, const char *str) { short s = ((short (*)(id, SEL, const char*)) objc_msgSend)(receiver, sel, str); } -// CHECK: define void @test0( +// CHECK-LABEL: define void @test0( // CHECK: call signext i16 bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i16 (i8*, i8*, i8*)*)( diff --git a/test/CodeGenObjC/complex-property.m b/test/CodeGenObjC/complex-property.m index 8c3aef9..d65d72f 100644 --- a/test/CodeGenObjC/complex-property.m +++ b/test/CodeGenObjC/complex-property.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix CHECK-LP64 %s // rdar: // 7351147 @interface A diff --git a/test/CodeGenObjC/debug-info-block-line.m b/test/CodeGenObjC/debug-info-block-line.m index 2192575..1965e1d 100644 --- a/test/CodeGenObjC/debug-info-block-line.m +++ b/test/CodeGenObjC/debug-info-block-line.m @@ -1,5 +1,5 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -emit-llvm -fblocks -fobjc-default-synthesize-properties -fobjc-arc -O0 -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -fblocks -fobjc-arc -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s // rdar://11562117 typedef unsigned int NSUInteger; diff --git a/test/CodeGenObjC/debug-info-blocks.m b/test/CodeGenObjC/debug-info-blocks.m index 3d91c9e..63068a9 100644 --- a/test/CodeGenObjC/debug-info-blocks.m +++ b/test/CodeGenObjC/debug-info-blocks.m @@ -2,16 +2,31 @@ // rdar://problem/9279956 // Test that we generate the proper debug location for a captured self. -// The second half of this patch is in llvm/tests/DebugInfo/debug-info-blocks.ll +// The second half of this test is in llvm/tests/DebugInfo/debug-info-blocks.ll // CHECK: define {{.*}}_block_invoke // CHECK: %[[BLOCK:.*]] = bitcast i8* %.block_descriptor to <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>*, !dbg // CHECK-NEXT: store <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>* %[[BLOCK]], <{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** %[[ALLOCA:.*]], align // CHECK-NEXT: call void @llvm.dbg.declare(metadata !{<{ i8*, i32, i32, i8*, %struct.__block_descriptor*, %0* }>** %[[ALLOCA]]}, metadata ![[SELF:[0-9]+]]) // CHECK-NEXT: call void @llvm.dbg.declare(metadata !{%1** %d}, metadata ![[D:[0-9]+]]) -// CHECK: ![[SELF]] = {{.*}} [ DW_TAG_auto_variable ] [self] [line 51] -// CHECK: ![[D]] = {{.*}} [d] [line 49] +// rdar://problem/14386148 +// Test that we don't emit bogus line numbers for the helper functions. +// Test that we do emit scope info for the helper functions. +// CHECK: define {{.*}} @__copy_helper_block_{{.*}}(i8*, i8*) +// CHECK-NOT: ret +// CHECK: call {{.*}}, !dbg ![[DBG_LINE:[0-9]+]] +// CHECK-NOT: ret +// CHECK: load {{.*}}, !dbg ![[COPY_LINE:[0-9]+]] +// CHECK: define {{.*}} @__destroy_helper_block_{{.*}}(i8*) +// CHECK-NOT: ret +// CHECK: load {{.*}}, !dbg ![[DESTROY_LINE:[0-9]+]] + +// CHECK-DAG: [[DBG_LINE]] = metadata !{i32 0, i32 0, metadata ![[COPY_SP:[0-9]+]], null} +// CHECK-DAG: [[COPY_LINE]] = metadata !{i32 0, i32 0, metadata ![[COPY_SP:[0-9]+]], null} +// CHECK-DAG: [[COPY_SP]] = {{.*}}[ DW_TAG_subprogram ]{{.*}}[__copy_helper_block_] +// CHECK-DAG: [[DESTROY_LINE]] = metadata !{i32 0, i32 0, metadata ![[DESTROY_SP:[0-9]+]], null} +// CHECK-DAG: [[DESTROY_SP]] = {{.*}}[ DW_TAG_subprogram ]{{.*}}[__destroy_helper_block_] typedef unsigned int NSUInteger; @protocol NSObject @@ -46,6 +61,8 @@ static void run(void (^block)(void)) { if ((self = [super init])) { run(^{ + // CHECK-DAG: ![[SELF]] = {{.*}} [ DW_TAG_auto_variable ] [self] [line [[@LINE+4]]] + // CHECK-DAG: ![[D]] = {{.*}} [d] [line [[@LINE+1]]] NSMutableDictionary *d = [[NSMutableDictionary alloc] init]; ivar = 42 + (int)[d count]; }); diff --git a/test/CodeGenObjC/debug-info-default-synth-ivar.m b/test/CodeGenObjC/debug-info-default-synth-ivar.m index 30d751e..e9045ec 100644 --- a/test/CodeGenObjC/debug-info-default-synth-ivar.m +++ b/test/CodeGenObjC/debug-info-default-synth-ivar.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-default-synthesize-properties -emit-llvm -g %s -o %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -g %s -o %t // RUN: grep DW_TAG_member %t | count 5 // rdar://8493239 diff --git a/test/CodeGenObjC/debug-info-fwddecl.m b/test/CodeGenObjC/debug-info-fwddecl.m index b41c485..b43d7c0 100644 --- a/test/CodeGenObjC/debug-info-fwddecl.m +++ b/test/CodeGenObjC/debug-info-fwddecl.m @@ -2,4 +2,4 @@ @class ForwardObjcClass; ForwardObjcClass *ptr = 0; -// CHECK: {{.*}} [ DW_TAG_structure_type ] [ForwardObjcClass] [line 2, size 0, align 0, offset 0] [fwd] +// CHECK: {{.*}} [ DW_TAG_structure_type ] [ForwardObjcClass] [line 2, size 0, align 0, offset 0] [decl] diff --git a/test/CodeGenObjC/debug-info-id-with-protocol.m b/test/CodeGenObjC/debug-info-id-with-protocol.m index db1a3ef..7e96baf 100644 --- a/test/CodeGenObjC/debug-info-id-with-protocol.m +++ b/test/CodeGenObjC/debug-info-id-with-protocol.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-default-synthesize-properties -emit-llvm -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -g %s -o - | FileCheck %s __attribute((objc_root_class)) @interface NSObject { id isa; } @@ -36,6 +36,6 @@ int main() } } // Verify that the debug type for both variables is 'id'. -// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"bad_carrier", metadata !{{[0-9]+}}, i32 {{[0-9]+}}, metadata ![[IDTYPE:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [bad_carrier] [line 21] -// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"good_carrier", metadata !{{[0-9]+}}, i32 {{[0-9]+}}, metadata !{{.*}}[[IDTYPE]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [good_carrier] [line 22] +// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"bad_carrier", null, i32 {{[0-9]+}}, metadata ![[IDTYPE:[0-9]+]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [bad_carrier] [line 0] +// CHECK: metadata !{i32 {{[0-9]+}}, metadata !{{[0-9]+}}, metadata !"good_carrier", null, i32 {{[0-9]+}}, metadata !{{.*}}[[IDTYPE]], i32 0, i32 0} ; [ DW_TAG_arg_variable ] [good_carrier] [line 0] // CHECK !{{.*}}[[IDTYPE]] = metadata !{i32 {{[0-9]+}}, null, metadata !"id", metadata !{{[0-9]+}}, i32 !{{[0-9]+}}, i64 0, i64 0, i64 0, i32 0, metadata !{{[0-9]+}}} ; [ DW_TAG_typedef ] [id] diff --git a/test/CodeGenObjC/debug-info-instancetype.m b/test/CodeGenObjC/debug-info-instancetype.m new file mode 100644 index 0000000..1c15517 --- /dev/null +++ b/test/CodeGenObjC/debug-info-instancetype.m @@ -0,0 +1,28 @@ +// RUN: %clang_cc1 -emit-llvm -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s +// rdar://problem/13359718 +// Substitute the actual type for a method returning instancetype. +@interface NSObject ++ (id)alloc; +- (id)init; +- (id)retain; +@end + +@interface Foo : NSObject ++ (instancetype)defaultFoo; +@end + +@implementation Foo ++(instancetype)defaultFoo {return 0;} +// CHECK: ![[FOO:[0-9]+]] = metadata {{.*}}; [ DW_TAG_structure_type ] [Foo] +// CHECK: metadata !"+[Foo defaultFoo]", metadata !"", i32 [[@LINE-2]], metadata ![[TYPE:[0-9]+]] +// CHECK: ![[TYPE]] = {{.*}} metadata ![[RESULT:[0-9]+]], i32 {{.*}}, null, null, null} ; [ DW_TAG_subroutine_type ] +// CHECK: ![[RESULT]] = metadata {{.*}}{metadata ![[FOOPTR:[0-9]+]], +// CHECK: ![[FOOPTR]] = {{.*}}, metadata ![[FOO]]}{{.*}}[ DW_TAG_pointer_type ] {{.*}} [from Foo] +@end + + +int main (int argc, const char *argv[]) +{ + Foo *foo = [Foo defaultFoo]; + return 0; +} diff --git a/test/CodeGenObjC/debug-info-lifetime-crash.m b/test/CodeGenObjC/debug-info-lifetime-crash.m new file mode 100644 index 0000000..9038201 --- /dev/null +++ b/test/CodeGenObjC/debug-info-lifetime-crash.m @@ -0,0 +1,23 @@ +// RUN: %clang_cc1 -cc1 -triple arm-apple-ios -emit-llvm -g -fblocks -fobjc-runtime=ios-7.0.0 -fobjc-arc %s -o - | FileCheck %s +// rdar://problem/14990656 +@protocol NSObject +- (id)copy; +@end +@class W; +@interface View1 +@end +@implementation Controller { + void (^Block)(void); +} +- (void)View:(View1 *)View foo:(W *)W +{ + // The debug type for these two will be identical, because we do not + // actually emit the ownership qualifier. + // CHECK-DAG: metadata !"weakSelf", metadata !{{[0-9]+}}, i32 [[@LINE+1]], metadata ![[SELFTY:[0-9]+]], i32 0, i32 0, {{.*}}} ; [ DW_TAG_auto_variable ] [weakSelf] + __attribute__((objc_ownership(weak))) __typeof(self) weakSelf = self; + Block = [^{ + // CHECK-DAG: metadata !"strongSelf", metadata !{{[0-9]+}}, i32 [[@LINE+1]], metadata ![[SELFTY]], i32 0, i32 0} ; [ DW_TAG_auto_variable ] [strongSelf] + __attribute__((objc_ownership(strong))) __typeof(self) strongSelf = weakSelf; + } copy]; +} +@end diff --git a/test/CodeGenObjC/debug-info-property-accessors.m b/test/CodeGenObjC/debug-info-property-accessors.m new file mode 100644 index 0000000..4c7b984 --- /dev/null +++ b/test/CodeGenObjC/debug-info-property-accessors.m @@ -0,0 +1,56 @@ +// RUN: %clang_cc1 -emit-llvm -x objective-c -g -triple x86_64-apple-macosx10.8.0 %s -o - | FileCheck %s +// +// rdar://problem/14035789 +// +// Ensure we emit the names of explicit/renamed accessors even if they +// are defined later in the implementation section. +// +// CHECK: metadata !{i32 {{.*}}, metadata !"blah", {{.*}} metadata !"isBlah", metadata !"", {{.*}}} ; [ DW_TAG_APPLE_property ] [blah] + +@class NSString; +extern void NSLog(NSString *format, ...); +typedef signed char BOOL; + +#define YES ((BOOL)1) +#define NO ((BOOL)0) + +typedef unsigned int NSUInteger; + +@protocol NSObject +@end + +@interface NSObject <NSObject> +- (id)init; ++ (id)alloc; +@end + +@interface Bar : NSObject +@property int normal_property; +@property (getter=isBlah, setter=setBlah:) BOOL blah; +@end + +@implementation Bar +@synthesize normal_property; + +- (BOOL) isBlah +{ + return YES; +} +- (void) setBlah: (BOOL) newBlah +{ + NSLog (@"Speak up, I didn't catch that."); +} +@end + +int +main () +{ + Bar *my_bar = [[Bar alloc] init]; + + if (my_bar.blah) + NSLog (@"It was true!!!"); + + my_bar.blah = NO; + + return 0; +} diff --git a/test/CodeGenObjC/debug-info-property4.m b/test/CodeGenObjC/debug-info-property4.m index 6d9973c..71863a6 100644 --- a/test/CodeGenObjC/debug-info-property4.m +++ b/test/CodeGenObjC/debug-info-property4.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-default-synthesize-properties -masm-verbose -S -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_property_name // CHECK-NOT: AT_APPLE_property_getter diff --git a/test/CodeGenObjC/debug-info-property5.m b/test/CodeGenObjC/debug-info-property5.m index 3521574..272aa5d 100644 --- a/test/CodeGenObjC/debug-info-property5.m +++ b/test/CodeGenObjC/debug-info-property5.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -fobjc-default-synthesize-properties -masm-verbose -S -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_property_name // CHECK: AT_APPLE_property_getter diff --git a/test/CodeGenObjC/debug-info-self.m b/test/CodeGenObjC/debug-info-self.m index 7803467..8cbc029 100644 --- a/test/CodeGenObjC/debug-info-self.m +++ b/test/CodeGenObjC/debug-info-self.m @@ -14,10 +14,6 @@ } @end -// It's weird that the first two parameters are recorded as being in a -// different, ("<unknown>") file compared to the third parameter which is 'in' -// the actual source file. (see the metadata node after the arg name in each -// line) -// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR:.*]], metadata !"self", metadata ![[UNKFILE:.*]], i32 16777227, metadata !{{.*}}, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [self] [line 11] -// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"_cmd", metadata ![[UNKFILE]], i32 33554443, metadata !{{.*}}, i32 64, i32 0} ; [ DW_TAG_arg_variable ] [_cmd] [line 11] +// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR:.*]], metadata !"self", null, i32 16777216, metadata !{{.*}}, i32 1088, i32 0} ; [ DW_TAG_arg_variable ] [self] [line 0] +// CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"_cmd", null, i32 33554432, metadata !{{.*}}, i32 64, i32 0} ; [ DW_TAG_arg_variable ] [_cmd] [line 0] // CHECK: metadata !{i32 {{.*}}, metadata ![[CTOR]], metadata !"myarg", metadata !{{.*}}, i32 50331659, metadata !{{.*}}, i32 0, i32 0} ; [ DW_TAG_arg_variable ] [myarg] [line 11] diff --git a/test/CodeGenObjC/debuginfo-properties.m b/test/CodeGenObjC/debuginfo-properties.m new file mode 100644 index 0000000..9a35714 --- /dev/null +++ b/test/CodeGenObjC/debuginfo-properties.m @@ -0,0 +1,35 @@ +// RUN: %clang_cc1 -g -emit-llvm -triple x86_64-apple-darwin -o - %s | FileCheck %s +// Check that we emit the correct method names for properties from a protocol. +// rdar://problem/13798000 +@protocol NSObject +- (id)init; +@end +@interface NSObject <NSObject> {} +@end + +@class Selection; + +@protocol HasASelection <NSObject> +@property (nonatomic, retain) Selection* selection; +// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-1]]] [local] [def] [-[MyClass selection]] +// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-2]]] [local] [def] [-[MyClass setSelection:]] +// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-3]]] [local] [def] [-[OtherClass selection]] +// CHECK: [ DW_TAG_subprogram ] [line [[@LINE-4]]] [local] [def] [-[OtherClass setSelection:]] +@end + +@interface MyClass : NSObject <HasASelection> { + Selection *_selection; +} +@end + +@implementation MyClass +@synthesize selection = _selection; +@end + +@interface OtherClass : NSObject <HasASelection> { + Selection *_selection; +} +@end +@implementation OtherClass +@synthesize selection = _selection; +@end diff --git a/test/CodeGenObjC/designated-initializers.m b/test/CodeGenObjC/designated-initializers.m new file mode 100644 index 0000000..80dfdf3 --- /dev/null +++ b/test/CodeGenObjC/designated-initializers.m @@ -0,0 +1,8 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown %s -emit-llvm -o - | FileCheck %s + +// <rdar://problem/10465114> +struct overwrite_string_struct { + char L[3]; + int M; +} overwrite_string[] = { { { @encode(void**) }, 1 }, [0].L[1] = 'x'}; +// CHECK: [3 x i8] c"^xv", i32 1 diff --git a/test/CodeGenObjC/encode-cstyle-method.m b/test/CodeGenObjC/encode-cstyle-method.m index f3243a3..309089b 100644 --- a/test/CodeGenObjC/encode-cstyle-method.m +++ b/test/CodeGenObjC/encode-cstyle-method.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck -check-prefix CHECK-LP64 %s // rdar: // 7445205 @interface Foo diff --git a/test/CodeGenObjC/encode-test-6.m b/test/CodeGenObjC/encode-test-6.m index b7feb14..b7b3799 100644 --- a/test/CodeGenObjC/encode-test-6.m +++ b/test/CodeGenObjC/encode-test-6.m @@ -35,3 +35,21 @@ typedef BABugExample BABugExampleRedefinition; @end // CHECK: internal global [24 x i8] c"^{BABugExample=@}16 + +// rdar://14408244 +@class SCNCamera; +typedef SCNCamera C3DCamera; +typedef struct +{ + C3DCamera *presentationInstance; +} C3DCameraStorage; + +@interface SCNCamera +@end + +@implementation SCNCamera +{ + C3DCameraStorage _storage; +} +@end +// CHECK: internal global [39 x i8] c"{?=\22presentationInstance\22^{SCNCamera}}\00" diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m index e8d6541..d6e7b6d 100644 --- a/test/CodeGenObjC/encode-test.m +++ b/test/CodeGenObjC/encode-test.m @@ -159,7 +159,7 @@ struct f int tt; }; -// CHECK: @g10 = constant [14 x i8] c"{f=i[0{?=}]i}\00" +// CHECK: @g10 = constant [14 x i8] c"{f=i[4{?=}]i}\00" const char g10[] = @encode(struct f); // rdar://9622422 diff --git a/test/CodeGenObjC/exceptions-nonfragile.m b/test/CodeGenObjC/exceptions-nonfragile.m index 1f38926..212a1ee 100644 --- a/test/CodeGenObjC/exceptions-nonfragile.m +++ b/test/CodeGenObjC/exceptions-nonfragile.m @@ -26,6 +26,6 @@ void test2(void) { test2_helper(); } - // CHECK: define void @test2() + // CHECK-LABEL: define void @test2() // CHECK-NOT: call void @test2_helper() } diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m index 408b94d..92f6829 100644 --- a/test/CodeGenObjC/exceptions.m +++ b/test/CodeGenObjC/exceptions.m @@ -14,7 +14,7 @@ void f0() { } } -// CHECK: define void @f1() +// CHECK-LABEL: define void @f1() void f1() { extern void foo(void); @@ -40,7 +40,7 @@ void f1() { // Test that modifications to local variables are respected under // optimization. rdar://problem/8160285 -// CHECK: define i32 @f2() +// CHECK-LABEL: define i32 @f2() int f2() { extern void foo(void); @@ -77,7 +77,7 @@ int f2() { // Test that the cleanup destination is saved when entering a finally // block. rdar://problem/8293901 -// CHECK: define void @f3() +// CHECK-LABEL: define void @f3() void f3() { extern void f3_helper(int, int*); @@ -130,7 +130,7 @@ void f3() { void f4() { extern void f4_help(int); - // CHECK: define void @f4() + // CHECK-LABEL: define void @f4() // CHECK: [[EXNDATA:%.*]] = alloca [[EXNDATA_T:%.*]], align // CHECK: call void @objc_exception_try_enter([[EXNDATA_T]]* [[EXNDATA]]) // CHECK: call i32 @_setjmp diff --git a/test/CodeGenObjC/extended-block-signature-encode.m b/test/CodeGenObjC/extended-block-signature-encode.m index a380856..3db31fa 100644 --- a/test/CodeGenObjC/extended-block-signature-encode.m +++ b/test/CodeGenObjC/extended-block-signature-encode.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fencode-extended-block-signature -emit-llvm %s -o - | FileCheck %s -// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s -check-prefix=BRIEF +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -emit-llvm %s -o - | FileCheck %s -check-prefix=CHECK-BRIEF // rdar://12109031 @class NSString, NSArray; diff --git a/test/CodeGenObjC/fp2ret.m b/test/CodeGenObjC/fp2ret.m index 2e65332..5f7c76d 100644 --- a/test/CodeGenObjC/fp2ret.m +++ b/test/CodeGenObjC/fp2ret.m @@ -12,15 +12,15 @@ @end -// CHECK-X86_32: define void @t0() +// CHECK-X86_32-LABEL: define void @t0() // CHECK-X86_32: call void bitcast {{.*}} @objc_msgSend_stret to // CHECK-X86_32: } // -// CHECK-X86_64: define void @t0() +// CHECK-X86_64-LABEL: define void @t0() // CHECK-X86_64: call { x86_fp80, x86_fp80 } bitcast {{.*}} @objc_msgSend_fp2ret to // CHECK-X86_64: } // -// CHECK-ARMV7: define void @t0() +// CHECK-ARMV7-LABEL: define void @t0() // CHECK-ARMV7: call i128 bitcast {{.*}} @objc_msgSend to // CHECK-ARMV7: } void t0() { diff --git a/test/CodeGenObjC/fpret.m b/test/CodeGenObjC/fpret.m index cabef10..7fe5501 100644 --- a/test/CodeGenObjC/fpret.m +++ b/test/CodeGenObjC/fpret.m @@ -14,19 +14,19 @@ @end -// CHECK-X86_32: define void @t0() +// CHECK-X86_32-LABEL: define void @t0() // CHECK-X86_32: call float bitcast {{.*}} @objc_msgSend_fpret to // CHECK-X86_32: call double bitcast {{.*}} @objc_msgSend_fpret to // CHECK-X86_32: call x86_fp80 bitcast {{.*}} @objc_msgSend_fpret to // CHECK-X86_32: } // -// CHECK-X86_64: define void @t0() +// CHECK-X86_64-LABEL: define void @t0() // CHECK-X86_64: call float bitcast {{.*}} @objc_msgSend to // CHECK-X86_64: call double bitcast {{.*}} @objc_msgSend to // CHECK-X86_64: call x86_fp80 bitcast {{.*}} @objc_msgSend_fpret to // CHECK-X86_64: } // -// CHECK-ARMV7: define void @t0() +// CHECK-ARMV7-LABEL: define void @t0() // CHECK-ARMV7: call float bitcast {{.*}} @objc_msgSend to // CHECK-ARMV7: call double bitcast {{.*}} @objc_msgSend to // CHECK-ARMV7: call double bitcast {{.*}} @objc_msgSend to diff --git a/test/CodeGenObjC/gc.m b/test/CodeGenObjC/gc.m index ce2611e..729cf10 100644 --- a/test/CodeGenObjC/gc.m +++ b/test/CodeGenObjC/gc.m @@ -4,7 +4,7 @@ void test0(void) { extern id test0_helper(void); __attribute__((objc_precise_lifetime)) id x = test0_helper(); test0_helper(); - // CHECK: define void @test0() + // CHECK-LABEL: define void @test0() // CHECK: [[T0:%.*]] = call i8* @test0_helper() // CHECK-NEXT: store i8* [[T0]], i8** [[X:%.*]], align 8 // CHECK-NEXT: call i8* @test0_helper() diff --git a/test/CodeGenObjC/id-isa-codegen.m b/test/CodeGenObjC/id-isa-codegen.m index 8717ce2..fa0f0b0 100644 --- a/test/CodeGenObjC/id-isa-codegen.m +++ b/test/CodeGenObjC/id-isa-codegen.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck -check-prefix LP64 %s -// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck -check-prefix LP32 %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck -check-prefix CHECK-LP64 %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck -check-prefix CHECK-LP32 %s typedef struct objc_class *Class; diff --git a/test/CodeGenObjC/ivar-base-as-invariant-load.m b/test/CodeGenObjC/ivar-base-as-invariant-load.m index 8b660cf..19dc658 100644 --- a/test/CodeGenObjC/ivar-base-as-invariant-load.m +++ b/test/CodeGenObjC/ivar-base-as-invariant-load.m @@ -23,7 +23,7 @@ @end -// CHECK: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !4 -// CHECK: [[T2:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !4 -// CHECK: [[T3:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !4 +// CHECK: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !5 +// CHECK: [[T2:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !5 +// CHECK: [[T3:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !5 diff --git a/test/CodeGenObjC/ivar-invariant.m b/test/CodeGenObjC/ivar-invariant.m index 7cafee7..ef17ffc 100644 --- a/test/CodeGenObjC/ivar-invariant.m +++ b/test/CodeGenObjC/ivar-invariant.m @@ -40,7 +40,7 @@ void * variant_load_1(int i) { return ptr; } -// CHECK: define i8* @variant_load_1(i32 %i) +// CHECK-LABEL: define i8* @variant_load_1(i32 %i) // CHECK: [[IVAR:%.*]] = load i64* @"OBJC_IVAR_$_Derived.member"{{$}} @interface Container : Derived @end @@ -61,7 +61,7 @@ void * variant_load_1(int i) { } @end -// CHECK: define internal i8* @block_block_invoke +// CHECK-LABEL: define internal i8* @block_block_invoke // CHECK: load i64* @"OBJC_IVAR_$_ForBlock.foo" id (^block)(ForBlock*) = ^(ForBlock* a) { return a->foo; diff --git a/test/CodeGenObjC/ivar-layout-array0-struct.m b/test/CodeGenObjC/ivar-layout-array0-struct.m index 267f947..4737303 100644 --- a/test/CodeGenObjC/ivar-layout-array0-struct.m +++ b/test/CodeGenObjC/ivar-layout-array0-struct.m @@ -1,6 +1,6 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -O0 -S %s -o %t-64.s -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -S %s -o %t-64.s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s // rdar://8800513 @interface NSObject { diff --git a/test/CodeGenObjC/ivar-layout-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m index 46a7034..17b5195 100644 --- a/test/CodeGenObjC/ivar-layout-no-optimize.m +++ b/test/CodeGenObjC/ivar-layout-no-optimize.m @@ -1,8 +1,8 @@ // REQUIRES: x86-64-registered-target -// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -O0 -S %s -o %t-64.s -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s -// RUN: %clang_cc1 -x objective-c++ -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -O0 -S %s -o %t-64.s -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: %clang_cc1 -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -S %s -o %t-64.s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s +// RUN: %clang_cc1 -x objective-c++ -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -S %s -o %t-64.s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s @interface NSObject { id isa; diff --git a/test/CodeGenObjC/local-static-block.m b/test/CodeGenObjC/local-static-block.m index deea8ba..b5b4534 100644 --- a/test/CodeGenObjC/local-static-block.m +++ b/test/CodeGenObjC/local-static-block.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o %t-64.ll -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.ll %s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.ll %s // rdar: // 8390455 @class NSArray; diff --git a/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m b/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m index bb3a20b..6ea6564 100644 --- a/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m +++ b/test/CodeGenObjC/mrr-captured-block-var-inlined-layout.m @@ -1,6 +1,6 @@ -// RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -triple x86_64-apple-darwin -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout +// RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -triple x86_64-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-64.layout // RUN: FileCheck --input-file=%t-64.layout %s -// RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -triple i386-apple-darwin -O0 -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout +// RUN: %clang_cc1 -fblocks -fobjc-runtime-has-weak -triple i386-apple-darwin -print-ivar-layout -emit-llvm -o /dev/null %s > %t-32.layout // RUN: FileCheck -check-prefix=CHECK-i386 --input-file=%t-32.layout %s // rdar://12184410 // rdar://12184410 diff --git a/test/CodeGenObjC/ns_consume_null_check.m b/test/CodeGenObjC/ns_consume_null_check.m index 6a31a80..d4502ec 100644 --- a/test/CodeGenObjC/ns_consume_null_check.m +++ b/test/CodeGenObjC/ns_consume_null_check.m @@ -16,7 +16,7 @@ void test0(void) { id obj = [NSObject new]; [x isEqual : obj]; } -// CHECK: define void @test0() +// CHECK-LABEL: define void @test0() // CHECK: [[FIVE:%.*]] = call i8* @objc_retain // CHECK-NEXT: [[SIX:%.*]] = bitcast // CHECK-NEXT: [[SEVEN:%.*]] = icmp eq i8* [[SIX]], null @@ -36,7 +36,7 @@ void test1(void) { __weak id weakObj = obj; _Complex float result = [x asComplexWithArg: obj]; } -// CHECK: define void @test1() +// CHECK-LABEL: define void @test1() // CHECK: [[OBJ:%.*]] = alloca i8*, align 8 // CHECK-NEXT: [[WEAKOBJ:%.*]] = alloca i8*, align 8 // CHECK-NEXT: [[RESULT:%.*]] = alloca { float, float }, align 4 diff --git a/test/CodeGenObjC/null-objc-empty-vtable.m b/test/CodeGenObjC/null-objc-empty-vtable.m new file mode 100644 index 0000000..fe69ce1 --- /dev/null +++ b/test/CodeGenObjC/null-objc-empty-vtable.m @@ -0,0 +1,10 @@ +// RUN: %clang_cc1 -triple x86_64-apple-macosx10.9 -emit-llvm -o - %s | FileCheck -check-prefix CHECK-OSX %s +// RUN: %clang_cc1 -triple thumbv7-apple-ios3.0.0 -emit-llvm -o - %s | FileCheck -check-prefix CHECK-IOS %s +// rdar://14802916 + +@interface I +@end + +@implementation I @end +// CHECK-OSX: %struct._class_t* null, %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** null +// CHECK-IOS: %struct._class_t* null, %struct._objc_cache* @_objc_empty_cache, i8* (i8*, i8*)** null diff --git a/test/CodeGenObjC/objc-gc-aggr-assign.m b/test/CodeGenObjC/objc-gc-aggr-assign.m index 6c2baac..eb11a4e 100644 --- a/test/CodeGenObjC/objc-gc-aggr-assign.m +++ b/test/CodeGenObjC/objc-gc-aggr-assign.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix C %s -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CP %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CHECK-C %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o - %s | FileCheck -check-prefix CHECK-CP %s static int count; diff --git a/test/CodeGenObjC/objc-read-weak-byref.m b/test/CodeGenObjC/objc-read-weak-byref.m index 94eca28..35b4de1 100644 --- a/test/CodeGenObjC/objc-read-weak-byref.m +++ b/test/CodeGenObjC/objc-read-weak-byref.m @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -S %s -o %t-64.s -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -S %s -o %t-32.s -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s +// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s @interface NSObject - copy; diff --git a/test/CodeGenObjC/objc2-legacy-dispatch.m b/test/CodeGenObjC/objc2-legacy-dispatch.m index a6b2000..aa944f8 100644 --- a/test/CodeGenObjC/objc2-legacy-dispatch.m +++ b/test/CodeGenObjC/objc2-legacy-dispatch.m @@ -1,15 +1,15 @@ // RUN: %clang_cc1 -fobjc-dispatch-method=mixed -triple i386-apple-darwin10 -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_NEW_DISPATCH %s // -// CHECK_NEW_DISPATCH: define void @f0 +// CHECK_NEW_DISPATCH-LABEL: define void @f0 // CHECK_NEW_DISPATCH: bitcast {{.*}}objc_msgSend_fixup_alloc -// CHECK_NEW_DISPATCH: define void @f1 +// CHECK_NEW_DISPATCH-LABEL: define void @f1 // CHECK_NEW_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES // // RUN: %clang_cc1 -fobjc-dispatch-method=legacy -emit-llvm -o - %s | FileCheck -check-prefix=CHECK_OLD_DISPATCH %s // -// CHECK_OLD_DISPATCH: define void @f0 +// CHECK_OLD_DISPATCH-LABEL: define void @f0 // CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES -// CHECK_OLD_DISPATCH: define void @f1 +// CHECK_OLD_DISPATCH-LABEL: define void @f1 // CHECK_OLD_DISPATCH: load {{.*}}OBJC_SELECTOR_REFERENCES @interface A diff --git a/test/CodeGenObjC/objc2-no-write-barrier.m b/test/CodeGenObjC/objc2-no-write-barrier.m index ece6b9d..16593f1 100644 --- a/test/CodeGenObjC/objc2-no-write-barrier.m +++ b/test/CodeGenObjC/objc2-no-write-barrier.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s -// RUN: grep 'objc_assign' %t | count 0 +// RUN: not grep 'objc_assign' %t // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s -// RUN: grep 'objc_assign' %t | count 0 +// RUN: not grep 'objc_assign' %t typedef struct { int ival; diff --git a/test/CodeGenObjC/objc2-weak-block-call.m b/test/CodeGenObjC/objc2-weak-block-call.m index 2543494..7c68817 100644 --- a/test/CodeGenObjC/objc2-weak-block-call.m +++ b/test/CodeGenObjC/objc2-weak-block-call.m @@ -1,5 +1,5 @@ -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s -// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | FileCheck -check-prefix LP64 %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-LP64 %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-LP64 %s @interface MyView - (void)MyView_sharedInit; diff --git a/test/CodeGenObjC/objc2-write-barrier-5.m b/test/CodeGenObjC/objc2-write-barrier-5.m index 65a71a5..44af818 100644 --- a/test/CodeGenObjC/objc2-write-barrier-5.m +++ b/test/CodeGenObjC/objc2-write-barrier-5.m @@ -1,8 +1,8 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s -// RUN: grep objc_assign_ivar %t | count 0 +// RUN: not grep objc_assign_ivar %t // RUN: grep objc_assign_strongCast %t | count 8 // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 -fobjc-gc -emit-llvm -o %t %s -// RUN: grep objc_assign_ivar %t | count 0 +// RUN: not grep objc_assign_ivar %t // RUN: grep objc_assign_strongCast %t | count 8 @interface TestUnarchiver diff --git a/test/CodeGenObjC/objfw.m b/test/CodeGenObjC/objfw.m index 98e3fb0..8e72867 100644 --- a/test/CodeGenObjC/objfw.m +++ b/test/CodeGenObjC/objfw.m @@ -8,7 +8,7 @@ void test0(void) { [Test0 test]; } -// CHECK: define void @test0() +// CHECK-LABEL: define void @test0() // CHECK: [[T0:%.*]] = call i8* (i8*, i8*, ...)* (i8*, i8*)* @objc_msg_lookup(i8* bitcast (i64* @_OBJC_CLASS_Test0 to i8*), // CHECK-NEXT: [[T1:%.*]] = bitcast i8* (i8*, i8*, ...)* [[T0]] to void (i8*, i8*)* // CHECK-NEXT: call void [[T1]](i8* bitcast (i64* @_OBJC_CLASS_Test0 to i8*), diff --git a/test/CodeGenObjC/property.m b/test/CodeGenObjC/property.m index 6a43826..e156270 100644 --- a/test/CodeGenObjC/property.m +++ b/test/CodeGenObjC/property.m @@ -54,7 +54,7 @@ int printf(const char *, ...); @end // Test that compound operations only compute the base once. -// CHECK: define void @test2 +// CHECK-LABEL: define void @test2 A *test2_helper(void); void test2() { // CHECK: [[BASE:%.*]] = call [[A:%.*]]* @test2_helper() @@ -94,7 +94,7 @@ void test3(test3_object *p) { @interface Test4 {} @property float f; @end -// CHECK: define void @test4 +// CHECK-LABEL: define void @test4 void test4(Test4 *t) { extern int test4_printf(const char *, ...); // CHECK: [[TMP:%.*]] = call float {{.*}} @objc_msgSend diff --git a/test/CodeGenObjC/protocol-in-extended-class.m b/test/CodeGenObjC/protocol-in-extended-class.m index b919d5f..a5fb80e 100644 --- a/test/CodeGenObjC/protocol-in-extended-class.m +++ b/test/CodeGenObjC/protocol-in-extended-class.m @@ -1,8 +1,8 @@ // REQUIRES: x86-registered-target,x86-64-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S %s -o %t-64.s -// RUN: FileCheck -check-prefix LP64 --input-file=%t-64.s %s +// RUN: FileCheck -check-prefix CHECK-LP64 --input-file=%t-64.s %s // RUN: %clang_cc1 -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -S %s -o %t-32.s -// RUN: FileCheck -check-prefix LP32 --input-file=%t-32.s %s +// RUN: FileCheck -check-prefix CHECK-LP32 --input-file=%t-32.s %s @protocol MyProtocol @end diff --git a/test/CodeGenObjC/protocols-lazy.m b/test/CodeGenObjC/protocols-lazy.m index 642f886..fba7454 100644 --- a/test/CodeGenObjC/protocols-lazy.m +++ b/test/CodeGenObjC/protocols-lazy.m @@ -1,11 +1,11 @@ // RUN: %clang_cc1 -emit-llvm -triple i686-apple-darwin8 -fobjc-runtime=macosx-fragile-10.5 -o %t %s // No object generated -// RUN: grep OBJC_PROTOCOL_P0 %t | count 0 +// RUN: not grep OBJC_PROTOCOL_P0 %t @protocol P0; // No object generated -// RUN: grep OBJC_PROTOCOL_P1 %t | count 0 +// RUN: not grep OBJC_PROTOCOL_P1 %t @protocol P1 -im1; @end // Definition triggered by protocol reference. @@ -16,7 +16,7 @@ void f0() { id x = @protocol(P2); } // Forward definition triggered by protocol reference. // RUN: grep OBJC_PROTOCOL_P3 %t | count 3 -// RUN: grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t | count 0 +// RUN: not grep OBJC_PROTOCOL_INSTANCE_METHODS_P3 %t @protocol P3; void f1() { id x = @protocol(P3); } diff --git a/test/CodeGenObjC/related-result-type.m b/test/CodeGenObjC/related-result-type.m index ef38661..cd78474 100644 --- a/test/CodeGenObjC/related-result-type.m +++ b/test/CodeGenObjC/related-result-type.m @@ -9,7 +9,7 @@ @interface NSString : NSObject @end -// CHECK: define void @test1() +// CHECK-LABEL: define void @test1() void test1() { // CHECK: {{call.*@objc_msgSend}} // CHECK: {{call.*@objc_msgSend}} @@ -18,7 +18,7 @@ void test1() { NSString *str1 = [[[NSString alloc] init] retain]; } -// CHECK: define void @test2() +// CHECK-LABEL: define void @test2() void test2() { // CHECK: {{call.*@objc_msgSend}} // CHECK: {{call.*@objc_msgSend}} diff --git a/test/CodeGenObjC/reorder-synthesized-ivars.m b/test/CodeGenObjC/reorder-synthesized-ivars.m index 747265d..0f8cf6a 100644 --- a/test/CodeGenObjC/reorder-synthesized-ivars.m +++ b/test/CodeGenObjC/reorder-synthesized-ivars.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-default-synthesize-properties -emit-llvm -x objective-c %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -x objective-c %s -o - | FileCheck %s // rdar://13192366 typedef signed char BOOL; @interface NSObject diff --git a/test/CodeGenObjC/stret_lookup.m b/test/CodeGenObjC/stret_lookup.m new file mode 100644 index 0000000..6682fac --- /dev/null +++ b/test/CodeGenObjC/stret_lookup.m @@ -0,0 +1,29 @@ +// RUN: %clang_cc1 -DSTRET -triple x86_64-pc-linux-gnu -fobjc-runtime=objfw -emit-llvm -o - %s | FileCheck -check-prefix=HASSTRET %s +// RUN: %clang_cc1 -triple x86_64-pc-linux-gnu -fobjc-runtime=gcc -emit-llvm -o - %s | FileCheck -check-prefix=NOSTRET %s + +// Test stret lookup + +struct test { + char test[1024]; +}; +@interface Test0 ++ (struct test)test; +@end +void test0(void) { + struct test t; +#if (defined(STRET) && defined(__OBJFW_RUNTIME_ABI__)) || \ + (!defined(STRET) && !defined(__OBJFW_RUNTIME_ABI__)) + t = [Test0 test]; +#endif + (void)t; +} + +// HASSTRET-LABEL: define void @test0() +// HASSTRET: [[T0:%.*]] = call i8* (i8*, i8*, ...)* (i8*, i8*)* @objc_msg_lookup_stret(i8* bitcast (i64* @_OBJC_CLASS_Test0 to i8*), +// HASSTRET-NEXT: [[T1:%.*]] = bitcast i8* (i8*, i8*, ...)* [[T0]] to void (%struct.test*, i8*, i8*)* +// HASSTRET-NEXT: call void [[T1]](%struct.test* sret {{.*}}, i8* bitcast (i64* @_OBJC_CLASS_Test0 to i8*), + +// NOSTRET-LABEL: define void @test0() +// NOSTRET: [[T0:%.*]] = call i8* (i8*, i8*, ...)* (i8*, i8*)* @objc_msg_lookup(i8* +// NOSTRET-NEXT: [[T1:%.*]] = bitcast i8* (i8*, i8*, ...)* [[T0]] to void (%struct.test*, i8*, i8*)* +// NOSTRET-NEXT: call void [[T1]](%struct.test* sret {{.*}}, i8* {{.*}}, i8* bitcast ([2 x { i8*, i8* }]* diff --git a/test/CodeGenObjC/synchronized.m b/test/CodeGenObjC/synchronized.m index e927882..015e55b 100644 --- a/test/CodeGenObjC/synchronized.m +++ b/test/CodeGenObjC/synchronized.m @@ -20,7 +20,7 @@ @end -// CHECK: define void @foo( +// CHECK-LABEL: define void @foo( void foo(id a) { // CHECK: [[A:%.*]] = alloca i8* // CHECK: [[SYNC:%.*]] = alloca i8* @@ -47,7 +47,7 @@ void foo(id a) { } -// CHECK: define i32 @f0( +// CHECK-LABEL: define i32 @f0( int f0(id a) { // TODO: we can optimize the ret to a constant if we can figure out // either that x isn't stored to within the synchronized block or @@ -64,7 +64,7 @@ int f0(id a) { return x; } -// CHECK: define void @f1( +// CHECK-LABEL: define void @f1( void f1(id a) { // Check that the return doesn't go through the cleanup. extern void opaque(void); diff --git a/test/CodeGenObjC/tentative-cfconstantstring.m b/test/CodeGenObjC/tentative-cfconstantstring.m index b7e1c46..714c1a40 100644 --- a/test/CodeGenObjC/tentative-cfconstantstring.m +++ b/test/CodeGenObjC/tentative-cfconstantstring.m @@ -34,7 +34,7 @@ static inline void _inlineFunction() { // CHECK: @__CFConstantStringClassReference = common global [24 x i32] zeroinitializer, align 16 // CHECK: @_unnamed_cfstring_{{.*}} = private constant %struct.NSConstantString { i32* getelementptr inbounds ([24 x i32]* @__CFConstantStringClassReference, i32 0, i32 0) -// CHECK: define internal void @_inlineFunction() +// CHECK-LABEL: define internal void @_inlineFunction() // CHECK: [[ZERO:%.*]] = load %struct._class_t** @"\01L_OBJC_CLASSLIST_REFERENCES_ // CHECK-NEXT: [[ONE:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_" // CHECK-NEXT: [[TWO:%.*]] = bitcast %struct._class_t* [[ZERO]] to i8* diff --git a/test/CodeGenObjC/terminate.m b/test/CodeGenObjC/terminate.m index 8728ec4..4992b99 100644 --- a/test/CodeGenObjC/terminate.m +++ b/test/CodeGenObjC/terminate.m @@ -9,7 +9,7 @@ void test0(void) { void *ptr __attribute__((cleanup(destroy))); test0_helper(); - // CHECK-WITH: define void @test0() + // CHECK-WITH-LABEL: define void @test0() // CHECK-WITH: [[PTR:%.*]] = alloca i8*, // CHECK-WITH: call void @destroy(i8** [[PTR]]) // CHECK-WITH-NEXT: ret void @@ -18,7 +18,7 @@ void test0(void) { // CHECK-WITH-NEXT: catch i8* null // CHECK-WITH-NEXT: call void @objc_terminate() - // CHECK-WITHOUT: define void @test0() + // CHECK-WITHOUT-LABEL: define void @test0() // CHECK-WITHOUT: [[PTR:%.*]] = alloca i8*, // CHECK-WITHOUT: call void @destroy(i8** [[PTR]]) // CHECK-WITHOUT-NEXT: ret void diff --git a/test/CodeGenObjC/x86_64-struct-return-gc.m b/test/CodeGenObjC/x86_64-struct-return-gc.m index dab5b15..9cb4b13 100644 --- a/test/CodeGenObjC/x86_64-struct-return-gc.m +++ b/test/CodeGenObjC/x86_64-struct-return-gc.m @@ -5,7 +5,7 @@ struct Coerce { struct Coerce coerce_func(void); -// CHECK: define void @Coerce_test() +// CHECK-LABEL: define void @Coerce_test() void Coerce_test(void) { struct Coerce c; @@ -21,7 +21,7 @@ struct Indirect { struct Indirect indirect_func(void); -// CHECK: define void @Indirect_test() +// CHECK-LABEL: define void @Indirect_test() void Indirect_test(void) { struct Indirect i; |