diff options
Diffstat (limited to 'test/CodeGenObjC')
71 files changed, 772 insertions, 218 deletions
diff --git a/test/CodeGenObjC/2009-08-05-utf16.m b/test/CodeGenObjC/2009-08-05-utf16.m index 06458e730ae2..18ac1db79e24 100644 --- a/test/CodeGenObjC/2009-08-05-utf16.m +++ b/test/CodeGenObjC/2009-08-05-utf16.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -emit-llvm -w -x objective-c %s -o - | FileCheck %s // rdar://7095855 rdar://7115749 -// CHECK: internal unnamed_addr constant [6 x i16] [i16 105, i16 80, i16 111, i16 100, i16 8482, i16 0], align 2 +// CHECK: private unnamed_addr constant [6 x i16] [i16 105, i16 80, i16 111, i16 100, i16 8482, i16 0], section "__TEXT,__ustring", align 2 void *P = @"iPod™"; diff --git a/test/CodeGenObjC/2010-02-01-utf16-with-null.m b/test/CodeGenObjC/2010-02-01-utf16-with-null.m index 1863984c216e..37fb9cd3f285 100644 --- a/test/CodeGenObjC/2010-02-01-utf16-with-null.m +++ b/test/CodeGenObjC/2010-02-01-utf16-with-null.m @@ -1,5 +1,7 @@ -// RUN: %clang_cc1 -emit-llvm %s -o - | FileCheck %s +// RUN: %clang_cc1 -triple i686-apple-darwin -emit-llvm %s -o - | FileCheck %s // rdar://7589850 -// CHECK-NOT: __ustring +// CHECK: @.str = private unnamed_addr constant [9 x i16] [i16 103, i16 111, i16 111, i16 100, i16 0, i16 98, i16 121, i16 101, i16 0], section "__TEXT,__ustring", align 2 +// CHECK: @_unnamed_cfstring_ = private constant %struct.NSConstantString { i32* getelementptr inbounds ([0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 2000, i8* bitcast ([9 x i16]* @.str to i8*), i32 8 }, section "__DATA,__cfstring" +// CHECK: @P = global i8* bitcast (%struct.NSConstantString* @_unnamed_cfstring_ to i8*), align 4 void *P = @"good\0bye"; diff --git a/test/CodeGenObjC/arc-arm.m b/test/CodeGenObjC/arc-arm.m index 3989f56308a8..8d5f0d5c4b35 100644 --- a/test/CodeGenObjC/arc-arm.m +++ b/test/CodeGenObjC/arc-arm.m @@ -1,19 +1,22 @@ // RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -fblocks -fobjc-arc -o - %s | FileCheck %s + +// <rdar://12438598>: use an autorelease marker on ARM64. id test0(void) { extern id test0_helper(void); - // CHECK: [[T0:%.*]] = call arm_aapcscc i8* @test0_helper() + // CHECK: [[T0:%.*]] = call [[CC:(arm_aapcscc )?]]i8* @test0_helper() // CHECK-NEXT: ret i8* [[T0]] return test0_helper(); } void test1(void) { extern id test1_helper(void); - // CHECK: [[T0:%.*]] = call arm_aapcscc i8* @test1_helper() - // CHECK-NEXT: call void asm sideeffect "mov\09r7, r7 - // CHECK-NEXT: [[T1:%.*]] = call arm_aapcscc i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) + // CHECK: [[T0:%.*]] = call [[CC]]i8* @test1_helper() + // CHECK-NEXT: call void asm sideeffect "mov + // CHECK-NEXT: [[T1:%.*]] = call [[CC]]i8* @objc_retainAutoreleasedReturnValue(i8* [[T0]]) // CHECK-NEXT: store i8* [[T1]], - // CHECK-NEXT: call arm_aapcscc void @objc_storeStrong( + // CHECK-NEXT: call [[CC]]void @objc_storeStrong( // CHECK-NEXT: ret void id x = test1_helper(); } @@ -22,14 +25,14 @@ void test1(void) { @class A; A *test2(void) { extern A *test2_helper(void); - // CHECK: [[T0:%.*]] = call arm_aapcscc [[A:%.*]]* @test2_helper() + // CHECK: [[T0:%.*]] = call [[CC]][[A:%.*]]* @test2_helper() // CHECK-NEXT: ret [[A]]* [[T0]] return test2_helper(); } id test3(void) { extern A *test3_helper(void); - // CHECK: [[T0:%.*]] = call arm_aapcscc [[A:%.*]]* @test3_helper() + // CHECK: [[T0:%.*]] = call [[CC]][[A:%.*]]* @test3_helper() // CHECK-NEXT: [[T1:%.*]] = bitcast [[A]]* [[T0]] to i8* // CHECK-NEXT: ret i8* [[T1]] return test3_helper(); diff --git a/test/CodeGenObjC/arc-foreach.m b/test/CodeGenObjC/arc-foreach.m index 44561818c94f..ec767d391fd6 100644 --- a/test/CodeGenObjC/arc-foreach.m +++ b/test/CodeGenObjC/arc-foreach.m @@ -172,4 +172,4 @@ void test3(NSArray *array) { // CHECK-LP64-NEXT: br label [[L]] } -// CHECK: attributes [[NUW]] = { nounwind } +// CHECK-LP64: attributes [[NUW]] = { nounwind } diff --git a/test/CodeGenObjC/arc-ivar-layout.m b/test/CodeGenObjC/arc-ivar-layout.m index 62428f5aefc7..06e387c817ee 100644 --- a/test/CodeGenObjC/arc-ivar-layout.m +++ b/test/CodeGenObjC/arc-ivar-layout.m @@ -1,6 +1,6 @@ // 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 +// REQUIRES: x86-registered-target // rdar://8991729 @interface NSObject { @@ -54,3 +54,12 @@ @implementation UnsafePerson @end // CHECK-LP64: L_OBJC_CLASS_NAME_20: // CHECK-LP64-NEXT: .asciz "!" + +// rdar://16136439 +@interface rdar16136439 + @property (nonatomic, readonly, weak) id first; +@end + +@implementation rdar16136439 @end +// CHECK-LP64: L_OBJC_PROP_NAME_ATTR_29: +// CHECK-LP64-NEXT: .asciz "T@,R,W,N,V_first" diff --git a/test/CodeGenObjC/arc-linetable-autorelease.m b/test/CodeGenObjC/arc-linetable-autorelease.m index be05ec2fcd8e..fa109154ce03 100644 --- a/test/CodeGenObjC/arc-linetable-autorelease.m +++ b/test/CodeGenObjC/arc-linetable-autorelease.m @@ -29,12 +29,11 @@ NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h); 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: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]] + // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]] + // CHECK: ret {{.*}} !dbg ![[ARC]] // 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} + // CHECK: ![[ARC]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null} } @end diff --git a/test/CodeGenObjC/arc-linetable.m b/test/CodeGenObjC/arc-linetable.m index eac91f188907..2d56ab3dfb55 100644 --- a/test/CodeGenObjC/arc-linetable.m +++ b/test/CodeGenObjC/arc-linetable.m @@ -32,6 +32,13 @@ // CHECK: @objc_msgSend{{.*}} !dbg ![[MSG7:[0-9]+]] // CHECK: ret {{.*}} !dbg ![[RET7:[0-9]+]] +// CHECK: define {{.*}}testCleanupVoid +// CHECK: icmp ne {{.*}}!dbg ![[SKIP1:[0-9]+]] +// CHECK: store i32 0, i32* {{.*}}, !dbg ![[RET8:[0-9]+]] +// CHECK: @objc_storeStrong{{.*}}, !dbg ![[ARC8:[0-9]+]] +// CHECK: ret {{.*}} !dbg ![[RET8]] + +typedef signed char BOOL; @interface NSObject + (id)alloc; @@ -47,8 +54,10 @@ @implementation AppDelegate : NSObject +// CHECK: ![[TESTNOSIDEEFFECT:.*]] = {{.*}}[ DW_TAG_subprogram ] [line [[@LINE+1]]] [local] [def] [-[AppDelegate testNoSideEffect:]] - (int)testNoSideEffect:(NSString *)foo { - // CHECK: ![[ARC1]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null} + int x = 1; + // CHECK: ![[ARC1]] = metadata !{i32 [[@LINE+1]], i32 0, metadata ![[TESTNOSIDEEFFECT]], null} return 1; // Return expression // CHECK: ![[RET1]] = metadata !{i32 [[@LINE+1]], i32 0, metadata !{{.*}}, null} } // Cleanup + Ret @@ -91,6 +100,22 @@ return 1; } +- (void)testCleanupVoid:(BOOL)skip withDelegate: (AppDelegate *) delegate { + static BOOL skip_all; + // CHECK: ![[SKIP1]] = metadata !{i32 [[@LINE+1]], i32 0, + if (!skip_all) { + if (!skip) { + return; + } + NSString *s = @"bar"; + if (!skip) { + [delegate testVoid :s]; + } + } + // CHECK: ![[RET8]] = metadata !{i32 [[@LINE+2]], i32 0, + // CHECK: ![[ARC8]] = metadata !{i32 [[@LINE+1]], i32 0, +} + @end diff --git a/test/CodeGenObjC/arc-property.m b/test/CodeGenObjC/arc-property.m index c3c7e2bc11ec..8398a1b60f0d 100644 --- a/test/CodeGenObjC/arc-property.m +++ b/test/CodeGenObjC/arc-property.m @@ -67,7 +67,7 @@ static Class theGlobalClass; // CHECK: define internal i8* @"\01-[Test2 theClass]"( // CHECK: [[OFFSET:%.*]] = load i64* @"OBJC_IVAR_$_Test2._theClass" -// CHECK-NEXT: [[T0:%.*]] = call i8* @objc_getProperty(i8* {{.*}}, i8* {{.*}}, i64 [[OFFSET]], i1 zeroext true) +// CHECK-NEXT: [[T0:%.*]] = tail call i8* @objc_getProperty(i8* {{.*}}, i8* {{.*}}, i64 [[OFFSET]], i1 zeroext true) // CHECK-NEXT: ret i8* [[T0]] // CHECK: define internal void @"\01-[Test2 setTheClass:]"( diff --git a/test/CodeGenObjC/arc.m b/test/CodeGenObjC/arc.m index 00cdb6fcc529..8fc68ca2ffa8 100644 --- a/test/CodeGenObjC/arc.m +++ b/test/CodeGenObjC/arc.m @@ -180,7 +180,7 @@ id test4() { // CHECK-NEXT: [[ALLOC:%.*]] = bitcast // CHECK-NEXT: [[INIT:%.*]] = call i8* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to i8* (i8*, i8*, i32)*)(i8* [[ALLOC]], - // Initialization of return value, occuring within full-expression. + // Initialization of return value, occurring within full-expression. // Retain/release elided. // CHECK-NEXT: bitcast // CHECK-NEXT: [[INIT:%.*]] = bitcast @@ -581,11 +581,11 @@ void test21(unsigned n) { // rdar://problem/12492434 // Note that we set the flag saying that we need destruction *and* // the flag saying that we don't also need construction. -// CHECK-GLOBALS: @"\01l_OBJC_CLASS_RO_$_Test23" = internal global [[RO_T:%.*]] { i32 390, +// CHECK-GLOBALS: @"\01l_OBJC_CLASS_RO_$_Test23" = private global [[RO_T:%.*]] { i32 390, @interface Test23 { id x; } @end @implementation Test23 @end -// CHECK-GLOBALS: @"\01l_OBJC_CLASS_RO_$_Test24" = internal global [[RO_T:%.*]] { i32 130, +// CHECK-GLOBALS: @"\01l_OBJC_CLASS_RO_$_Test24" = private global [[RO_T:%.*]] { i32 130, @interface Test24 {} @end @implementation Test24 @end @@ -1004,7 +1004,7 @@ void test37(void) { @synthesize x; @end // CHECK: define internal i8* @"\01-[Test45 x]"( -// CHECK: [[CALL:%.*]] = call i8* @objc_getProperty( +// CHECK: [[CALL:%.*]] = tail call i8* @objc_getProperty( // CHECK-NEXT: ret i8* [[CALL]] // rdar://problem/9315552 @@ -1352,7 +1352,7 @@ void test62(void) { @implementation Person @synthesize address; @end -// CHECK: call i8* @objc_getProperty +// CHECK: tail call i8* @objc_getProperty // CHECK: call void @objc_setProperty // Verify that we successfully parse and preserve this attribute in diff --git a/test/CodeGenObjC/arm64-int32-ivar.m b/test/CodeGenObjC/arm64-int32-ivar.m new file mode 100644 index 000000000000..8f8c34a44a99 --- /dev/null +++ b/test/CodeGenObjC/arm64-int32-ivar.m @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -o - %s | FileCheck %s +// rdar://12617764 + +// CHECK: @"OBJC_IVAR_$_I.IVAR2" = global i32 8 +// CHECK: @"OBJC_IVAR_$_I.IVAR1" = global i32 0 +@interface I +{ + id IVAR1; + id IVAR2; +} +@end + +@implementation I +// CHECK: [[IVAR:%.*]] = load i32* @"OBJC_IVAR_$_I.IVAR2" +// CHECK: [[CONV:%.*]] = sext i32 [[IVAR]] to i64 +- (id) METH { return IVAR2; } +@end diff --git a/test/CodeGenObjC/attr-callconv.m b/test/CodeGenObjC/attr-callconv.m new file mode 100644 index 000000000000..b0a41f74381d --- /dev/null +++ b/test/CodeGenObjC/attr-callconv.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple i386-unknown-unknown -emit-llvm -o - %s | FileCheck %s + +@interface Test +- (void)test; +@end + +@implementation Test +- (void)test __attribute__((stdcall)) {} + // CHECK: define{{.*}}x86_stdcallcc{{.*}}Test test + +- (void)test2 __attribute__((ms_abi)) {} + // CHECK: define{{.*}}x86_64_win64cc{{.*}}Test test2 +@end diff --git a/test/CodeGenObjC/block-var-layout.m b/test/CodeGenObjC/block-var-layout.m index 0ad44daa0bdb..171df7b27489 100644 --- a/test/CodeGenObjC/block-var-layout.m +++ b/test/CodeGenObjC/block-var-layout.m @@ -164,3 +164,11 @@ void test_empty_block() { }; wrapperBlock(); } + +// rdar://16111839 +typedef union { char ch[8]; } SS; +typedef struct { SS s[4]; } CS; +void test_union_in_layout() { + CS cs; + ^{ cs; }; +} diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m index 5245679dd42d..6ae3e9fda076 100644 --- a/test/CodeGenObjC/blocks.m +++ b/test/CodeGenObjC/blocks.m @@ -65,7 +65,7 @@ void test2(Test2 *x) { // CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 3 // CHECK-NEXT: store i32 28, i32* [[T3]] - // Copy and dipose helpers. + // Copy and dispose helpers. // CHECK-NEXT: [[T4:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 4 // CHECK-NEXT: store i8* bitcast (void (i8*, i8*)* @__Block_byref_object_copy_{{.*}} to i8*), i8** [[T4]] // CHECK-NEXT: [[T5:%.*]] = getelementptr inbounds [[WEAK_T]]* [[WEAKX]], i32 0, i32 5 diff --git a/test/CodeGenObjC/boxing.m b/test/CodeGenObjC/boxing.m index 87ff0e7efb6c..efd2b1600b36 100644 --- a/test/CodeGenObjC/boxing.m +++ b/test/CodeGenObjC/boxing.m @@ -53,18 +53,18 @@ typedef signed char BOOL; + (id)stringWithUTF8String:(const char *)nullTerminatedCString; @end -// CHECK: [[WithIntMeth:@".*"]] = internal global [15 x i8] c"numberWithInt:\00" -// CHECK: [[WithIntSEL:@".*"]] = internal externally_initialized global i8* getelementptr inbounds ([15 x i8]* [[WithIntMeth]] -// CHECK: [[WithCharMeth:@".*"]] = internal global [16 x i8] c"numberWithChar:\00" -// CHECK: [[WithCharSEL:@".*"]] = internal externally_initialized global i8* getelementptr inbounds ([16 x i8]* [[WithCharMeth]] -// CHECK: [[WithBoolMeth:@".*"]] = internal global [16 x i8] c"numberWithBool:\00" -// CHECK: [[WithBoolSEL:@".*"]] = internal externally_initialized global i8* getelementptr inbounds ([16 x i8]* [[WithBoolMeth]] -// CHECK: [[WithIntegerMeth:@".*"]] = internal global [19 x i8] c"numberWithInteger:\00" -// CHECK: [[WithIntegerSEL:@".*"]] = internal externally_initialized global i8* getelementptr inbounds ([19 x i8]* [[WithIntegerMeth]] -// CHECK: [[WithUnsignedIntegerMeth:@".*"]] = internal global [27 x i8] c"numberWithUnsignedInteger:\00" -// CHECK: [[WithUnsignedIntegerSEL:@".*"]] = internal externally_initialized global i8* getelementptr inbounds ([27 x i8]* [[WithUnsignedIntegerMeth]] -// CHECK: [[stringWithUTF8StringMeth:@".*"]] = internal global [22 x i8] c"stringWithUTF8String:\00" -// CHECK: [[stringWithUTF8StringSEL:@".*"]] = internal externally_initialized global i8* getelementptr inbounds ([22 x i8]* [[stringWithUTF8StringMeth]] +// CHECK: [[WithIntMeth:@".*"]] = private global [15 x i8] c"numberWithInt:\00" +// CHECK: [[WithIntSEL:@".*"]] = private externally_initialized global i8* getelementptr inbounds ([15 x i8]* [[WithIntMeth]] +// CHECK: [[WithCharMeth:@".*"]] = private global [16 x i8] c"numberWithChar:\00" +// CHECK: [[WithCharSEL:@".*"]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8]* [[WithCharMeth]] +// CHECK: [[WithBoolMeth:@".*"]] = private global [16 x i8] c"numberWithBool:\00" +// CHECK: [[WithBoolSEL:@".*"]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8]* [[WithBoolMeth]] +// CHECK: [[WithIntegerMeth:@".*"]] = private global [19 x i8] c"numberWithInteger:\00" +// CHECK: [[WithIntegerSEL:@".*"]] = private externally_initialized global i8* getelementptr inbounds ([19 x i8]* [[WithIntegerMeth]] +// CHECK: [[WithUnsignedIntegerMeth:@".*"]] = private global [27 x i8] c"numberWithUnsignedInteger:\00" +// CHECK: [[WithUnsignedIntegerSEL:@".*"]] = private externally_initialized global i8* getelementptr inbounds ([27 x i8]* [[WithUnsignedIntegerMeth]] +// CHECK: [[stringWithUTF8StringMeth:@".*"]] = private global [22 x i8] c"stringWithUTF8String:\00" +// CHECK: [[stringWithUTF8StringSEL:@".*"]] = private externally_initialized global i8* getelementptr inbounds ([22 x i8]* [[stringWithUTF8StringMeth]] int main() { // CHECK: load i8** [[WithIntSEL]] diff --git a/test/CodeGenObjC/complex-property.m b/test/CodeGenObjC/complex-property.m index d65d72fdd70c..bed0ca661155 100644 --- a/test/CodeGenObjC/complex-property.m +++ b/test/CodeGenObjC/complex-property.m @@ -13,8 +13,8 @@ void f0(A *a) { a.y += a1; } -// CHECK-LP64: internal global [13 x i8] c"COMPLEX_PROP -// CHECK-LP64: internal global [17 x i8] c"setCOMPLEX_PROP +// CHECK-LP64: private global [13 x i8] c"COMPLEX_PROP +// CHECK-LP64: private global [17 x i8] c"setCOMPLEX_PROP // rdar: // 7351147 @interface B diff --git a/test/CodeGenObjC/constant-strings.m b/test/CodeGenObjC/constant-strings.m index cad634a4b103..0a6549637358 100644 --- a/test/CodeGenObjC/constant-strings.m +++ b/test/CodeGenObjC/constant-strings.m @@ -3,7 +3,7 @@ // Check that we set alignment 1 on the string. // -// CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", align 1 +// CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", section "__TEXT,__cstring,cstring_literals", align 1 // RUN: %clang_cc1 -fobjc-runtime=gcc -emit-llvm -o %t %s // RUN: FileCheck --check-prefix=CHECK-GNU < %t %s diff --git a/test/CodeGenObjC/debug-info-block-helper.m b/test/CodeGenObjC/debug-info-block-helper.m index 49c8c5daea8c..1403327dcb49 100644 --- a/test/CodeGenObjC/debug-info-block-helper.m +++ b/test/CodeGenObjC/debug-info-block-helper.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -emit-llvm -fblocks -g -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-fragile-10.5 %s -o - | FileCheck %s extern void foo(void(^)(void)); diff --git a/test/CodeGenObjC/debug-info-block-line.m b/test/CodeGenObjC/debug-info-block-line.m index 1965e1d7dcdc..9ba22bcd24fc 100644 --- a/test/CodeGenObjC/debug-info-block-line.m +++ b/test/CodeGenObjC/debug-info-block-line.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -emit-llvm -fblocks -fobjc-arc -g -triple x86_64-apple-darwin10 %s -o - | FileCheck %s // rdar://11562117 diff --git a/test/CodeGenObjC/debug-info-blocks.m b/test/CodeGenObjC/debug-info-blocks.m index 63068a9ca980..d025ca87d560 100644 --- a/test/CodeGenObjC/debug-info-blocks.m +++ b/test/CodeGenObjC/debug-info-blocks.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -fblocks -g -triple x86_64-apple-darwin10 -fobjc-dispatch-method=mixed %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -fblocks -g -triple x86_64-apple-darwin10 -fobjc-dispatch-method=mixed -x objective-c < %s -o - | FileCheck %s // rdar://problem/9279956 // Test that we generate the proper debug location for a captured self. diff --git a/test/CodeGenObjC/debug-info-class-extension.m b/test/CodeGenObjC/debug-info-class-extension.m index e1573f063377..0d1b720aa677 100644 --- a/test/CodeGenObjC/debug-info-class-extension.m +++ b/test/CodeGenObjC/debug-info-class-extension.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s +// FIXME: Check IR rather than asm, then triple is not needed. +// RUN: %clang_cc1 -triple %itanium_abi_triple -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_objc_complete_type diff --git a/test/CodeGenObjC/debug-info-class-extension2.m b/test/CodeGenObjC/debug-info-class-extension2.m index bae12dce4e4d..383390c4ab31 100644 --- a/test/CodeGenObjC/debug-info-class-extension2.m +++ b/test/CodeGenObjC/debug-info-class-extension2.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s +// FIXME: Check IR rather than asm, then triple is not needed. +// RUN: %clang_cc1 -triple %itanium_abi_triple -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_objc_complete_type @interface Foo {} @end diff --git a/test/CodeGenObjC/debug-info-crash-2.m b/test/CodeGenObjC/debug-info-crash-2.m index 7d05f535c9af..9e80580796a0 100644 --- a/test/CodeGenObjC/debug-info-crash-2.m +++ b/test/CodeGenObjC/debug-info-crash-2.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -g -S %s -o - -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target @class Bar; @interface Foo diff --git a/test/CodeGenObjC/debug-info-getter-name.m b/test/CodeGenObjC/debug-info-getter-name.m index 3939f355b68f..70d99367cbf6 100644 --- a/test/CodeGenObjC/debug-info-getter-name.m +++ b/test/CodeGenObjC/debug-info-getter-name.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin10 -fexceptions -fobjc-exceptions -g %s -o - | FileCheck %s // CHECK: {{.*}}, metadata !"-[InstanceVariablesEverywhereButTheInterface someString]", {{.*}}} ; [ DW_TAG_subprogram ] diff --git a/test/CodeGenObjC/debug-info-ivars-indirect.m b/test/CodeGenObjC/debug-info-ivars-indirect.m index 1548ddd0bb6e..f9593d24dea0 100644 --- a/test/CodeGenObjC/debug-info-ivars-indirect.m +++ b/test/CodeGenObjC/debug-info-ivars-indirect.m @@ -3,6 +3,14 @@ // Make sure we generate debug symbols for an indirectly referenced // extension to an interface. +// This happens to be the order the members are emitted in... I'm assuming it's +// not meaningful/important, so if something causes the order to change, feel +// free to update the test to reflect the new order. +// CHECK: ; [ DW_TAG_member ] [a] +// CHECK: ; [ DW_TAG_member ] [d] +// CHECK: ; [ DW_TAG_member ] [c] +// CHECK: ; [ DW_TAG_member ] [b] + @interface I { @public int a; @@ -29,4 +37,23 @@ void gorf (struct S* s) { int _b = s->i->b; } -// CHECK: {{.*}} [ DW_TAG_member ] [b] [line 24, size 32, align 32, offset 0] [from int] + +I *source(); + +@interface I() +{ + @public int c; +} +@end + +void use() { + int _c = source()->c; +} + +@interface I() +{ + @public int d; +} +@end + +I *x(); diff --git a/test/CodeGenObjC/debug-info-lifetime-crash.m b/test/CodeGenObjC/debug-info-lifetime-crash.m index 90382010fb6d..81c7fbca1a80 100644 --- a/test/CodeGenObjC/debug-info-lifetime-crash.m +++ b/test/CodeGenObjC/debug-info-lifetime-crash.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -cc1 -triple arm-apple-ios -emit-llvm -g -fblocks -fobjc-runtime=ios-7.0.0 -fobjc-arc %s -o - | FileCheck %s +// RUN: %clang_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; diff --git a/test/CodeGenObjC/debug-info-property.m b/test/CodeGenObjC/debug-info-property.m index dd105a58bdf4..6e2dcda8b54b 100644 --- a/test/CodeGenObjC/debug-info-property.m +++ b/test/CodeGenObjC/debug-info-property.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s +// FIXME: Check IR rather than asm, then triple is not needed. +// RUN: %clang_cc1 -triple %itanium_abi_triple -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_property_name // CHECK: AT_APPLE_property_attribute diff --git a/test/CodeGenObjC/debug-info-property2.m b/test/CodeGenObjC/debug-info-property2.m index 4cd76c1ca6dc..41140dc20425 100644 --- a/test/CodeGenObjC/debug-info-property2.m +++ b/test/CodeGenObjC/debug-info-property2.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s +// FIXME: Check IR rather than asm, then triple is not needed. +// RUN: %clang_cc1 -triple %itanium_abi_triple -masm-verbose -S -g %s -o - | FileCheck %s // CHECK: AT_APPLE_property_name @interface C { diff --git a/test/CodeGenObjC/debug-info-property4.m b/test/CodeGenObjC/debug-info-property4.m index 71863a6b9f3b..2057d4d1d974 100644 --- a/test/CodeGenObjC/debug-info-property4.m +++ b/test/CodeGenObjC/debug-info-property4.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s +// FIXME: Check IR rather than asm, then triple is not needed. +// RUN: %clang_cc1 -triple %itanium_abi_triple -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 272aa5de0760..126d0a2677e2 100644 --- a/test/CodeGenObjC/debug-info-property5.m +++ b/test/CodeGenObjC/debug-info-property5.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s +// FIXME: Check IR rather than asm, then triple is not needed. +// RUN: %clang_cc1 -triple %itanium_abi_triple -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-pubtypes.m b/test/CodeGenObjC/debug-info-pubtypes.m index 8b7dfadfd91a..845b946f8899 100644 --- a/test/CodeGenObjC/debug-info-pubtypes.m +++ b/test/CodeGenObjC/debug-info-pubtypes.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -g -emit-llvm %s -o - | FileCheck %s // CHECK: {{.*}} [ DW_TAG_structure_type ] [H] [line 6, diff --git a/test/CodeGenObjC/debug-info-self.m b/test/CodeGenObjC/debug-info-self.m index 8cbc0292f0ae..7a484d81481a 100644 --- a/test/CodeGenObjC/debug-info-self.m +++ b/test/CodeGenObjC/debug-info-self.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -g %s -o - | FileCheck %s +// RUN: %clang_cc1 -emit-llvm -triple %itanium_abi_triple -g %s -o - | FileCheck %s // self and _cmd are marked as DW_AT_artificial. // myarg is not marked as DW_AT_artificial. diff --git a/test/CodeGenObjC/debug-property-synth.m b/test/CodeGenObjC/debug-property-synth.m index 954620a63598..68fb956def80 100644 --- a/test/CodeGenObjC/debug-property-synth.m +++ b/test/CodeGenObjC/debug-property-synth.m @@ -1,8 +1,27 @@ -// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s -// Radar 9468526 +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm -g %s -o - | FileCheck %s +// rdar://problem/9468526 +// +// Setting a breakpoint on a property should create breakpoints in +// synthesized getters/setters. +// @interface I { int _p1; } +// Test that the linetable entries for the synthesized getter and +// setter are correct. +// +// CHECK: define {{.*}}[I p1] +// CHECK-NOT: ret +// CHECK: load {{.*}}, !dbg ![[DBG1:[0-9]+]] +// +// CHECK: define {{.*}}[I setP1:] +// CHECK-NOT: ret +// CHECK: load {{.*}}, !dbg ![[DBG2:[0-9]+]] +// +// CHECK: [ DW_TAG_subprogram ] [line [[@LINE+4]]] [local] [def] [-[I p1]] +// CHECK: [ DW_TAG_subprogram ] [line [[@LINE+3]]] [local] [def] [-[I setP1:]] +// CHECK: ![[DBG1]] = metadata !{i32 [[@LINE+2]], +// CHECK: ![[DBG2]] = metadata !{i32 [[@LINE+1]], @property int p1; @end @@ -13,8 +32,5 @@ int main() { I *myi; myi.p1 = 2; - return 0; + return myi.p1; } - -// FIXME: Make this test ir files. -// CHECK: .loc 2 6 0 diff --git a/test/CodeGenObjC/encode-cstyle-method.m b/test/CodeGenObjC/encode-cstyle-method.m index 309089b9b602..d0a99215b9a5 100644 --- a/test/CodeGenObjC/encode-cstyle-method.m +++ b/test/CodeGenObjC/encode-cstyle-method.m @@ -8,4 +8,4 @@ @implementation Foo - (id)test:(id )one, id two {return two; } @end -// CHECK-LP64: internal global [11 x i8] c"@24@0:8@16 +// CHECK-LP64: private global [11 x i8] c"@24@0:8@16 diff --git a/test/CodeGenObjC/encode-test-6.m b/test/CodeGenObjC/encode-test-6.m index b7b37997e1fa..4e9c4222033f 100644 --- a/test/CodeGenObjC/encode-test-6.m +++ b/test/CodeGenObjC/encode-test-6.m @@ -14,8 +14,8 @@ typedef struct {} Z; -(void)foo:(Z)a: (char*)b : (Z)c : (double) d {} @end -// CHECK: internal global [14 x i8] c"v16@0:8{?=}16 -// CHECK: internal global [26 x i8] c"v32@0:8{?=}16*16{?=}24d24 +// CHECK: private global [14 x i8] c"v16@0:8{?=}16 +// CHECK: private global [26 x i8] c"v32@0:8{?=}16*16{?=}24d24 // rdar://13190095 @@ -34,7 +34,7 @@ typedef BABugExample BABugExampleRedefinition; @synthesize property = _property; @end -// CHECK: internal global [24 x i8] c"^{BABugExample=@}16 +// CHECK: private global [24 x i8] c"^{BABugExample=@}16 // rdar://14408244 @class SCNCamera; @@ -52,4 +52,15 @@ typedef struct C3DCameraStorage _storage; } @end -// CHECK: internal global [39 x i8] c"{?=\22presentationInstance\22^{SCNCamera}}\00" +// CHECK: private global [39 x i8] c"{?=\22presentationInstance\22^{SCNCamera}}\00" + +// rdar://16655340 +int i; +typeof(@encode(typeof(i))) e = @encode(typeof(i)); +const char * Test() +{ + return e; +} +// CHECK: @e = global [2 x i8] c"i\00", align 1 +// CHECK: define i8* @Test() +// CHECK: ret i8* getelementptr inbounds ([2 x i8]* @e, i32 0, i32 0) diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m index d6e7b6dfccad..6f2423b66874 100644 --- a/test/CodeGenObjC/encode-test.m +++ b/test/CodeGenObjC/encode-test.m @@ -1,7 +1,7 @@ // RUN: %clang_cc1 -triple i686-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o %t %s // RUN: FileCheck < %t %s // -// CHECK: @"\01L_OBJC_METH_VAR_TYPE_34" = internal global [16 x i8] c"v12@0:4[3[4@]]8\00" +// CHECK: @"\01L_OBJC_METH_VAR_TYPE_34" = private global [16 x i8] c"v12@0:4[3[4@]]8\00" @class Int1; @@ -169,3 +169,11 @@ const char g11[] = @encode(void); // PR14628 // CHECK: @g12 = constant [3 x i8] c"Ai\00" const char g12[] = @encode(_Atomic(int)); + +// rdar://15824769 +id test_id = 0; +Class test_class = 0; +const char g13[] = @encode(__typeof__(*test_class)); +const char g14[] = @encode(__typeof__(*test_id)); +// CHECK: constant [14 x i8] c"{objc_class=}\00" +// CHECK: constant [15 x i8] c"{objc_object=}\00" diff --git a/test/CodeGenObjC/exceptions-asm-attribute.m b/test/CodeGenObjC/exceptions-asm-attribute.m new file mode 100644 index 000000000000..eb369902a3c8 --- /dev/null +++ b/test/CodeGenObjC/exceptions-asm-attribute.m @@ -0,0 +1,86 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fexceptions -fobjc-exceptions -o %t %s +// RUN: FileCheck -check-prefix=CHECK-X86_64 < %t %s +// RUN: FileCheck -check-prefix=CHECK-EHTYPE < %t %s +// rdar://16462586 + +// We need exactly 3 of these. +// CHECK-EHTYPE: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" +// CHECK-EHTYPE: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" +// CHECK-EHTYPE: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" +// CHECK-EHTYPE-NOT: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" + +// CHECK-X86_64: @"OBJC_CLASS_$_MySecretNamespace.A" = global {{.*}}, section "__DATA, __objc_data", align 8 +// CHECK-X86_64: @"OBJC_METACLASS_$_MySecretNamespace.A" = global {{.*}}, section "__DATA, __objc_data", align 8 +// CHECK-X86_64: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,cstring_literals", align 1 +// CHECK-X86_64: @"OBJC_EHTYPE_$_MySecretNamespace.EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 8 +// CHECK-X86_64: @"OBJC_EHTYPE_$_MySecretNamespace.EH2" = external global +// CHECK-X86_64: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" = global {{.*}}, section "__DATA,__objc_const", align 8 +// CHECK-X86_64: @"\01L_OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 +// CHECK-X86_64: define internal void @"\01-[A im0]" +// CHECK-X86_64: define internal void @"\01-[A(Cat) im1]" + +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-exceptions -fvisibility hidden -emit-llvm -o %t %s +// RUN: FileCheck -check-prefix=CHECK-X86_64-HIDDEN < %t %s + +// CHECK-X86_64-HIDDEN: @"OBJC_CLASS_$_MySecretNamespace.A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8 +// CHECK-X86_64-HIDDEN: @"OBJC_METACLASS_$_MySecretNamespace.A" = hidden global {{.*}}, section "__DATA, __objc_data", align 8 +// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH1" = weak hidden global {{.*}}, section "__DATA,__datacoal_nt,coalesced" +// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH2" = external global +// CHECK-X86_64-HIDDEN: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" = hidden global {{.*}}, section "__DATA,__objc_const", align 8 +// CHECK-X86_64-HIDDEN: define internal void @"\01-[A im0]" +// CHECK-X86_64-HIDDEN: define internal void @"\01-[A(Cat) im1]" + +// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -fobjc-exceptions -emit-llvm -o %t %s +// RUN: FileCheck -check-prefix=CHECK-ARMV6 < %t %s + +// CHECK-ARMV6: @"OBJC_CLASS_$_MySecretNamespace.A" = global {{.*}}, section "__DATA, __objc_data", align 4 +// CHECK-ARMV6: @"OBJC_METACLASS_$_MySecretNamespace.A" = global {{.*}}, section "__DATA, __objc_data", align 4 +// CHECK-ARMV6: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,cstring_literals", align 1 +// CHECK-ARMV6: @"OBJC_EHTYPE_$_MySecretNamespace.EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 4 +// CHECK-ARMV6: @"OBJC_EHTYPE_$_MySecretNamespace.EH2" = external global +// CHECK-ARMV6: @"OBJC_EHTYPE_$_MySecretNamespace.EH3" = global {{.*}}, section "__DATA,__objc_const", align 4 +// CHECK-ARMV6: @"\01L_OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 4 +// CHECK-ARMV6: define internal void @"\01-[A im0]" +// CHECK-ARMV6: define internal void @"\01-[A(Cat) im1]" + +__attribute__((objc_runtime_name("MySecretNamespace.A"))) +@interface A +@end + +@implementation A +-(void) im0 { +} +@end + +@implementation A (Cat) +-(void) im1 { +} +@end + +__attribute__((objc_runtime_name("MySecretNamespace.EH1"))) +@interface EH1 +@end + +__attribute__((objc_runtime_name("MySecretNamespace.EH2"))) +__attribute__((__objc_exception__)) +@interface EH2 +@end + +__attribute__((objc_runtime_name("MySecretNamespace.EH3"))) +__attribute__((__objc_exception__)) +@interface EH3 +@end + +void f1(); + +void f0(id x) { + @try { + f1(); + } @catch (EH1 *x) { + } @catch (EH2 *x) { + } @catch (EH3 *x) { + } +} + +@implementation EH3 +@end diff --git a/test/CodeGenObjC/externally-initialized-selectors.m b/test/CodeGenObjC/externally-initialized-selectors.m index 87a7c04cf718..0b7c24eadd84 100644 --- a/test/CodeGenObjC/externally-initialized-selectors.m +++ b/test/CodeGenObjC/externally-initialized-selectors.m @@ -1,7 +1,7 @@ -// RUN: %clang_cc1 -cc1 -fobjc-runtime=macosx-fragile-10.5 -o - -emit-llvm %s | FileCheck %s -// RUN: %clang_cc1 -cc1 -o - -emit-llvm %s | FileCheck %s +// RUN: %clang_cc1 -fobjc-runtime=macosx-fragile-10.5 -o - -emit-llvm %s | FileCheck %s +// RUN: %clang_cc1 -o - -emit-llvm %s | FileCheck %s -// CHECK: @"\01L_OBJC_SELECTOR_REFERENCES_" = internal externally_initialized global +// CHECK: @"\01L_OBJC_SELECTOR_REFERENCES_" = private externally_initialized global void test(id x) { [x doSomething]; diff --git a/test/CodeGenObjC/forward-protocol-metadata-symbols.m b/test/CodeGenObjC/forward-protocol-metadata-symbols.m new file mode 100644 index 000000000000..2b687d19f907 --- /dev/null +++ b/test/CodeGenObjC/forward-protocol-metadata-symbols.m @@ -0,0 +1,26 @@ +// RUN: %clang_cc1 -emit-llvm -x objective-c %s -o - | FileCheck %s +// rdar://16203115 + +@interface NSObject @end + +@protocol P0; + +@interface A : NSObject <P0> ++(Class) getClass; +@end + +@implementation A ++(Class) getClass { return self; } +@end + +int main() { + Protocol *P0 = @protocol(P0); + return 0; +} + +// CHECK: @"\01l_OBJC_PROTOCOL_$_P0" = weak hidden global +// CHECK: @"\01l_OBJC_CLASS_PROTOCOLS_$_A" = private global +// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P0" = weak hidden global +// CHECK: @"\01l_OBJC_PROTOCOL_REFERENCE_$_P0" = weak hidden global + +// CHECK: llvm.compiler.used = appending global [10 x i8*] {{[^"]*}}"\01L_OBJC_CLASS_NAME_"{{[^"]*}}"\01L_OBJC_METH_VAR_NAME_"{{[^"]*}}"\01L_OBJC_METH_VAR_TYPE_"{{[^"]*}}"\01l_OBJC_$_CLASS_METHODS_A"{{[^"]*}}"\01l_OBJC_CLASS_PROTOCOLS_$_A"{{[^"]*}}"\01L_OBJC_CLASS_NAME_1"{{[^"]*}}"\01l_OBJC_PROTOCOL_$_P0"{{[^"]*}}"\01l_OBJC_LABEL_PROTOCOL_$_P0"{{[^"]*}}"\01l_OBJC_PROTOCOL_REFERENCE_$_P0"{{[^"]*}}"\01L_OBJC_LABEL_CLASS_$"{{[^"]*}} section "llvm.metadata" diff --git a/test/CodeGenObjC/getter-property-mismatch.m b/test/CodeGenObjC/getter-property-mismatch.m index 21ed6eea68e8..fe415d5358d3 100644 --- a/test/CodeGenObjC/getter-property-mismatch.m +++ b/test/CodeGenObjC/getter-property-mismatch.m @@ -13,7 +13,7 @@ @synthesize filenamesToServerLocation=_filenamesToServerLocation; @end -// CHECK: [[CALL:%.*]] = call i8* @objc_getProperty +// CHECK: [[CALL:%.*]] = tail call i8* @objc_getProperty // CHECK: [[ONE:%.*]] = bitcast i8* [[CALL:%.*]] to [[T1:%.*]]* // CHECK: [[TWO:%.*]] = bitcast [[T1]]* [[ONE]] to [[T2:%.*]]* // CHECK: ret [[T2]]* [[TWO]] diff --git a/test/CodeGenObjC/image-info.m b/test/CodeGenObjC/image-info.m index 030bcaed1a38..49f5d90808a9 100644 --- a/test/CodeGenObjC/image-info.m +++ b/test/CodeGenObjC/image-info.m @@ -4,14 +4,14 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s // RUN: FileCheck --check-prefix CHECK-NONFRAGILE < %t %s -// CHECK-FRAGILE: !llvm.module.flags = !{!0, !1, !2, !3} -// CHECK-FRAGILE: !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 1} -// CHECK-FRAGILE-NEXT: !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} -// CHECK-FRAGILE-NEXT: !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__OBJC, __image_info,regular"} -// CHECK-FRAGILE-NEXT: !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0} +// CHECK-FRAGILE: !llvm.module.flags = !{{{.*}}} +// CHECK-FRAGILE: !{{[0-9]+}} = metadata !{i32 1, metadata !"Objective-C Version", i32 1} +// CHECK-FRAGILE-NEXT: !{{[0-9]+}} = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} +// CHECK-FRAGILE-NEXT: !{{[0-9]+}} = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__OBJC, __image_info,regular"} +// CHECK-FRAGILE-NEXT: !{{[0-9]+}} = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0} -// CHECK-NONFRAGILE: !llvm.module.flags = !{!0, !1, !2, !3} -// CHECK-NONFRAGILE: !0 = metadata !{i32 1, metadata !"Objective-C Version", i32 2} -// CHECK-NONFRAGILE-NEXT: !1 = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} -// CHECK-NONFRAGILE-NEXT: !2 = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} -// CHECK-NONFRAGILE-NEXT: !3 = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0} +// CHECK-NONFRAGILE: !llvm.module.flags = !{{{.*}}} +// CHECK-NONFRAGILE: !{{[0-9]+}} = metadata !{i32 1, metadata !"Objective-C Version", i32 2} +// CHECK-NONFRAGILE-NEXT: !{{[0-9]+}} = metadata !{i32 1, metadata !"Objective-C Image Info Version", i32 0} +// CHECK-NONFRAGILE-NEXT: !{{[0-9]+}} = metadata !{i32 1, metadata !"Objective-C Image Info Section", metadata !"__DATA, __objc_imageinfo, regular, no_dead_strip"} +// CHECK-NONFRAGILE-NEXT: !{{[0-9]+}} = metadata !{i32 4, metadata !"Objective-C Garbage Collection", i32 0} diff --git a/test/CodeGenObjC/instance-method-metadata.m b/test/CodeGenObjC/instance-method-metadata.m index 0d8c0e0eae50..59be44031325 100644 --- a/test/CodeGenObjC/instance-method-metadata.m +++ b/test/CodeGenObjC/instance-method-metadata.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -o %t %s // RUN: FileCheck < %t %s diff --git a/test/CodeGenObjC/interface-layout-64.m b/test/CodeGenObjC/interface-layout-64.m index 4b41cf855ed3..450300de72b2 100644 --- a/test/CodeGenObjC/interface-layout-64.m +++ b/test/CodeGenObjC/interface-layout-64.m @@ -2,24 +2,24 @@ // CHECK: @"OBJC_IVAR_$_I3._iv2" = global i64 8, section "__DATA, __objc_ivar", align 8 // CHECK: @"OBJC_IVAR_$_I3._iv3" = global i64 12, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I3" = internal global {{.*}} { i32 0, i32 8, i32 13 +// CHECK: _OBJC_CLASS_RO_$_I3" = private global {{.*}} { i32 0, i32 8, i32 13 // CHECK: @"OBJC_IVAR_$_I4._iv4" = global i64 13, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I4" = internal global {{.*}} { i32 0, i32 13, i32 14, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I4" = private global {{.*}} { i32 0, i32 13, i32 14, {{.*}} // CHECK: @"OBJC_IVAR_$_I5._iv6_synth" = hidden global i64 16, section "__DATA, __objc_ivar", align 8 // CHECK: @"OBJC_IVAR_$_I5._iv7_synth" = hidden global i64 20, section "__DATA, __objc_ivar", align 8 // CHECK: @"OBJC_IVAR_$_I5._iv5" = global i64 14, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I5" = internal global {{.*}} { i32 0, i32 14, i32 24, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I5" = private global {{.*}} { i32 0, i32 14, i32 24, {{.*}} // CHECK: @"OBJC_IVAR_$_I6.iv0" = global i64 0, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I6" = internal global {{.*}} { i32 2, i32 0, i32 1, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I6" = private global {{.*}} { i32 2, i32 0, i32 1, {{.*}} // CHECK: @"OBJC_IVAR_$_I8.b" = global i64 8, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I8" = internal global {{.*}} { i32 0, i32 8, i32 16, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I8" = private global {{.*}} { i32 0, i32 8, i32 16, {{.*}} // CHECK: @"OBJC_IVAR_$_I9.iv0" = global i64 0, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I9" = internal global {{.*}} { i32 2, i32 0, i32 4, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I9" = private global {{.*}} { i32 2, i32 0, i32 4, {{.*}} // CHECK: @"OBJC_IVAR_$_I10.iv1" = global i64 4, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I10" = internal global {{.*}} { i32 0, i32 4, i32 5, {{.*}} -// CHECK: _OBJC_CLASS_RO_$_I11" = internal global {{.*}} { i32 0, i32 5, i32 5, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I10" = private global {{.*}} { i32 0, i32 4, i32 5, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I11" = private global {{.*}} { i32 0, i32 5, i32 5, {{.*}} // CHECK: @"OBJC_IVAR_$_I12.iv2" = global i64 8, section "__DATA, __objc_ivar", align 8 -// CHECK: _OBJC_CLASS_RO_$_I12" = internal global {{.*}} { i32 0, i32 8, i32 12, {{.*}} +// CHECK: _OBJC_CLASS_RO_$_I12" = private global {{.*}} { i32 0, i32 8, i32 12, {{.*}} /* Compare to: diff --git a/test/CodeGenObjC/ivar-base-as-invariant-load.m b/test/CodeGenObjC/ivar-base-as-invariant-load.m index 19dc6587f553..061fea31a5ce 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 !5 -// CHECK: [[T2:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !5 -// CHECK: [[T3:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load !5 - +// CHECK: [[T1:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load ![[MD_NUM:[0-9]+]] +// CHECK: [[T2:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load ![[MD_NUM]] +// CHECK: [[T3:%.*]] = load i64* @"OBJC_IVAR_$_A._flags", !invariant.load ![[MD_NUM]] +// diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m index 91a8375e6365..068d109321fc 100644 --- a/test/CodeGenObjC/ivar-layout-64.m +++ b/test/CodeGenObjC/ivar-layout-64.m @@ -33,9 +33,9 @@ __weak B *f2; @property int p3; @end -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"C\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11p\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!`\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"C\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"\11p\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"!`\00" @implementation C @@ -48,9 +48,9 @@ __weak B *f2; @property (assign) __weak id p2; @end -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"A\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11q\10\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!q\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"A\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"\11q\10\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"!q\00" @implementation A @synthesize p0 = _p0; @@ -62,9 +62,9 @@ __weak B *f2; @property int p3; @end -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"D\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11p\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!`\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"D\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"\11p\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"!`\00" @implementation D @synthesize p3 = _p3; @@ -89,8 +89,8 @@ typedef unsigned int FSCatalogInfoBitmap; } @end -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"NSFileLocationComponent\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\01\14\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"NSFileLocationComponent\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"\01\14\00" @implementation NSFileLocationComponent @end @@ -108,7 +108,7 @@ typedef unsigned int FSCatalogInfoBitmap; } @end -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"Foo\00" -// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\02\10\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"Foo\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = private global {{.*}} c"\02\10\00" @implementation Foo @end diff --git a/test/CodeGenObjC/ivar-layout-array0-struct.m b/test/CodeGenObjC/ivar-layout-array0-struct.m index 47373035214d..8e277106a71c 100644 --- a/test/CodeGenObjC/ivar-layout-array0-struct.m +++ b/test/CodeGenObjC/ivar-layout-array0-struct.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // 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 diff --git a/test/CodeGenObjC/ivar-layout-no-optimize.m b/test/CodeGenObjC/ivar-layout-no-optimize.m index 17b519577f97..554038f5ba9e 100644 --- a/test/CodeGenObjC/ivar-layout-no-optimize.m +++ b/test/CodeGenObjC/ivar-layout-no-optimize.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // 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 diff --git a/test/CodeGenObjC/metadata-symbols-32.m b/test/CodeGenObjC/metadata-symbols-32.m index fda909ca7449..61279e1dbed9 100644 --- a/test/CodeGenObjC/metadata-symbols-32.m +++ b/test/CodeGenObjC/metadata-symbols-32.m @@ -2,31 +2,33 @@ // CHECK: .lazy_reference .objc_class_name_J0 -// CHECK: @"\01L_OBJC_METH_VAR_NAME_{{[0-9]*}}" = internal global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01L_OBJC_METH_VAR_TYPE_{{[0-9]*}}" = internal global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01L_OBJC_CLASS_NAME_{{[0-9]*}}" = internal global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01L_OBJC_PROTOCOL_INSTANCE_METHODS_P" = internal global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_PROTOCOL_CLASS_METHODS_P" = internal global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_PROTOCOL_P" = internal global {{.*}}section "__OBJC,__protocol,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASS_PROTOCOLS_A" = internal global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASS_METHODS_A" = internal global {{.*}}section "__OBJC,__cls_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_METACLASS_A" = internal global {{.*}}section "__OBJC,__meta_class,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_INSTANCE_VARIABLES_A" = internal global {{.*}}section "__OBJC,__instance_vars,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_INSTANCE_METHODS_A" = internal global {{.*}}section "__OBJC,__inst_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_PROP_NAME_ATTR_{{[0-9]*}}" = internal global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01l_OBJC_$_PROP_LIST_A" = internal global {{.*}}section "__OBJC,__property,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASSEXT_A" = internal global {{.*}}section "__OBJC,__class_ext,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASS_A" = internal global {{.*}}section "__OBJC,__class,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CATEGORY_INSTANCE_METHODS_A_Cat" = internal global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CATEGORY_CLASS_METHODS_A_Cat" = internal global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CATEGORY_A_Cat" = internal global {{.*}}section "__OBJC,__category,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASS_REFERENCES_{{[0-9]*}}" = internal global {{.*}}section "__OBJC,__cls_refs,literal_pointers,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_SELECTOR_REFERENCES_{{[0-9]*}}" = internal externally_initialized global {{.*}}section "__OBJC,__message_refs,literal_pointers,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_SYMBOLS" = internal global {{.*}}section "__OBJC,__symbols,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_MODULES" = internal global {{.*}}section "__OBJC,__module_info,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_METH_VAR_NAME_{{[0-9]*}}" = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @"\01L_OBJC_METH_VAR_TYPE_{{[0-9]*}}" = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @"\01l_OBJC_PROTOCOLEXT_P" = private global +// CHECK-NOT: section +// CHECK: @"\01L_OBJC_CLASS_NAME_{{[0-9]*}}" = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @"\01L_OBJC_PROTOCOL_INSTANCE_METHODS_P" = private global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_PROTOCOL_CLASS_METHODS_P" = private global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_PROTOCOL_P" = private global {{.*}}section "__OBJC,__protocol,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASS_PROTOCOLS_A" = private global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASS_METHODS_A" = private global {{.*}}section "__OBJC,__cls_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_METACLASS_A" = private global {{.*}}section "__OBJC,__meta_class,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_INSTANCE_VARIABLES_A" = private global {{.*}}section "__OBJC,__instance_vars,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_INSTANCE_METHODS_A" = private global {{.*}}section "__OBJC,__inst_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_PROP_NAME_ATTR_{{[0-9]*}}" = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @"\01l_OBJC_$_PROP_LIST_A" = private global {{.*}}section "__OBJC,__property,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASSEXT_A" = private global {{.*}}section "__OBJC,__class_ext,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASS_A" = private global {{.*}}section "__OBJC,__class,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CATEGORY_INSTANCE_METHODS_A_Cat" = private global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CATEGORY_CLASS_METHODS_A_Cat" = private global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CATEGORY_A_Cat" = private global {{.*}}section "__OBJC,__category,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASS_REFERENCES_{{[0-9]*}}" = private global {{.*}}section "__OBJC,__cls_refs,literal_pointers,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_SELECTOR_REFERENCES_{{[0-9]*}}" = private externally_initialized global {{.*}}section "__OBJC,__message_refs,literal_pointers,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_SYMBOLS" = private global {{.*}}section "__OBJC,__symbols,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_MODULES" = private global {{.*}}section "__OBJC,__module_info,regular,no_dead_strip", align 4 // Clang's Obj-C 32-bit doesn't emit ivars for the root class. -// CHECKX: @"\01L_OBJC_CLASS_VARIABLES_A" = internal global {{.*}}section "__OBJC,__class_vars,regular,no_dead_strip", align 4 +// CHECKX: @"\01L_OBJC_CLASS_VARIABLES_A" = private global {{.*}}section "__OBJC,__class_vars,regular,no_dead_strip", align 4 /* diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m index a89fec56de2b..7b9609386900 100644 --- a/test/CodeGenObjC/metadata-symbols-64.m +++ b/test/CodeGenObjC/metadata-symbols-64.m @@ -5,32 +5,32 @@ // CHECK: @_objc_empty_vtable = external global // CHECK: @"OBJC_CLASS_$_A" = global // CHECK: @"OBJC_METACLASS_$_A" = global {{.*}} section "__DATA, __objc_data", align 8 -// CHECK: @"\01L_OBJC_CLASS_NAME_{{[0-9]*}}" = internal global {{.*}} section "__TEXT,__objc_classname,cstring_literals", align 1 -// CHECK: @"\01L_OBJC_METH_VAR_NAME_{{[0-9]*}}" = internal global {{.*}} section "__TEXT,__objc_methname,cstring_literals", align 1 -// CHECK: @"\01L_OBJC_METH_VAR_TYPE_{{[0-9]*}}" = internal global {{.*}} section "__TEXT,__objc_methtype,cstring_literals", align 1 -// CHECK: @"\01l_OBJC_$_CLASS_METHODS_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_P" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_PROTOCOL_CLASS_METHODS_P" = internal global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01L_OBJC_CLASS_NAME_{{[0-9]*}}" = private global {{.*}} section "__TEXT,__objc_classname,cstring_literals", align 1 +// CHECK: @"\01L_OBJC_METH_VAR_NAME_{{[0-9]*}}" = private global {{.*}} section "__TEXT,__objc_methname,cstring_literals", align 1 +// CHECK: @"\01L_OBJC_METH_VAR_TYPE_{{[0-9]*}}" = private global {{.*}} section "__TEXT,__objc_methtype,cstring_literals", align 1 +// CHECK: @"\01l_OBJC_$_CLASS_METHODS_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_P" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_$_PROTOCOL_CLASS_METHODS_P" = private global {{.*}} section "__DATA, __objc_const", align 8 // CHECK: @"\01l_OBJC_PROTOCOL_$_P" = weak hidden global {{.*}} section "__DATA,__datacoal_nt,coalesced", align 8 // CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = weak hidden global {{.*}} section "__DATA, __objc_protolist, coalesced, no_dead_strip", align 8 -// CHECK: @"\01l_OBJC_CLASS_PROTOCOLS_$_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_METACLASS_RO_$_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_INSTANCE_METHODS_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_INSTANCE_VARIABLES_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01L_OBJC_PROP_NAME_ATTR_{{[0-9]*}}" = internal global {{.*}} section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @"\01l_OBJC_$_PROP_LIST_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_CLASS_RO_$_A" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_A_$_Cat" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CATEGORY_CLASS_METHODS_A_$_Cat" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01l_OBJC_$_CATEGORY_A_$_Cat" = internal global {{.*}} section "__DATA, __objc_const", align 8 -// CHECK: @"\01L_OBJC_CLASSLIST_SUP_REFS_$_{{[0-9]*}}" = internal global {{.*}} section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8 -// CHECK: @"\01L_OBJC_SELECTOR_REFERENCES_" = internal externally_initialized global {{.*}} section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" -// CHECK: @"\01L_OBJC_CLASSLIST_SUP_REFS_$_{{[0-9]*}}" = internal global {{.*}} section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8 +// CHECK: @"\01l_OBJC_CLASS_PROTOCOLS_$_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_METACLASS_RO_$_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_$_INSTANCE_METHODS_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_$_INSTANCE_VARIABLES_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01L_OBJC_PROP_NAME_ATTR_{{[0-9]*}}" = private global {{.*}} section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @"\01l_OBJC_$_PROP_LIST_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_CLASS_RO_$_A" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_A_$_Cat" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_$_CATEGORY_CLASS_METHODS_A_$_Cat" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01l_OBJC_$_CATEGORY_A_$_Cat" = private global {{.*}} section "__DATA, __objc_const", align 8 +// CHECK: @"\01L_OBJC_CLASSLIST_SUP_REFS_$_{{[0-9]*}}" = private global {{.*}} section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8 +// CHECK: @"\01L_OBJC_SELECTOR_REFERENCES_" = private externally_initialized global {{.*}} section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip" +// CHECK: @"\01L_OBJC_CLASSLIST_SUP_REFS_$_{{[0-9]*}}" = private global {{.*}} section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8 // CHECK: @"OBJC_CLASS_$_B" = external global -// CHECK: @"\01L_OBJC_CLASSLIST_REFERENCES_$_{{[0-9]*}}" = internal global {{.*}} section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 +// CHECK: @"\01L_OBJC_CLASSLIST_REFERENCES_$_{{[0-9]*}}" = private global {{.*}} section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8 // CHECK: @"\01l_objc_msgSend_fixup_alloc" = weak hidden global {{.*}} section "__DATA, __objc_msgrefs, coalesced", align 16 -// CHECK: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}} section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 -// CHECK: @"\01L_OBJC_LABEL_CATEGORY_$" = internal global {{.*}} section "__DATA, __objc_catlist, regular, no_dead_strip", align 8 +// CHECK: @"\01L_OBJC_LABEL_CLASS_$" = private global {{.*}} section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 +// CHECK: @"\01L_OBJC_LABEL_CATEGORY_$" = private global {{.*}} section "__DATA, __objc_catlist, regular, no_dead_strip", align 8 // CHECK: @objc_msgSend_fpret( // CHECK: @objc_msgSend_fixup( diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m index eedcf16627a6..2b61c5d4bad3 100644 --- a/test/CodeGenObjC/metadata_symbols.m +++ b/test/CodeGenObjC/metadata_symbols.m @@ -14,7 +14,7 @@ // CHECK-X86_64: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 8 // CHECK-X86_64: @"OBJC_EHTYPE_$_EH2" = external global // CHECK-X86_64: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 8 -// CHECK-X86_64: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 +// CHECK-X86_64: @"\01L_OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8 // CHECK-X86_64: define internal void @"\01-[A im0]" // CHECK-X86_64: define internal void @"\01-[A(Cat) im1]" @@ -38,7 +38,7 @@ // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH1" = weak global {{.*}}, section "__DATA,__datacoal_nt,coalesced", align 4 // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH2" = external global // CHECK-ARMV6: @"OBJC_EHTYPE_$_EH3" = global {{.*}}, section "__DATA,__objc_const", align 4 -// CHECK-ARMV6: @"\01L_OBJC_LABEL_CLASS_$" = internal global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 4 +// CHECK-ARMV6: @"\01L_OBJC_LABEL_CLASS_$" = private global {{.*}}, section "__DATA, __objc_classlist, regular, no_dead_strip", align 4 // CHECK-ARMV6: define internal void @"\01-[A im0]" // CHECK-ARMV6: define internal void @"\01-[A(Cat) im1]" diff --git a/test/CodeGenObjC/no-vararg-messaging.m b/test/CodeGenObjC/no-vararg-messaging.m index 3f9d934ec88f..0095209820b3 100644 --- a/test/CodeGenObjC/no-vararg-messaging.m +++ b/test/CodeGenObjC/no-vararg-messaging.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S -o - %s | FileCheck %s // rdar://9048030 diff --git a/test/CodeGenObjC/non-lazy-classes.m b/test/CodeGenObjC/non-lazy-classes.m index d95cb78d4b1c..760ddad068c5 100644 --- a/test/CodeGenObjC/non-lazy-classes.m +++ b/test/CodeGenObjC/non-lazy-classes.m @@ -1,6 +1,6 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o %t %s -// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CLASS_$" = internal global \[1 x .*\] .*@"OBJC_CLASS_$_A".*, section "__DATA, __objc_nlclslist, regular, no_dead_strip", align 8' %t -// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CATEGORY_$" = internal global \[1 x .*\] .*@".01l_OBJC_$_CATEGORY_A_$_Cat".*, section "__DATA, __objc_nlcatlist, regular, no_dead_strip", align 8' %t +// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CLASS_$" = private global \[1 x .*\] .*@"OBJC_CLASS_$_A".*, section "__DATA, __objc_nlclslist, regular, no_dead_strip", align 8' %t +// RUN: grep '@".01L_OBJC_LABEL_NONLAZY_CATEGORY_$" = private global \[1 x .*\] .*@".01l_OBJC_$_CATEGORY_A_$_Cat".*, section "__DATA, __objc_nlcatlist, regular, no_dead_strip", align 8' %t @interface A @end @implementation A diff --git a/test/CodeGenObjC/objc-align.m b/test/CodeGenObjC/objc-align.m index 1a96f34c5d9f..2b2133ea59b1 100644 --- a/test/CodeGenObjC/objc-align.m +++ b/test/CodeGenObjC/objc-align.m @@ -1,14 +1,14 @@ // 32-bit // RUN: %clang_cc1 -triple i386-apple-darwin9 -fobjc-runtime=macosx-fragile-10.5 -emit-llvm -o - %s | FileCheck %s -// CHECK: @"\01L_OBJC_METACLASS_A" = internal global {{.*}}, section "__OBJC,__meta_class,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASS_A" = internal global {{.*}}, section "__OBJC,__class,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CATEGORY_A_Cat" = internal global {{.*}}, section "__OBJC,__category,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_PROTOCOL_P" = internal global {{.*}}, section "__OBJC,__protocol,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASS_PROTOCOLS_C" = internal global {{.*}}, section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_METACLASS_C" = internal global {{.*}}, section "__OBJC,__meta_class,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_CLASS_C" = internal global {{.*}}, section "__OBJC,__class,regular,no_dead_strip", align 4 -// CHECK: @"\01L_OBJC_MODULES" = internal global {{.*}}, section "__OBJC,__module_info,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_METACLASS_A" = private global {{.*}}, section "__OBJC,__meta_class,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASS_A" = private global {{.*}}, section "__OBJC,__class,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CATEGORY_A_Cat" = private global {{.*}}, section "__OBJC,__category,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_PROTOCOL_P" = private global {{.*}}, section "__OBJC,__protocol,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASS_PROTOCOLS_C" = private global {{.*}}, section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_METACLASS_C" = private global {{.*}}, section "__OBJC,__meta_class,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_CLASS_C" = private global {{.*}}, section "__OBJC,__class,regular,no_dead_strip", align 4 +// CHECK: @"\01L_OBJC_MODULES" = private global {{.*}}, section "__OBJC,__module_info,regular,no_dead_strip", align 4 // 64-bit @@ -17,16 +17,16 @@ // RUNX: grep '@"OBJC_CLASS_$_C" = global' %t && // RUNX: grep '@"OBJC_METACLASS_$_A" = global' %t && // RUNX: grep '@"OBJC_METACLASS_$_C" = global' %t && -// RUNX: grep '@"\\01L_OBJC_CLASSLIST_REFERENCES_$_0" = internal global .*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8' %t && -// RUNX: grep '@"\\01L_OBJC_LABEL_CATEGORY_$" = internal global .*, section "__DATA, __objc_catlist, regular, no_dead_strip", align 8' %t && -// RUNX: grep '@"\\01L_OBJC_LABEL_CLASS_$" = internal global .*, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8' %t && -// RUNX: grep '@"\\01l_OBJC_$_CATEGORY_A_$_Cat" = internal global .*, section "__DATA, __objc_const", align 8' %t && -// RUNX: grep '@"\\01l_OBJC_CLASS_PROTOCOLS_$_C" = internal global .*, section "__DATA, __objc_const", align 8' %t && -// RUNX: grep '@"\\01l_OBJC_CLASS_RO_$_A" = internal global .*, section "__DATA, __objc_const", align 8' %t && -// RUNX: grep '@"\\01l_OBJC_CLASS_RO_$_C" = internal global .*, section "__DATA, __objc_const", align 8' %t && +// RUNX: grep '@"\\01L_OBJC_CLASSLIST_REFERENCES_$_0" = private global .*, section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8' %t && +// RUNX: grep '@"\\01L_OBJC_LABEL_CATEGORY_$" = private global .*, section "__DATA, __objc_catlist, regular, no_dead_strip", align 8' %t && +// RUNX: grep '@"\\01L_OBJC_LABEL_CLASS_$" = private global .*, section "__DATA, __objc_classlist, regular, no_dead_strip", align 8' %t && +// RUNX: grep '@"\\01l_OBJC_$_CATEGORY_A_$_Cat" = private global .*, section "__DATA, __objc_const", align 8' %t && +// RUNX: grep '@"\\01l_OBJC_CLASS_PROTOCOLS_$_C" = private global .*, section "__DATA, __objc_const", align 8' %t && +// RUNX: grep '@"\\01l_OBJC_CLASS_RO_$_A" = private global .*, section "__DATA, __objc_const", align 8' %t && +// RUNX: grep '@"\\01l_OBJC_CLASS_RO_$_C" = private global .*, section "__DATA, __objc_const", align 8' %t && // RUNX: grep '@"\\01l_OBJC_LABEL_PROTOCOL_$_P" = weak hidden global .*, section "__DATA, __objc_protolist, coalesced, no_dead_strip", align 8' %t && -// RUNX: grep '@"\\01l_OBJC_METACLASS_RO_$_A" = internal global .*, section "__DATA, __objc_const", align 8' %t && -// RUNX: grep '@"\\01l_OBJC_METACLASS_RO_$_C" = internal global .*, section "__DATA, __objc_const", align 8' %t && +// RUNX: grep '@"\\01l_OBJC_METACLASS_RO_$_A" = private global .*, section "__DATA, __objc_const", align 8' %t && +// RUNX: grep '@"\\01l_OBJC_METACLASS_RO_$_C" = private global .*, section "__DATA, __objc_const", align 8' %t && // RUNX: grep '@"\\01l_OBJC_PROTOCOL_$_P" = weak hidden global .*, section "__DATA,__datacoal_nt,coalesced", align 8' %t && diff --git a/test/CodeGenObjC/objc-asm-attribute-neg-test.m b/test/CodeGenObjC/objc-asm-attribute-neg-test.m new file mode 100644 index 000000000000..e9bef4cdb762 --- /dev/null +++ b/test/CodeGenObjC/objc-asm-attribute-neg-test.m @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -fsyntax-only -verify -Wno-objc-root-class %s +// rdar://16462586 + +__attribute__((objc_runtime_name("MySecretNamespace.Protocol"))) +@protocol Protocol +@end + +__attribute__((objc_runtime_name("MySecretNamespace.Message"))) +@interface Message <Protocol> { +__attribute__((objc_runtime_name("MySecretNamespace.Message"))) // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}} + id MyIVAR; +} +__attribute__((objc_runtime_name("MySecretNamespace.Message"))) +@property int MyProperty; // expected-error {{prefix attribute must be followed by an interface or protocol}}}} + +- (int) getMyProperty __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}} + +- (void) setMyProperty : (int) arg __attribute__((objc_runtime_name("MySecretNamespace.Message"))); // expected-error {{'objc_runtime_name' attribute only applies to interface or protocol declarations}} + +@end + +__attribute__((objc_runtime_name("MySecretNamespace.ForwardClass"))) +@class ForwardClass; // expected-error {{prefix attribute must be followed by an interface or protocol}} + +__attribute__((objc_runtime_name("MySecretNamespace.ForwardProtocol"))) +@protocol ForwardProtocol; + +__attribute__((objc_runtime_name("MySecretNamespace.Message"))) +@implementation Message // expected-error {{prefix attribute must be followed by an interface or protocol}} +__attribute__((objc_runtime_name("MySecretNamespace.Message"))) +- (id) MyMethod { + return MyIVAR; +} +@end diff --git a/test/CodeGenObjC/objc-asm-attribute-test.m b/test/CodeGenObjC/objc-asm-attribute-test.m new file mode 100644 index 000000000000..12903b522e54 --- /dev/null +++ b/test/CodeGenObjC/objc-asm-attribute-test.m @@ -0,0 +1,54 @@ +// RUN: %clang_cc1 -emit-llvm -triple x86_64-apple-darwin %s -o - | FileCheck %s +// rdar://16462586 + +__attribute__((objc_runtime_name("MySecretNamespace.Protocol"))) +@protocol Protocol +- (void) MethodP; ++ (void) ClsMethodP; +@end + +__attribute__((objc_runtime_name("MySecretNamespace.Protocol2"))) +@protocol Protocol2 +- (void) MethodP2; ++ (void) ClsMethodP2; +@end + +__attribute__((objc_runtime_name("MySecretNamespace.Message"))) +@interface Message <Protocol, Protocol2> { + id MyIVAR; +} +@end + +@implementation Message +- (id) MyMethod { + return MyIVAR; +} + ++ (id) MyClsMethod { + return 0; +} + +- (void) MethodP{} +- (void) MethodP2{} + ++ (void) ClsMethodP {} ++ (void) ClsMethodP2 {} +@end + +// rdar://16877359 +__attribute__((objc_runtime_name("foo"))) +@interface SLREarth +- (instancetype)init; ++ (instancetype)alloc; +@end + +id Test16877359() { + return [SLREarth alloc]; +} + +// CHECK: @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" = global i64 +// CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t +// CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t +// CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t +// CHECK: define internal i8* @"\01-[Message MyMethod]" +// CHECK: [[IVAR:%.*]] = load i64* @"OBJC_IVAR_$_MySecretNamespace.Message.MyIVAR" diff --git a/test/CodeGenObjC/objc-read-weak-byref.m b/test/CodeGenObjC/objc-read-weak-byref.m index 35b4de1cec2e..228f4770892f 100644 --- a/test/CodeGenObjC/objc-read-weak-byref.m +++ b/test/CodeGenObjC/objc-read-weak-byref.m @@ -1,8 +1,7 @@ -// 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 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 CHECK-LP32 --input-file=%t-32.s %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple x86_64-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | \ +// RUN: FileCheck %s +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | \ +// RUN: FileCheck %s @interface NSObject - copy; @@ -19,8 +18,5 @@ int main() { return 0; } -// CHECK-LP64: callq _objc_read_weak -// CHECK-LP64: callq _objc_read_weak - -// CHECK-LP32: calll L_objc_read_weak -// CHECK-LP32: calll L_objc_read_weak +// CHECK: call i8* @objc_read_weak +// CHECK: call i8* @objc_read_weak diff --git a/test/CodeGenObjC/objc2-weak-block-call.m b/test/CodeGenObjC/objc2-weak-block-call.m index 7c6881751dbe..e13cc7d53984 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 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 +// RUN: %clang_cc1 -fblocks -fobjc-gc -triple i386-apple-darwin -fobjc-runtime=macosx-fragile-10.5 -emit-llvm %s -o - | FileCheck -check-prefix CHECK-LP32 %s @interface MyView - (void)MyView_sharedInit; diff --git a/test/CodeGenObjC/objc2-weak-import-attribute.m b/test/CodeGenObjC/objc2-weak-import-attribute.m index 201e24b9e5ec..6ee57467b227 100644 --- a/test/CodeGenObjC/objc2-weak-import-attribute.m +++ b/test/CodeGenObjC/objc2-weak-import-attribute.m @@ -45,4 +45,4 @@ __attribute__((weak_import)) @interface Root @end @implementation Root @end -// CHECK-NOT-X86-64: OBJC_METACLASS_$_Root" = extern_weak global +// CHECK-X86-64-NOT: OBJC_METACLASS_$_Root" = extern_weak global diff --git a/test/CodeGenObjC/optimize-ivar-offset-load.m b/test/CodeGenObjC/optimize-ivar-offset-load.m new file mode 100644 index 000000000000..d34ac137587f --- /dev/null +++ b/test/CodeGenObjC/optimize-ivar-offset-load.m @@ -0,0 +1,64 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -Os -emit-llvm %s -o - | FileCheck %s +// rdar://16095748 + +@interface NSObject +@end + +@interface SampleClass : NSObject { + @public + int _value; +} ++ (SampleClass*) new; +@end + +@interface AppDelegate : NSObject +@end + +extern void foo(int); + +@implementation AppDelegate +- (void)application +{ + // Create set of objects in loop + for(int i = 0; i < 2; i++) { + SampleClass *sample = [SampleClass new]; + foo (sample->_value); + } +} +@end +// CHECK: [[IVAR:%.*]] = load i64* @"OBJC_IVAR_$_SampleClass._value", align 8 +// CHECK: [[THREE:%.*]] = bitcast [[ONE:%.*]]* [[CALL:%.*]] to i8* +// CHECK: [[ADDPTR:%.*]] = getelementptr inbounds i8* [[THREE]], i64 [[IVAR]] +// CHECK: [[FOUR:%.*]] = bitcast i8* [[ADDPTR]] to i32* +// CHECK: [[FIVE:%.*]] = load i32* [[FOUR]], align 4 +// CHECK: tail call void @foo(i32 [[FIVE]]) + +@implementation SampleClass ++ (SampleClass*) new { return 0; } +- (void) SampleClassApplication +{ + // Create set of objects in loop + for(int i = 0; i < 2; i++) { + SampleClass *sample = [SampleClass new]; + foo (sample->_value); + } +} +@end +// CHECK: [[ZERO:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8, !invariant.load +// CHECK: [[IVAR:%.*]] = load i64* @"OBJC_IVAR_$_SampleClass._value", align 8, !invariant.load + +@interface Sample : SampleClass @end + +@implementation Sample +- (void) SampleApplication +{ + // Create set of objects in loop + for(int i = 0; i < 2; i++) { + SampleClass *sample = [SampleClass new]; + foo (sample->_value); + } +} +@end +// CHECK: [[ZERO:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES_", align 8, !invariant.load +// CHECK: [[IVAR:%.*]] = load i64* @"OBJC_IVAR_$_SampleClass._value", align 8, !invariant.load + diff --git a/test/CodeGenObjC/overloadable.m b/test/CodeGenObjC/overloadable.m index 4fd1429f2827..0d55cd3f3a26 100644 --- a/test/CodeGenObjC/overloadable.m +++ b/test/CodeGenObjC/overloadable.m @@ -1,10 +1,12 @@ // rdar://6657613 -// RUN: %clang_cc1 -emit-llvm %s -o %t +// RUN: %clang_cc1 -triple %itanium_abi_triple -emit-llvm %s -o - | FileCheck %s @class C; -// RUN: grep _Z1fP11objc_object %t | count 1 +// CHECK: _Z1fP11objc_object +// CHECK-NOT: _Z1fP11objc_object void __attribute__((overloadable)) f(id c) { } -// RUN: grep _Z1fP1C %t | count 1 +// CHECK: _Z1fP1C +// CHECK-NOT: _Z1fP1C void __attribute__((overloadable)) f(C *c) { } diff --git a/test/CodeGenObjC/property-array-type.m b/test/CodeGenObjC/property-array-type.m new file mode 100644 index 000000000000..6600fd0f5965 --- /dev/null +++ b/test/CodeGenObjC/property-array-type.m @@ -0,0 +1,30 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// rdar://15610943 + +struct _GLKMatrix4 +{ + float m[16]; +}; +typedef struct _GLKMatrix4 GLKMatrix4; + +@interface NSObject @end + +@interface MyProgram +- (void)setTransform:(float[16])transform; +@end + +@interface ViewController +@property (nonatomic, assign) GLKMatrix4 transform; +@end + +@implementation ViewController +- (void)viewDidLoad { + MyProgram *program; + program.transform = self.transform.m; +} +@end + +// CHECK: [[M:%.*]] = getelementptr inbounds %struct._GLKMatrix4* [[TMP:%.*]], i32 0, i32 0 +// CHECK: [[ARRAYDECAY:%.*]] = getelementptr inbounds [16 x float]* [[M]], i32 0, i32 0 +// CHECK: [[SIX:%.*]] = load i8** @"\01L_OBJC_SELECTOR_REFERENCES +// CHECK: call void bitcast (i8* (i8*, i8*, ...)* @objc_msgSend to void (i8*, i8*, float*)*)(i8* [[SEVEN:%.*]], i8* [[SIX]], float* [[ARRAYDECAY]]) diff --git a/test/CodeGenObjC/property-category-impl.m b/test/CodeGenObjC/property-category-impl.m index 734f9a37a24c..765f1ada3019 100644 --- a/test/CodeGenObjC/property-category-impl.m +++ b/test/CodeGenObjC/property-category-impl.m @@ -15,6 +15,6 @@ @end -// CHECK: l_OBJC_$_PROP_LIST_Foo_$_Category" = internal global -// CHECK: l_OBJC_$_CATEGORY_Foo_$_Category" = internal global +// CHECK: l_OBJC_$_PROP_LIST_Foo_$_Category" = private global +// CHECK: l_OBJC_$_CATEGORY_Foo_$_Category" = private global // CHECK: l_OBJC_$_PROP_LIST_Foo_$_Category diff --git a/test/CodeGenObjC/property-dbg.m b/test/CodeGenObjC/property-dbg.m index 42ab6110541d..e0cac9850f25 100644 --- a/test/CodeGenObjC/property-dbg.m +++ b/test/CodeGenObjC/property-dbg.m @@ -1,4 +1,5 @@ -// RUN: %clang_cc1 -S -g -masm-verbose -x objective-c < %s | grep DW_AT_name +// FIXME: Check IR rather than asm, then triple is not needed. +// RUN: %clang_cc1 -triple %itanium_abi_triple -S -g -masm-verbose -x objective-c < %s | grep DW_AT_name @interface Foo { int i; } diff --git a/test/CodeGenObjC/property-list-in-class.m b/test/CodeGenObjC/property-list-in-class.m index e8014855af7e..2f92ca78b976 100644 --- a/test/CodeGenObjC/property-list-in-class.m +++ b/test/CodeGenObjC/property-list-in-class.m @@ -1,5 +1,5 @@ // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm %s -o - | FileCheck %s -// CHECK: l_OBJC_$_PROP_LIST_C2" = internal global { i32, i32, [3 x %struct._prop_t] } { i32 16, i32 3 +// CHECK: l_OBJC_$_PROP_LIST_C2" = private global { i32, i32, [3 x %struct._prop_t] } { i32 16, i32 3 @protocol P @property int i; diff --git a/test/CodeGenObjC/property-section-attribute.m b/test/CodeGenObjC/property-section-attribute.m new file mode 100644 index 000000000000..5ba064c6126f --- /dev/null +++ b/test/CodeGenObjC/property-section-attribute.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// rdar://15450637. + +@interface NSObject @end + +@interface Foo : NSObject +@property int p __attribute__((section("__TEXT,foo"))); +@end + +@implementation Foo @end + +// CHECK: define internal i32 @"\01-[Foo p]"({{.*}} section "__TEXT,foo" { +// CHECK: define internal void @"\01-[Foo setP:]"({{.*}} section "__TEXT,foo" { diff --git a/test/CodeGenObjC/protocol-in-extended-class.m b/test/CodeGenObjC/protocol-in-extended-class.m index a5fb80eca4b9..49b290133afa 100644 --- a/test/CodeGenObjC/protocol-in-extended-class.m +++ b/test/CodeGenObjC/protocol-in-extended-class.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-registered-target,x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -S %s -o %t-64.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 diff --git a/test/CodeGenObjC/reorder-synthesized-ivars.m b/test/CodeGenObjC/reorder-synthesized-ivars.m index 0f8cf6a3ea87..8faafff2cdac 100644 --- a/test/CodeGenObjC/reorder-synthesized-ivars.m +++ b/test/CodeGenObjC/reorder-synthesized-ivars.m @@ -38,21 +38,21 @@ typedef signed char BOOL; } @end -// CHECK: @"{{.*}}" = internal global [10 x i8] c"_boolean1 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean2 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean3 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean4 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean5 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean6 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean7 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean8 -// CHECK-NEXT: @"{{.*}}" = internal global [10 x i8] c"_boolean9 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object1 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object2 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object3 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object4 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object5 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object6 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object7 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object8 -// CHECK-NEXT: @"{{.*}}" = internal global [9 x i8] c"_object9 +// CHECK: @"{{.*}}" = private global [10 x i8] c"_boolean1 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean2 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean3 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean4 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean5 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean6 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean7 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean8 +// CHECK-NEXT: @"{{.*}}" = private global [10 x i8] c"_boolean9 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object1 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object2 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object3 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object4 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object5 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object6 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object7 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object8 +// CHECK-NEXT: @"{{.*}}" = private global [9 x i8] c"_object9 diff --git a/test/CodeGenObjC/return-objc-object.mm b/test/CodeGenObjC/return-objc-object.mm index 95cce23a8682..d756c4b78dba 100644 --- a/test/CodeGenObjC/return-objc-object.mm +++ b/test/CodeGenObjC/return-objc-object.mm @@ -15,5 +15,5 @@ void call_once() { f(); f1(); } -// CHECK: call %0* @_Z1fv() -// CHECK: call %0* @_Z2f1v() +// CHECK: call dereferenceable({{[0-9]+}}) %0* @_Z1fv() +// CHECK: call dereferenceable({{[0-9]+}}) %0* @_Z2f1v() diff --git a/test/CodeGenObjC/stret-1.m b/test/CodeGenObjC/stret-1.m new file mode 100644 index 000000000000..f45d1219da65 --- /dev/null +++ b/test/CodeGenObjC/stret-1.m @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -fblocks -triple arm64-apple-darwin %s -emit-llvm -o - | FileCheck %s -check-prefix=CHECK-ARM64 +// rdar://12416433 + +struct stret { int x[100]; }; +struct stret zero; +struct stret one = {{1}}; + +@interface Test @end + +@implementation Test ++(struct stret) method { return one; } +@end + +int main(int argc, const char **argv) +{ + struct stret st2 = one; + if (argc) st2 = [(id)(argc&~255) method]; +} + +// CHECK-ARM64: call void @llvm.memset.p0i8.i64(i8* [[T0:%.*]], i8 0, i64 400, i32 4, i1 false) diff --git a/test/CodeGenObjC/stret.m b/test/CodeGenObjC/stret.m new file mode 100644 index 000000000000..beb6f302989e --- /dev/null +++ b/test/CodeGenObjC/stret.m @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -fblocks -triple x86_64-apple-darwin9 %s -emit-llvm -o - | FileCheck %s -check-prefix=X86 +// RUN: %clang_cc1 -fblocks -triple arm-apple-darwin %s -emit-llvm -o - | FileCheck %s -check-prefix=ARM +// RUN: %clang_cc1 -fblocks -triple arm64-apple-darwin %s -emit-llvm -o - | FileCheck %s -check-prefix=ARM64 + +// <rdar://problem/9757015>: Don't use 'stret' variants on ARM64. + +// X86: @main +// X86: @objc_msgSend_stret + +// ARM: @main +// ARM: @objc_msgSend_stret + +// ARM64: @main +// ARM64-NOT: @objc_msgSend_stret + +struct st { int i[1000]; }; +@interface Test ++(struct st)method; +@end +int main() { + [Test method]; +} diff --git a/test/CodeGenObjC/try.m b/test/CodeGenObjC/try.m index 56b8e646d983..4168cb2209f2 100644 --- a/test/CodeGenObjC/try.m +++ b/test/CodeGenObjC/try.m @@ -1,4 +1,4 @@ -// REQUIRES: x86-registered-target,x86-64-registered-target +// REQUIRES: x86-registered-target // RUN: %clang_cc1 %s -fobjc-exceptions -S -o - -triple=i686-apple-darwin9 // RUN: %clang_cc1 %s -fobjc-exceptions -S -o - -triple=x86_64-apple-darwin9 diff --git a/test/CodeGenObjC/weak-metaclass-visibility.m b/test/CodeGenObjC/weak-metaclass-visibility.m new file mode 100644 index 000000000000..d174bdb08ef0 --- /dev/null +++ b/test/CodeGenObjC/weak-metaclass-visibility.m @@ -0,0 +1,60 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple armv7-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple arm64-apple-ios -emit-llvm -o - %s | FileCheck %s +// rdar://16206443 + +@interface NSObject +- (void) finalize; ++ (void) class; +@end + +__attribute__((availability(macosx,introduced=9876.5))) +@interface MyClass : NSObject ++ (void)someClassMethod; +- (void)someInstanceMethod; +@end + +@implementation MyClass ++ (void)someClassMethod { +} + +- (void)someInstanceMethod { + [MyClass someClassMethod]; + [super finalize]; +} +@end + +void kit() +{ + MyClass *wrapper = [MyClass alloc]; +} + +// CHECK: @"OBJC_CLASS_$_MyClass" = global %struct._class_t +// CHECK: @"OBJC_METACLASS_$_NSObject" = external global %struct._class_t +// CHECK: @"OBJC_METACLASS_$_MyClass" = global %struct._class_t +// CHECK: @"OBJC_CLASS_$_NSObject" = external global %struct._class_t + +// rdar://16529125 +__attribute__((weak_import)) +@interface NSURLQueryItem : NSObject +@end + +@implementation NSURLQueryItem (hax) ++(void)classmethod { [super class]; } +@end + +// CHECK: @"OBJC_METACLASS_$_NSURLQueryItem" = extern_weak global +// CHECK: @"OBJC_CLASS_$_NSURLQueryItem" = extern_weak global + +// rdar://17633301 +__attribute__((visibility("default"))) __attribute__((availability(ios,introduced=9876.5))) +@interface AVScheduledAudioParameters @end + +@interface XXXX : AVScheduledAudioParameters +@end + +@implementation AVScheduledAudioParameters @end +@implementation XXXX @end + +// CHECK: @"OBJC_CLASS_$_AVScheduledAudioParameters" = global %struct._class_t +// CHECK: @"OBJC_METACLASS_$_AVScheduledAudioParameters" = global %struct._class_t |