diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:08 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:18:08 +0000 |
commit | bab175ec4b075c8076ba14c762900392533f6ee4 (patch) | |
tree | 01f4f29419a2cb10abe13c1e63cd2a66068b0137 /test/CodeGenObjC | |
parent | 8b7a8012d223fac5d17d16a66bb39168a9a1dfc0 (diff) | |
download | src-vendor/clang/clang-trunk-r290819.tar.gz src-vendor/clang/clang-trunk-r290819.zip |
Vendor import of clang trunk r290819:vendor/clang/clang-trunk-r290819
Diffstat (limited to 'test/CodeGenObjC')
44 files changed, 351 insertions, 113 deletions
diff --git a/test/CodeGenObjC/2010-02-01-utf16-with-null.m b/test/CodeGenObjC/2010-02-01-utf16-with-null.m index 7c103f2ba6d4..097a3ea2b403 100644 --- a/test/CodeGenObjC/2010-02-01-utf16-with-null.m +++ b/test/CodeGenObjC/2010-02-01-utf16-with-null.m @@ -2,6 +2,6 @@ // rdar://7589850 // 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_tag { i32* getelementptr inbounds ([0 x i32], [0 x i32]* @__CFConstantStringClassReference, i32 0, i32 0), i32 2000, i8* bitcast ([9 x i16]* @.str to i8*), i32 8 }, section "__DATA,__cfstring" +// CHECK: @_unnamed_cfstring_ = private global %struct.__NSConstantString_tag { i32* getelementptr inbounds ([0 x i32], [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_tag* @_unnamed_cfstring_ to i8*), align 4 void *P = @"good\0bye"; diff --git a/test/CodeGenObjC/arc-blocks.m b/test/CodeGenObjC/arc-blocks.m index 30f9271bd9dc..f67136b7b226 100644 --- a/test/CodeGenObjC/arc-blocks.m +++ b/test/CodeGenObjC/arc-blocks.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-passes -o - %s | FileCheck %s // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-UNOPT %s // This shouldn't crash. diff --git a/test/CodeGenObjC/arc-bridged-cast.m b/test/CodeGenObjC/arc-bridged-cast.m index f48985303132..97a45c5a2f10 100644 --- a/test/CodeGenObjC/arc-bridged-cast.m +++ b/test/CodeGenObjC/arc-bridged-cast.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s typedef const void *CFTypeRef; typedef const struct __CFString *CFStringRef; diff --git a/test/CodeGenObjC/arc-linetable-autorelease.m b/test/CodeGenObjC/arc-linetable-autorelease.m index 6812e8a6de83..26a779b8d6db 100644 --- a/test/CodeGenObjC/arc-linetable-autorelease.m +++ b/test/CodeGenObjC/arc-linetable-autorelease.m @@ -30,10 +30,11 @@ NSRect NSMakeRect(CGFloat x, CGFloat y, CGFloat w, CGFloat h); // CHECK: define {{.*}}_createBezierPathWithWidth // CHECK: load {{.*}} %path, align {{.*}}, !dbg ![[RET:[0-9]+]] // CHECK: call void @objc_storeStrong{{.*}} !dbg ![[ARC:[0-9]+]] - // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC]] + // CHECK: call {{.*}} @objc_autoreleaseReturnValue{{.*}} !dbg ![[ARC1:[0-9]+]] // CHECK: ret {{.*}} !dbg ![[ARC]] // CHECK: ![[RET]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) return path; - // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) + // CHECK: ![[ARC]] = !DILocation(line: [[@LINE+2]], scope: !{{.*}}) + // CHECK: ![[ARC1]] = !DILocation(line: [[@LINE+1]], scope: !{{.*}}) } @end diff --git a/test/CodeGenObjC/arc-literals.m b/test/CodeGenObjC/arc-literals.m index ab6c82b743fc..74e231c765bf 100644 --- a/test/CodeGenObjC/arc-literals.m +++ b/test/CodeGenObjC/arc-literals.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-passes -o - %s | FileCheck %s #include "literal-support.h" diff --git a/test/CodeGenObjC/arc-no-arc-exceptions.m b/test/CodeGenObjC/arc-no-arc-exceptions.m index f147b64c4841..3338ad8477bc 100644 --- a/test/CodeGenObjC/arc-no-arc-exceptions.m +++ b/test/CodeGenObjC/arc-no-arc-exceptions.m @@ -1,6 +1,6 @@ -// 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 -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 +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -O2 -disable-llvm-passes -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-arc -fblocks -fexceptions -fobjc-exceptions -disable-llvm-passes -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-passes -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 // mode when optimization is enabled, and not otherwise. diff --git a/test/CodeGenObjC/arc-precise-lifetime.m b/test/CodeGenObjC/arc-precise-lifetime.m index 42a048307948..eb3111c68a5a 100644 --- a/test/CodeGenObjC/arc-precise-lifetime.m +++ b/test/CodeGenObjC/arc-precise-lifetime.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-passes -o - %s | FileCheck %s #define PRECISE_LIFETIME __attribute__((objc_precise_lifetime)) diff --git a/test/CodeGenObjC/arc-ternary-op.m b/test/CodeGenObjC/arc-ternary-op.m index c6bbab28a2e8..883fcd366622 100644 --- a/test/CodeGenObjC/arc-ternary-op.m +++ b/test/CodeGenObjC/arc-ternary-op.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-passes -o - %s | FileCheck %s void test0(_Bool cond) { id test0_helper(void) __attribute__((ns_returns_retained)); diff --git a/test/CodeGenObjC/arc-unsafeclaim.m b/test/CodeGenObjC/arc-unsafeclaim.m index cda00b0a2f5e..01329df0f791 100644 --- a/test/CodeGenObjC/arc-unsafeclaim.m +++ b/test/CodeGenObjC/arc-unsafeclaim.m @@ -1,13 +1,16 @@ // Make sure it works on x86-64. // RUN: %clang_cc1 -triple x86_64-apple-darwin11 -fobjc-runtime=macosx-10.11 -fobjc-arc -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-UNOPTIMIZED +// Make sure it works on x86-32. +// RUN: %clang_cc1 -triple i386-apple-darwin11 -fobjc-runtime=macosx-fragile-10.11 -fobjc-arc -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-UNOPTIMIZED -check-prefix=CHECK-MARKED + // Make sure it works on ARM. // RUN: %clang_cc1 -triple arm64-apple-ios9 -fobjc-runtime=ios-9.0 -fobjc-arc -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-UNOPTIMIZED -check-prefix=CHECK-MARKED -// RUN: %clang_cc1 -triple arm64-apple-ios9 -fobjc-runtime=ios-9.0 -fobjc-arc -O -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-OPTIMIZED +// RUN: %clang_cc1 -triple arm64-apple-ios9 -fobjc-runtime=ios-9.0 -fobjc-arc -O -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-OPTIMIZED // Make sure it works on ARM64. // RUN: %clang_cc1 -triple armv7-apple-ios9 -fobjc-runtime=ios-9.0 -fobjc-arc -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-UNOPTIMIZED -check-prefix=CHECK-MARKED -// RUN: %clang_cc1 -triple armv7-apple-ios9 -fobjc-runtime=ios-9.0 -fobjc-arc -O -disable-llvm-optzns -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-OPTIMIZED +// RUN: %clang_cc1 -triple armv7-apple-ios9 -fobjc-runtime=ios-9.0 -fobjc-arc -O -disable-llvm-passes -emit-llvm -o - %s | FileCheck %s -check-prefix=CHECK -check-prefix=CHECK-OPTIMIZED // Make sure that it's implicitly disabled if the runtime version isn't high enough. // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-runtime=macosx-10.10 -fobjc-arc -emit-llvm -o - %s | FileCheck %s -check-prefix=DISABLED diff --git a/test/CodeGenObjC/arc.m b/test/CodeGenObjC/arc.m index f756df1460f3..87cf667b4e5e 100644 --- a/test/CodeGenObjC/arc.m +++ b/test/CodeGenObjC/arc.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -O2 -disable-llvm-passes -o - %s | FileCheck %s // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fblocks -fobjc-arc -fobjc-runtime-has-weak -o - %s | FileCheck -check-prefix=CHECK-GLOBALS %s // rdar://13129783. Check both native/non-native arc platforms. Here we check diff --git a/test/CodeGenObjC/block-byref-debuginfo.m b/test/CodeGenObjC/block-byref-debuginfo.m index f11566634294..3ddb376dde65 100644 --- a/test/CodeGenObjC/block-byref-debuginfo.m +++ b/test/CodeGenObjC/block-byref-debuginfo.m @@ -5,7 +5,6 @@ // expression (256) that locates it inside of the byref descriptor: // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo", // CHECK-NOT: line: -// CHECK-SAME: align: 64 // CHECK-SAME: offset: 256 struct Foo { diff --git a/test/CodeGenObjC/boxing.m b/test/CodeGenObjC/boxing.m index f205764a0f21..42dd33337f1e 100644 --- a/test/CodeGenObjC/boxing.m +++ b/test/CodeGenObjC/boxing.m @@ -53,17 +53,17 @@ typedef signed char BOOL; + (id)stringWithUTF8String:(const char *)nullTerminatedCString; @end -// CHECK: [[WithIntMeth:@.*]] = private global [15 x i8] c"numberWithInt:\00" +// CHECK: [[WithIntMeth:@.*]] = private unnamed_addr constant [15 x i8] c"numberWithInt:\00" // CHECK: [[WithIntSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([15 x i8], [15 x i8]* [[WithIntMeth]] -// CHECK: [[WithCharMeth:@.*]] = private global [16 x i8] c"numberWithChar:\00" +// CHECK: [[WithCharMeth:@.*]] = private unnamed_addr constant [16 x i8] c"numberWithChar:\00" // CHECK: [[WithCharSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithCharMeth]] -// CHECK: [[WithBoolMeth:@.*]] = private global [16 x i8] c"numberWithBool:\00" +// CHECK: [[WithBoolMeth:@.*]] = private unnamed_addr constant [16 x i8] c"numberWithBool:\00" // CHECK: [[WithBoolSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([16 x i8], [16 x i8]* [[WithBoolMeth]] -// CHECK: [[WithIntegerMeth:@.*]] = private global [19 x i8] c"numberWithInteger:\00" +// CHECK: [[WithIntegerMeth:@.*]] = private unnamed_addr constant [19 x i8] c"numberWithInteger:\00" // CHECK: [[WithIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([19 x i8], [19 x i8]* [[WithIntegerMeth]] -// CHECK: [[WithUnsignedIntegerMeth:@.*]] = private global [27 x i8] c"numberWithUnsignedInteger:\00" +// CHECK: [[WithUnsignedIntegerMeth:@.*]] = private unnamed_addr constant [27 x i8] c"numberWithUnsignedInteger:\00" // CHECK: [[WithUnsignedIntegerSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([27 x i8], [27 x i8]* [[WithUnsignedIntegerMeth]] -// CHECK: [[stringWithUTF8StringMeth:@.*]] = private global [22 x i8] c"stringWithUTF8String:\00" +// CHECK: [[stringWithUTF8StringMeth:@.*]] = private unnamed_addr constant [22 x i8] c"stringWithUTF8String:\00" // CHECK: [[stringWithUTF8StringSEL:@.*]] = private externally_initialized global i8* getelementptr inbounds ([22 x i8], [22 x i8]* [[stringWithUTF8StringMeth]] int main() { diff --git a/test/CodeGenObjC/complex-property.m b/test/CodeGenObjC/complex-property.m index bed0ca661155..a5572958a643 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: private global [13 x i8] c"COMPLEX_PROP -// CHECK-LP64: private global [17 x i8] c"setCOMPLEX_PROP +// CHECK-LP64: private unnamed_addr constant [13 x i8] c"COMPLEX_PROP +// CHECK-LP64: private unnamed_addr constant [17 x i8] c"setCOMPLEX_PROP // rdar: // 7351147 @interface B diff --git a/test/CodeGenObjC/debug-info-block-type.m b/test/CodeGenObjC/debug-info-block-type.m index 565bc86e8b8a..4bdd18035ee0 100644 --- a/test/CodeGenObjC/debug-info-block-type.m +++ b/test/CodeGenObjC/debug-info-block-type.m @@ -17,6 +17,6 @@ int main() SomeKindOfPredicate p = ^BOOL(id obj) { return obj != nil; }; // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "__FuncPtr", // CHECK-SAME: line: [[@LINE-2]] - // CHECK-SAME: size: 64, align: 64, offset: 128, + // CHECK-SAME: size: 64, offset: 128, return p(nil); } diff --git a/test/CodeGenObjC/debug-info-ivars-extension.m b/test/CodeGenObjC/debug-info-ivars-extension.m index 0709d2ad24d3..2091b56b9a35 100644 --- a/test/CodeGenObjC/debug-info-ivars-extension.m +++ b/test/CodeGenObjC/debug-info-ivars-extension.m @@ -30,7 +30,7 @@ void gorf (I* pg) { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "a" // CHECK-SAME: line: 7 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagPublic // CHECK: ![[INT]] = !DIBasicType(name: "int" @@ -42,6 +42,6 @@ void gorf (I* pg) { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "b" // CHECK-SAME: line: 18 // CHECK-SAME: baseType: ![[INT]] -// CHECK-SAME: size: 32, align: 32 +// CHECK-SAME: size: 32 // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagPublic diff --git a/test/CodeGenObjC/debug-info-ivars-private.m b/test/CodeGenObjC/debug-info-ivars-private.m index f533ef3adc20..583868e1b1c0 100644 --- a/test/CodeGenObjC/debug-info-ivars-private.m +++ b/test/CodeGenObjC/debug-info-ivars-private.m @@ -35,13 +35,13 @@ __attribute((objc_root_class)) @interface NSObject { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "foo" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "bar" // CHECK-SAME: line: 27 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagPrivate diff --git a/test/CodeGenObjC/debug-info-ivars.m b/test/CodeGenObjC/debug-info-ivars.m index c6e544ae1c1c..996562dae25f 100644 --- a/test/CodeGenObjC/debug-info-ivars.m +++ b/test/CodeGenObjC/debug-info-ivars.m @@ -21,24 +21,24 @@ __attribute((objc_root_class)) @interface NSObject { // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "i" // CHECK-SAME: line: 10 // CHECK-SAME: baseType: ![[INT:[0-9]+]] -// CHECK-SAME: size: 32, align: 32, +// CHECK-SAME: size: 32, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[INT]] = !DIBasicType(name: "int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_1" // CHECK-SAME: line: 11 // CHECK-SAME: baseType: ![[UNSIGNED:[0-9]+]] -// CHECK-SAME: size: 9, align: 32, +// CHECK-SAME: size: 9, // CHECK-NOT: offset: // CHECK-SAME: flags: DIFlagProtected // CHECK: ![[UNSIGNED]] = !DIBasicType(name: "unsigned int" // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_2" // CHECK-SAME: line: 12 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 1, +// CHECK-SAME: size: 9, offset: 1, // CHECK-SAME: flags: DIFlagProtected // CHECK: !DIDerivedType(tag: DW_TAG_member, name: "flag_3" // CHECK-SAME: line: 14 // CHECK-SAME: baseType: ![[UNSIGNED]] -// CHECK-SAME: size: 9, align: 32, offset: 3, +// CHECK-SAME: size: 9, offset: 3, // CHECK-SAME: flags: DIFlagProtected diff --git a/test/CodeGenObjC/encode-cstyle-method.m b/test/CodeGenObjC/encode-cstyle-method.m index d0a99215b9a5..cb1e6773fd56 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: private global [11 x i8] c"@24@0:8@16 +// CHECK-LP64: private unnamed_addr constant [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 02895e74d266..bbd29cbdc943 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: private global [14 x i8] c"v16@0:8{?=}16 -// CHECK: private global [26 x i8] c"v32@0:8{?=}16*16{?=}24d24 +// CHECK: private unnamed_addr constant [14 x i8] c"v16@0:8{?=}16 +// CHECK: private unnamed_addr constant [26 x i8] c"v32@0:8{?=}16*16{?=}24d24 // rdar://13190095 @@ -34,7 +34,7 @@ typedef BABugExample BABugExampleRedefinition; @synthesize property = _property; @end -// CHECK: private global [24 x i8] c"^{BABugExample=@}16 +// CHECK: private unnamed_addr constant [24 x i8] c"^{BABugExample=@}16 // rdar://14408244 @class SCNCamera; @@ -52,7 +52,7 @@ typedef struct C3DCameraStorage _storage; } @end -// CHECK: private global [39 x i8] c"{?=\22presentationInstance\22^{SCNCamera}}\00" +// CHECK: private unnamed_addr constant [39 x i8] c"{?=\22presentationInstance\22^{SCNCamera}}\00" // rdar://16655340 int i; diff --git a/test/CodeGenObjC/encode-test.m b/test/CodeGenObjC/encode-test.m index 710e65be62da..7f0e76fc3ffd 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: @OBJC_METH_VAR_TYPE_.34 = private global [16 x i8] c"v12@0:4[3[4@]]8\00" +// CHECK: @OBJC_METH_VAR_TYPE_{{.*}} = private unnamed_addr constant [16 x i8] c"v12@0:4[3[4@]]8\00" @class Int1; diff --git a/test/CodeGenObjC/exceptions.m b/test/CodeGenObjC/exceptions.m index 56c9a0e907be..28515c54f32f 100644 --- a/test/CodeGenObjC/exceptions.m +++ b/test/CodeGenObjC/exceptions.m @@ -83,7 +83,7 @@ void f3() { // CHECK: [[X:%.*]] = alloca i32 // CHECK: [[XPTR:%.*]] = bitcast i32* [[X]] to i8* - // CHECK: call void @llvm.lifetime.start(i64 4, i8* [[XPTR]]) + // CHECK: call void @llvm.lifetime.start(i64 4, i8* nonnull [[XPTR]]) // CHECK: store i32 0, i32* [[X]] int x = 0; diff --git a/test/CodeGenObjC/fragile-arc.m b/test/CodeGenObjC/fragile-arc.m index ecb955bd34ac..2bf813d4615b 100644 --- a/test/CodeGenObjC/fragile-arc.m +++ b/test/CodeGenObjC/fragile-arc.m @@ -16,9 +16,9 @@ // GLOBALS-LABEL @OBJC_METACLASS_A // Strong layout: scan the first word. -// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private global [2 x i8] c"\01\00" +// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant [2 x i8] c"\01\00" // Weak layout: skip the first word, scan the second word. -// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private global [2 x i8] c"\11\00" +// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant [2 x i8] c"\11\00" // 0x04002001 // ^ is compiled by ARC (controls interpretation of layouts) @@ -119,9 +119,9 @@ // GLOBALS-LABEL: @OBJC_METACLASS_C // Strong layout: skip five, scan four, skip three, scan seven // 'T' == 0x54, '7' == 0x37 -// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private global [3 x i8] c"T7\00" +// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant [3 x i8] c"T7\00" // Weak layout: skip nine, scan three -// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private global [2 x i8] c"\93\00" +// GLOBALS: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant [2 x i8] c"\93\00" extern void useBlock(void (^block)(void)); diff --git a/test/CodeGenObjC/gnu-exceptions.m b/test/CodeGenObjC/gnu-exceptions.m index 76e9e1ded3c4..2407f8fc6c50 100644 --- a/test/CodeGenObjC/gnu-exceptions.m +++ b/test/CodeGenObjC/gnu-exceptions.m @@ -32,4 +32,4 @@ void test0() { log(1); } -// CHECK: attributes [[TF]] = { "{{.*}} } +// CHECK: attributes [[TF]] = { noinline "{{.*}} } diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m index 0866704ecf92..d3ffdfe444c8 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: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"C\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\11p\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"!`\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"C\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\11p\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!`\00" @implementation C @@ -48,9 +48,9 @@ __weak B *f2; @property (assign) __weak id p2; @end -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"A\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\11q\10\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"!q\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"A\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\11q\10\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!q\00" @implementation A @synthesize p0 = _p0; @@ -62,9 +62,9 @@ __weak B *f2; @property int p3; @end -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"D\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\11p\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"!`\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"D\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\11p\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!`\00" @implementation D @synthesize p3 = _p3; @@ -89,8 +89,8 @@ typedef unsigned int FSCatalogInfoBitmap; } @end -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"NSFileLocationComponent\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\01\14\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"NSFileLocationComponent\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\01\14\00" @implementation NSFileLocationComponent @end @@ -108,8 +108,8 @@ typedef unsigned int FSCatalogInfoBitmap; } @end -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"Foo\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\02\10\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"Foo\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\02\10\00" @implementation Foo @end @@ -124,8 +124,8 @@ struct __attribute__((packed)) PackedStruct { } @end @implementation Packed @end -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"Packed\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\01 \00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"Packed\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\01 \00" // ' ' == 0x20 // Ensure that layout descends into anonymous unions and structs. @@ -142,8 +142,8 @@ struct __attribute__((packed)) PackedStruct { } @end @implementation AnonymousUnion @end -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"AnonymousUnion\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\02\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"AnonymousUnion\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\02\00" @interface AnonymousStruct : NSObject { struct { @@ -155,7 +155,7 @@ struct __attribute__((packed)) PackedStruct { } @end @implementation AnonymousStruct @end -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"AnonymousStruct\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\02\10\00" -// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"!\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"AnonymousStruct\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\02\10\00" +// CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!\00" // '!' == 0x21 diff --git a/test/CodeGenObjC/mangle-blocks.m b/test/CodeGenObjC/mangle-blocks.m index 3d6e56a1501d..4cc320403322 100644 --- a/test/CodeGenObjC/mangle-blocks.m +++ b/test/CodeGenObjC/mangle-blocks.m @@ -17,13 +17,12 @@ void __assert_rtn(const char *, const char *, int, const char *); } @end -// CHECK: @"__func__.__14-[Test mangle]_block_invoke_2" = private unnamed_addr constant [34 x i8] c"__14-[Test mangle]_block_invoke_2\00", align 1 +// CHECK: @"__func__.__14-[Test mangle]_block_invoke_2" = private unnamed_addr constant [30 x i8] c"-[Test mangle]_block_invoke_2\00", align 1 // CHECK: @.str = private unnamed_addr constant {{.*}}, align 1 // CHECK: @.str.1 = private unnamed_addr constant [7 x i8] c"mangle\00", align 1 // CHECK: define internal void @"__14-[Test mangle]_block_invoke"(i8* %.block_descriptor) // CHECK: define internal void @"__14-[Test mangle]_block_invoke_2"(i8* %.block_descriptor){{.*}}{ -// CHECK: call void @__assert_rtn(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @"__func__.__14-[Test mangle]_block_invoke_2", i32 0, i32 0), i8* getelementptr inbounds {{.*}}, i32 14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0)) +// CHECK: call void @__assert_rtn(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @"__func__.__14-[Test mangle]_block_invoke_2", i32 0, i32 0), i8* getelementptr inbounds {{.*}}, i32 14, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i32 0, i32 0)) // CHECK: } - diff --git a/test/CodeGenObjC/metadata-symbols-32.m b/test/CodeGenObjC/metadata-symbols-32.m index c75f6411e874..ac5a6384a466 100644 --- a/test/CodeGenObjC/metadata-symbols-32.m +++ b/test/CodeGenObjC/metadata-symbols-32.m @@ -2,11 +2,10 @@ // CHECK: .lazy_reference .objc_class_name_J0 -// CHECK: @OBJC_METH_VAR_NAME_{{[0-9]*}} = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 -// CHECK: @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: @OBJC_CLASS_NAME_{{[0-9]*}} = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @OBJC_METH_VAR_TYPE_{{.*}} = private unnamed_addr constant {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @"\01l_OBJC_PROTOCOLEXT_P" = private global {{.*}}}, align +// CHECK: @OBJC_CLASS_NAME_{{[0-9]*}} = private unnamed_addr constant {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @OBJC_METH_VAR_NAME_{{.*}} = private unnamed_addr constant {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 // CHECK: @OBJC_PROTOCOL_INSTANCE_METHODS_P = private global {{.*}}section "__OBJC,__cat_inst_meth,regular,no_dead_strip", align 4 // CHECK: @OBJC_PROTOCOL_CLASS_METHODS_P = private global {{.*}}section "__OBJC,__cat_cls_meth,regular,no_dead_strip", align 4 // CHECK: @OBJC_PROTOCOL_P = private global {{.*}}section "__OBJC,__protocol,regular,no_dead_strip", align 4 @@ -15,7 +14,7 @@ // CHECK: @OBJC_METACLASS_A = private global {{.*}}section "__OBJC,__meta_class,regular,no_dead_strip", align 4 // CHECK: @OBJC_INSTANCE_VARIABLES_A = private global {{.*}}section "__OBJC,__instance_vars,regular,no_dead_strip", align 4 // CHECK: @OBJC_INSTANCE_METHODS_A = private global {{.*}}section "__OBJC,__inst_meth,regular,no_dead_strip", align 4 -// CHECK: @OBJC_PROP_NAME_ATTR_{{[0-9]*}} = private global {{.*}}section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @OBJC_PROP_NAME_ATTR_{{[0-9]*}} = private unnamed_addr constant {{.*}}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: @OBJC_CLASSEXT_A = private global {{.*}}section "__OBJC,__class_ext,regular,no_dead_strip", align 4 // CHECK: @OBJC_CLASS_A = private global {{.*}}section "__OBJC,__class,regular,no_dead_strip", align 4 diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m index 9b7423746388..5139cd8fdedf 100644 --- a/test/CodeGenObjC/metadata-symbols-64.m +++ b/test/CodeGenObjC/metadata-symbols-64.m @@ -5,9 +5,9 @@ // CHECK: @_objc_empty_vtable = external global // CHECK: @"OBJC_CLASS_$_A" = global // CHECK: @"OBJC_METACLASS_$_A" = global {{.*}} section "__DATA, __objc_data", align 8 -// CHECK: @OBJC_CLASS_NAME_{{[0-9]*}} = private global {{.*}} section "__TEXT,__objc_classname,cstring_literals", align 1 -// CHECK: @OBJC_METH_VAR_NAME_{{[0-9]*}} = private global {{.*}} section "__TEXT,__objc_methname,cstring_literals", align 1 -// CHECK: @OBJC_METH_VAR_TYPE_{{[0-9]*}} = private global {{.*}} section "__TEXT,__objc_methtype,cstring_literals", align 1 +// CHECK: @OBJC_CLASS_NAME_{{[0-9]*}} = private unnamed_addr constant {{.*}} section "__TEXT,__objc_classname,cstring_literals", align 1 +// CHECK: @OBJC_METH_VAR_NAME_{{[0-9]*}} = private unnamed_addr constant {{.*}} section "__TEXT,__objc_methname,cstring_literals", align 1 +// CHECK: @OBJC_METH_VAR_TYPE_{{[0-9]*}} = private unnamed_addr constant {{.*}} 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 @@ -17,7 +17,7 @@ // 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: @OBJC_PROP_NAME_ATTR_{{[0-9]*}} = private global {{.*}} section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK: @OBJC_PROP_NAME_ATTR_{{[0-9]*}} = private unnamed_addr constant {{.*}} 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 diff --git a/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m b/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m index 75e04dbd0272..bab6e27bb345 100644 --- a/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m +++ b/test/CodeGenObjC/nsvalue-objc-boxable-ios-arc.m @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" // CHECK: [[CLASS:@.*]] = external global %struct._class_t // CHECK: [[NSVALUE:@.*]] = {{.*}}[[CLASS]]{{.*}} // CHECK: [[RANGE_STR:.*]] = {{.*}}_NSRange=II{{.*}} -// CHECK: [[METH:@.*]] = private global{{.*}}valueWithBytes:objCType:{{.*}} +// CHECK: [[METH:@.*]] = private unnamed_addr constant {{.*}}valueWithBytes:objCType:{{.*}} // CHECK: [[VALUE_SEL:@.*]] = {{.*}}[[METH]]{{.*}} // CHECK: [[POINT_STR:.*]] = {{.*}}CGPoint=dd{{.*}} // CHECK: [[SIZE_STR:.*]] = {{.*}}CGSize=dd{{.*}} diff --git a/test/CodeGenObjC/nsvalue-objc-boxable-ios.m b/test/CodeGenObjC/nsvalue-objc-boxable-ios.m index 3443babdc9d0..dbbe0f40813d 100644 --- a/test/CodeGenObjC/nsvalue-objc-boxable-ios.m +++ b/test/CodeGenObjC/nsvalue-objc-boxable-ios.m @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple armv7-apple-ios8.0.0 -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" // CHECK: [[CLASS:@.*]] = external global %struct._class_t // CHECK: [[NSVALUE:@.*]] = {{.*}}[[CLASS]]{{.*}} // CHECK: [[RANGE_STR:.*]] = {{.*}}_NSRange=II{{.*}} -// CHECK: [[METH:@.*]] = private global{{.*}}valueWithBytes:objCType:{{.*}} +// CHECK: [[METH:@.*]] = private unnamed_addr constant {{.*}}valueWithBytes:objCType:{{.*}} // CHECK: [[VALUE_SEL:@.*]] = {{.*}}[[METH]]{{.*}} // CHECK: [[POINT_STR:.*]] = {{.*}}CGPoint=dd{{.*}} // CHECK: [[SIZE_STR:.*]] = {{.*}}CGSize=dd{{.*}} diff --git a/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m b/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m index 92c91d7d3810..a2b4dfd6d9d2 100644 --- a/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m +++ b/test/CodeGenObjC/nsvalue-objc-boxable-mac-arc.m @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -fobjc-arc -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -fobjc-arc -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" // CHECK: [[CLASS:@.*]] = external global %struct._class_t // CHECK: [[NSVALUE:@.*]] = {{.*}}[[CLASS]]{{.*}} // CHECK: [[RANGE_STR:.*]] = {{.*}}_NSRange=QQ{{.*}} -// CHECK: [[METH:@.*]] = private global{{.*}}valueWithBytes:objCType:{{.*}} +// CHECK: [[METH:@.*]] = private unnamed_addr constant {{.*}}valueWithBytes:objCType:{{.*}} // CHECK: [[VALUE_SEL:@.*]] = {{.*}}[[METH]]{{.*}} // CHECK: [[POINT_STR:.*]] = {{.*}}_NSPoint=dd{{.*}} // CHECK: [[SIZE_STR:.*]] = {{.*}}_NSSize=dd{{.*}} diff --git a/test/CodeGenObjC/nsvalue-objc-boxable-mac.m b/test/CodeGenObjC/nsvalue-objc-boxable-mac.m index da0ae7a57108..6305b6b583fb 100644 --- a/test/CodeGenObjC/nsvalue-objc-boxable-mac.m +++ b/test/CodeGenObjC/nsvalue-objc-boxable-mac.m @@ -1,11 +1,11 @@ -// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -O2 -disable-llvm-optzns -o - %s | FileCheck %s +// RUN: %clang_cc1 -I %S/Inputs -triple x86_64-apple-macosx -emit-llvm -O2 -disable-llvm-passes -o - %s | FileCheck %s #import "nsvalue-boxed-expressions-support.h" // CHECK: [[CLASS:@.*]] = external global %struct._class_t // CHECK: [[NSVALUE:@.*]] = {{.*}}[[CLASS]]{{.*}} // CHECK: [[RANGE_STR:.*]] = {{.*}}_NSRange=QQ{{.*}} -// CHECK: [[METH:@.*]] = private global{{.*}}valueWithBytes:objCType:{{.*}} +// CHECK: [[METH:@.*]] = private unnamed_addr constant {{.*}}valueWithBytes:objCType:{{.*}} // CHECK: [[VALUE_SEL:@.*]] = {{.*}}[[METH]]{{.*}} // CHECK: [[POINT_STR:.*]] = {{.*}}_NSPoint=dd{{.*}} // CHECK: [[SIZE_STR:.*]] = {{.*}}_NSSize=dd{{.*}} diff --git a/test/CodeGenObjC/nullptr-assert.m b/test/CodeGenObjC/nullptr-assert.m new file mode 100644 index 000000000000..06e50db35c4d --- /dev/null +++ b/test/CodeGenObjC/nullptr-assert.m @@ -0,0 +1,22 @@ +// RUN: %clang_cc1 -Wno-objc-root-class -o /dev/null -triple x86_64-- -emit-llvm %s +// REQUIRES: asserts +// Verify there is no assertion. + +@interface A +@end + +extern A *a; + +@interface X +@end + +@implementation X + +-(void)test { + struct S { + A *a; + int b; + }; + struct S s[] = {{a, 0}, {(void *)0, 0}}; +} +@end diff --git a/test/CodeGenObjC/objc-asm-attribute-test.m b/test/CodeGenObjC/objc-asm-attribute-test.m index 7b3a64deb74c..c988eae654e6 100644 --- a/test/CodeGenObjC/objc-asm-attribute-test.m +++ b/test/CodeGenObjC/objc-asm-attribute-test.m @@ -59,9 +59,9 @@ id Test16877359() { // CHECK: @"OBJC_CLASS_$_MySecretNamespace.Message" = global %struct._class_t // CHECK: @"OBJC_METACLASS_$_MySecretNamespace.Message" = global %struct._class_t -// CHECK: private global [42 x i8] c"T@\22MySecretNamespace.Message\22,&,V_msgProp\00" -// CHECK: private global [76 x i8] c"T@\22MySecretNamespace.Message<MySecretNamespace.Protocol3>\22,&,V_msgProtoProp\00" -// CHECK: private global [50 x i8] c"T@\22<MySecretNamespace.Protocol3>\22,&,V_idProtoProp\00" +// CHECK: private unnamed_addr constant [42 x i8] c"T@\22MySecretNamespace.Message\22,&,V_msgProp\00" +// CHECK: private unnamed_addr constant [76 x i8] c"T@\22MySecretNamespace.Message<MySecretNamespace.Protocol3>\22,&,V_msgProtoProp\00" +// CHECK: private unnamed_addr constant [50 x i8] c"T@\22<MySecretNamespace.Protocol3>\22,&,V_idProtoProp\00" // CHECK: @"OBJC_CLASS_$_foo" = external global %struct._class_t // CHECK: define internal i8* @"\01-[Message MyMethod]" diff --git a/test/CodeGenObjC/objc-literal-tests.m b/test/CodeGenObjC/objc-literal-tests.m index 03286e24563e..aa576d4e8a3d 100644 --- a/test/CodeGenObjC/objc-literal-tests.m +++ b/test/CodeGenObjC/objc-literal-tests.m @@ -94,4 +94,4 @@ void baz(void) { bar(^(void) { return YES; }); } -// CHECK: attributes [[NUW]] = { {{(norecurse )?}}nounwind{{.*}} } +// CHECK: attributes [[NUW]] = { noinline {{(norecurse )?}}nounwind{{.*}} } diff --git a/test/CodeGenObjC/os_log.m b/test/CodeGenObjC/os_log.m new file mode 100644 index 000000000000..5d48783de472 --- /dev/null +++ b/test/CodeGenObjC/os_log.m @@ -0,0 +1,39 @@ +// RUN: %clang_cc1 %s -emit-llvm -o - -triple x86_64-darwin-apple -fobjc-arc -O2 | FileCheck %s + +// Make sure we emit clang.arc.use before calling objc_release as part of the +// cleanup. This way we make sure the object will not be released until the +// end of the full expression. + +// rdar://problem/24528966 + +@class NSString; +extern __attribute__((visibility("default"))) NSString *GenString(); + +// Behavior of __builtin_os_log differs between platforms, so only test on X86 +#ifdef __x86_64__ +// CHECK-LABEL: define i8* @test_builtin_os_log +void *test_builtin_os_log(void *buf) { + return __builtin_os_log_format(buf, "capabilities: %@", GenString()); + + // CHECK: store i8 2, i8* + // CHECK: [[NUM_ARGS:%.*]] = getelementptr i8, i8* {{.*}}, i64 1 + // CHECK: store i8 1, i8* [[NUM_ARGS]] + // + // CHECK: [[ARG1_DESC:%.*]] = getelementptr i8, i8* {{.*}}, i64 2 + // CHECK: store i8 64, i8* [[ARG1_DESC]] + // CHECK: [[ARG1_SIZE:%.*]] = getelementptr i8, i8* {{.*}}, i64 3 + // CHECK: store i8 8, i8* [[ARG1_SIZE]] + // CHECK: [[ARG1:%.*]] = getelementptr i8, i8* {{.*}}, i64 4 + // CHECK: [[ARG1_CAST:%.*]] = bitcast i8* [[ARG1]] to + + // CHECK: [[STRING:%.*]] = {{.*}} call {{.*}} @GenString() + // CHECK: [[STRING_CAST:%.*]] = bitcast {{.*}} [[STRING]] to + // CHECK: call {{.*}} @objc_retainAutoreleasedReturnValue(i8* [[STRING_CAST]]) + // CHECK: store {{.*}} [[STRING]], {{.*}} [[ARG1_CAST]] + + // CHECK: call void (...) @clang.arc.use({{.*}} [[STRING]]) + // CHECK: call void @objc_release(i8* [[STRING_CAST]]) + // CHECK: ret i8* +} + +#endif diff --git a/test/CodeGenObjC/property-list-in-extension.m b/test/CodeGenObjC/property-list-in-extension.m index 878745e73e4d..0c930c22820a 100644 --- a/test/CodeGenObjC/property-list-in-extension.m +++ b/test/CodeGenObjC/property-list-in-extension.m @@ -17,7 +17,7 @@ __attribute__((objc_root_class)) @end // Metadata for _myprop should be present, and PROP_LIST for Foo should have // only one entry. -// CHECK: = private global [12 x i8] c"Ti,V_myprop\00", +// CHECK: = private unnamed_addr constant [12 x i8] c"Ti,V_myprop\00", // CHECK: @"\01l_OBJC_$_PROP_LIST_Foo" = private global { i32, i32, [1 x %struct._prop_t] } // Readonly property in interface made readwrite in a category: @@ -40,8 +40,8 @@ __attribute__((objc_root_class)) // Metadata for _evolvingprop should be present, and PROP_LIST for FooRO should // still have only one entry, and the one entry should point to the version of // the property with a getter and setter. -// CHECK: [[evolvinggetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [13 x i8] c"evolvingprop\00" -// CHECK: [[evolvingsetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [18 x i8] c"Ti,V_evolvingprop\00", -// CHECK: [[booleanmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [34 x i8] c"Ti,N,GisBooleanProp,V_booleanProp\00" -// CHECK: [[weakmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private global [23 x i8] c"T@\22Foo\22,W,N,V_weakProp\00" +// CHECK: [[evolvinggetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [13 x i8] c"evolvingprop\00" +// CHECK: [[evolvingsetter:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [18 x i8] c"Ti,V_evolvingprop\00", +// CHECK: [[booleanmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [34 x i8] c"Ti,N,GisBooleanProp,V_booleanProp\00" +// CHECK: [[weakmetadata:@OBJC_PROP_NAME_ATTR[^ ]+]] = private unnamed_addr constant [23 x i8] c"T@\22Foo\22,W,N,V_weakProp\00" // CHECK: @"\01l_OBJC_$_PROP_LIST_FooRO" = private global { i32, i32, [3 x %struct._prop_t] }{{.*}}[[evolvinggetter]]{{.*}}[[evolvingsetter]]{{.*}}[[booleanmetadata]] diff --git a/test/CodeGenObjC/protocol-comdat.m b/test/CodeGenObjC/protocol-comdat.m new file mode 100644 index 000000000000..65e1b9fa2c82 --- /dev/null +++ b/test/CodeGenObjC/protocol-comdat.m @@ -0,0 +1,20 @@ +// RUN: %clang -cc1 -triple thumbv7--windows-itanium -fobjc-runtime=ios -emit-llvm -o - %s -Wno-objc-root-class | FileCheck %s + +@protocol P +- (void) method; +@end + +@interface I<P> +@end + +@implementation I +- (void) method { } +@end + + +// CHECK: $"\01l_OBJC_PROTOCOL_$_P" = comdat any +// CHECK: $"\01l_OBJC_LABEL_PROTOCOL_$_P" = comdat any + +// CHECK: @"\01l_OBJC_PROTOCOL_$_P" = {{.*}}, comdat +// CHECK: @"\01l_OBJC_LABEL_PROTOCOL_$_P" = {{.*}}, comdat + diff --git a/test/CodeGenObjC/reorder-synthesized-ivars.m b/test/CodeGenObjC/reorder-synthesized-ivars.m index 958d447b983c..ef1bb79bcccb 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: @{{.*}} = 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 +// CHECK: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean1 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean2 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean3 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean4 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean5 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean6 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean7 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean8 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [10 x i8] c"_boolean9 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object1 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object2 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object3 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object4 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object5 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object6 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object7 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object8 +// CHECK-NEXT: @{{.*}} = private unnamed_addr constant [9 x i8] c"_object9 diff --git a/test/CodeGenObjC/runtime-abi-match.m b/test/CodeGenObjC/runtime-abi-match.m new file mode 100644 index 000000000000..ef391724ece0 --- /dev/null +++ b/test/CodeGenObjC/runtime-abi-match.m @@ -0,0 +1,25 @@ +// RUN: %clang -target armv7-windows -fobjc-runtime=ios -O1 -fexceptions -S -emit-llvm %s -o - | FileCheck %s +// REQUIRES: arm-registered-target + +void (*f)(id); +void (*g)(void); +void h(void); + +@interface NSNumber ++ (NSNumber *)numberWithInt:(int)i; +@end + +void i(void) { + @try { + @throw(@1); + } @catch (id i) { + (*f)(i); + (*g)(); + } +} + +// CHECK: call arm_aapcs_vfpcc i8* @objc_begin_catch +// CHECK: call arm_aapcs_vfpcc void @objc_end_catch +// CHECK-NOT: call i8* @objc_begin_catch +// CHECK-NOT: call void @objc_end_catch + diff --git a/test/CodeGenObjC/section-name.m b/test/CodeGenObjC/section-name.m new file mode 100644 index 000000000000..46775a905b7d --- /dev/null +++ b/test/CodeGenObjC/section-name.m @@ -0,0 +1,45 @@ +// RUN: %clang_cc1 -triple thumbv7--windows-itanium -fdeclspec -fobjc-runtime=ios -emit-llvm -o - %s -Wno-objc-root-class | FileCheck %s + +@protocol Protocol +- (void) protocol_method; +@end + +__declspec(dllexport) +@interface Interface<Protocol> +@property(assign) id property; ++ (void) class_method; +- (void) instance_method; +@end + + +@implementation Interface ++ (void) class_method { +} + +- (void) protocol_method { +} + +- (void) instance_method { +} +@end + +@implementation Interface(Category) +- (void) category_method { +} +@end + +// CHECK-NOT: @"OBJC_IVAR_$_Interface._property" = {{.*}} section "__DATA, __objc_ivar" +// CHECK-NOT: @"OBJC_CLASS_$_Interface" = {{.*}} section "__DATA, __objc_data" +// CHECK-NOT: @"OBJC_METACLASS_$_Interface" = {{.*}} section "__DATA, __objc_data" +// CHECK-NOT: @"\01l_OBJC_$_CLASS_METHODS_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_$_PROTOCOL_INSTANCE_METHODS_Protocol" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_$_PROTOCOL_METHOD_TYPES_Protocol" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_CLASS_PROTOCOLS_$_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_METACLASS_RO_$_" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_$_INSTANCE_METHODS_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_$_INSTANCE_VARIABLES_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_$_PROP_LIST_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_CLASS_RO_$_Interface" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_$_CATEGORY_INSTANCE_METHODS_Interface_$_Category" = {{.*}} section "__DATA, __objc_const" +// CHECK-NOT: @"\01l_OBJC_$_CATEGORY_Interface_$_Category" = {{.*}} section "__DATA, __objc_const" + diff --git a/test/CodeGenObjC/tentative-cfconstantstring.m b/test/CodeGenObjC/tentative-cfconstantstring.m index 9ff1a0a2fce2..bb76b033cf5f 100644 --- a/test/CodeGenObjC/tentative-cfconstantstring.m +++ b/test/CodeGenObjC/tentative-cfconstantstring.m @@ -32,7 +32,7 @@ static inline void _inlineFunction() { @end // CHECK: @__CFConstantStringClassReference = common global [24 x i32] zeroinitializer, align 16 -// CHECK: @_unnamed_cfstring_{{.*}} = private constant %struct.__NSConstantString_tag { i32* getelementptr inbounds ([24 x i32], [24 x i32]* @__CFConstantStringClassReference, i32 0, i32 0) +// CHECK: @_unnamed_cfstring_{{.*}} = private global %struct.__NSConstantString_tag { i32* getelementptr inbounds ([24 x i32], [24 x i32]* @__CFConstantStringClassReference, i32 0, i32 0) // CHECK-LABEL: define internal void @_inlineFunction() // CHECK: [[ZERO:%.*]] = load %struct._class_t*, %struct._class_t** @"OBJC_CLASSLIST_REFERENCES_ diff --git a/test/CodeGenObjC/ubsan-array-bounds.m b/test/CodeGenObjC/ubsan-array-bounds.m new file mode 100644 index 000000000000..38d1eb310d21 --- /dev/null +++ b/test/CodeGenObjC/ubsan-array-bounds.m @@ -0,0 +1,59 @@ +// RUN: %clang_cc1 -x objective-c -emit-llvm -triple x86_64-apple-macosx10.10.0 -Wno-objc-root-class -fsanitize=array-bounds %s -o - | FileCheck %s + +@interface FlexibleArray1 { +@public + char chars[0]; +} +@end +@implementation FlexibleArray1 +@end + +// CHECK-LABEL: test_FlexibleArray1 +char test_FlexibleArray1(FlexibleArray1 *FA1) { + // CHECK-NOT: !nosanitize + return FA1->chars[1]; + // CHECK: } +} + +@interface FlexibleArray2 { +@public + char chars[0]; +} +@end +@implementation FlexibleArray2 { +@public + char chars2[0]; +} +@end + +// CHECK-LABEL: test_FlexibleArray2_1 +char test_FlexibleArray2_1(FlexibleArray2 *FA2) { + // CHECK: !nosanitize + return FA2->chars[1]; + // CHECK: } +} + +// CHECK-LABEL: test_FlexibleArray2_2 +char test_FlexibleArray2_2(FlexibleArray2 *FA2) { + // CHECK-NOT: !nosanitize + return FA2->chars2[1]; + // CHECK: } +} + +@interface FlexibleArray3 { +@public + char chars[0]; +} +@end +@implementation FlexibleArray3 { +@public + int i; +} +@end + +// CHECK-LABEL: test_FlexibleArray3 +char test_FlexibleArray3(FlexibleArray3 *FA3) { + // CHECK: !nosanitize + return FA3->chars[1]; + // CHECK: } +} diff --git a/test/CodeGenObjC/ubsan-bool.m b/test/CodeGenObjC/ubsan-bool.m new file mode 100644 index 000000000000..6d6c08358d07 --- /dev/null +++ b/test/CodeGenObjC/ubsan-bool.m @@ -0,0 +1,13 @@ +// RUN: %clang_cc1 -x objective-c -emit-llvm -triple x86_64-apple-macosx10.10.0 -fsanitize=bool %s -o - | FileCheck %s -check-prefixes=SHARED,OBJC +// RUN: %clang_cc1 -x objective-c++ -emit-llvm -triple x86_64-apple-macosx10.10.0 -fsanitize=bool %s -o - | FileCheck %s -check-prefixes=SHARED,OBJC +// RUN: %clang_cc1 -x c -emit-llvm -triple x86_64-apple-macosx10.10.0 -fsanitize=bool %s -o - | FileCheck %s -check-prefixes=SHARED,C + +typedef signed char BOOL; + +// SHARED-LABEL: f1 +BOOL f1() { + // OBJC: call void @__ubsan_handle_load_invalid_value + // C-NOT: call void @__ubsan_handle_load_invalid_value + BOOL a = 2; + return a + 1; +} diff --git a/test/CodeGenObjC/unqual-copy-restore.m b/test/CodeGenObjC/unqual-copy-restore.m new file mode 100644 index 000000000000..09915f7ce6a8 --- /dev/null +++ b/test/CodeGenObjC/unqual-copy-restore.m @@ -0,0 +1,14 @@ +// RUN: %clang_cc1 %s -fobjc-arc -S -emit-llvm -o /dev/null + +// rdar://problem/28488427 - Don't crash if the argument type and the parameter +// type in an indirect copy restore expression have different qualification. +@protocol P1 +@end + +typedef int handler(id<P1> *const p); + +int main() { + id<P1> i1 = 0; + handler *func = 0; + return func(&i1); +} |