diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2011-05-02 19:39:53 +0000 |
commit | 01af97d3b23bded2b2b21af19bbc6e4cce49e5b3 (patch) | |
tree | 64a10f4c4154739d4a8191d7e1b52ce497f4ebd6 /test/CodeGenObjC | |
parent | c3b054d250cdca485c71845089c316e10610ebad (diff) | |
download | src-01af97d3b23bded2b2b21af19bbc6e4cce49e5b3.tar.gz src-01af97d3b23bded2b2b21af19bbc6e4cce49e5b3.zip |
Vendor import of clang trunk r130700:vendor/clang/clang-r130700
Notes
Notes:
svn path=/vendor/clang/dist/; revision=221339
svn path=/vendor/clang/clang-r130700/; revision=221340; tag=vendor/clang/clang-r130700
Diffstat (limited to 'test/CodeGenObjC')
-rw-r--r-- | test/CodeGenObjC/atomic-aggregate-property.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/attr-availability.m | 24 | ||||
-rw-r--r-- | test/CodeGenObjC/bitfield-access.m | 9 | ||||
-rw-r--r-- | test/CodeGenObjC/blocks.m | 13 | ||||
-rw-r--r-- | test/CodeGenObjC/constant-strings.m | 16 | ||||
-rw-r--r-- | test/CodeGenObjC/debug-info-foreach.m | 7 | ||||
-rw-r--r-- | test/CodeGenObjC/debug-info-getter-name.m | 9 | ||||
-rw-r--r-- | test/CodeGenObjC/debug-info-property.m | 12 | ||||
-rw-r--r-- | test/CodeGenObjC/fpret.m | 2 | ||||
-rw-r--r-- | test/CodeGenObjC/instance-method-metadata.m | 34 | ||||
-rw-r--r-- | test/CodeGenObjC/messages.m | 20 | ||||
-rw-r--r-- | test/CodeGenObjC/metadata-symbols-64.m | 6 | ||||
-rw-r--r-- | test/CodeGenObjC/metadata_symbols.m | 4 | ||||
-rw-r--r-- | test/CodeGenObjC/misc-atomic-property.m | 80 | ||||
-rw-r--r-- | test/CodeGenObjC/missing-atend-metadata.m | 24 | ||||
-rw-r--r-- | test/CodeGenObjC/no-vararg-messaging.m | 18 | ||||
-rw-r--r-- | test/CodeGenObjC/property-agrr-getter.m | 8 | ||||
-rw-r--r-- | test/CodeGenObjC/simplify-exceptions.mm | 18 |
18 files changed, 256 insertions, 50 deletions
diff --git a/test/CodeGenObjC/atomic-aggregate-property.m b/test/CodeGenObjC/atomic-aggregate-property.m index 93eeca820117..3cd12a5c2c1a 100644 --- a/test/CodeGenObjC/atomic-aggregate-property.m +++ b/test/CodeGenObjC/atomic-aggregate-property.m @@ -23,7 +23,7 @@ struct s1 { @synthesize y; @synthesize z; @end - // CHECK-LP64: call void @objc_copyStruct // CHECK-LP64: call void @objc_copyStruct // CHECK-LP64: call void @objc_copyStruct +// CHECK-LP64: call i8* @objc_memmove_collectable diff --git a/test/CodeGenObjC/attr-availability.m b/test/CodeGenObjC/attr-availability.m new file mode 100644 index 000000000000..d2b2973c78d3 --- /dev/null +++ b/test/CodeGenObjC/attr-availability.m @@ -0,0 +1,24 @@ +// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin8.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_4 %s +// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin9.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_5 %s +// RUN: %clang_cc1 -fvisibility hidden -fobjc-nonfragile-abi "-triple" "x86_64-apple-darwin10.0.0" -emit-llvm -o - %s | FileCheck -check-prefix=CHECK-10_6 %s + +// CHECK-10_4: @"OBJC_CLASS_$_WeakClass1" = extern_weak global +// CHECK-10_5: @"OBJC_CLASS_$_WeakClass1" = external global +// CHECK-10_6: @"OBJC_CLASS_$_WeakClass1" = external global +__attribute__((availability(macosx,introduced=10.5))) +@interface WeakClass1 @end + +@implementation WeakClass1(MyCategory) @end + +@implementation WeakClass1(YourCategory) @end + +// CHECK-10_4: @"OBJC_CLASS_$_WeakClass2" = extern_weak global +// CHECK-10_5: @"OBJC_CLASS_$_WeakClass2" = extern_weak global +// CHECK-10_6: @"OBJC_CLASS_$_WeakClass2" = external global +__attribute__((availability(macosx,introduced=10.6))) +@interface WeakClass2 @end + +@implementation WeakClass2(MyCategory) @end + +@implementation WeakClass2(YourCategory) @end + diff --git a/test/CodeGenObjC/bitfield-access.m b/test/CodeGenObjC/bitfield-access.m index 16b0001ddfda..ab776abd4ea6 100644 --- a/test/CodeGenObjC/bitfield-access.m +++ b/test/CodeGenObjC/bitfield-access.m @@ -1,7 +1,8 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -o %t %s -// RUN: FileCheck -check-prefix=CHECK-I386 < %t %s -// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -emit-llvm -o %t %s -// RUN: FileCheck -check-prefix=CHECK-ARM < %t %s +// RUN: %clang_cc1 -triple i386-apple-darwin10 -emit-llvm -o %t1 %s +// RUN: FileCheck -check-prefix=CHECK-I386 < %t1 %s + +// RUN: %clang_cc1 -triple armv6-apple-darwin10 -target-abi apcs-gnu -emit-llvm -o %t2 %s +// RUN: FileCheck -check-prefix=CHECK-ARM < %t2 %s @interface I0 { @public diff --git a/test/CodeGenObjC/blocks.m b/test/CodeGenObjC/blocks.m index 06dc908f2ba3..151c16234214 100644 --- a/test/CodeGenObjC/blocks.m +++ b/test/CodeGenObjC/blocks.m @@ -87,3 +87,16 @@ void test2(Test2 *x) { __weak __block Test2 *weakX = x; test2_helper(^{ [weakX destroy]; }); } + +// rdar://problem/9124263 +// In the test above, check that the use in the invocation function +// doesn't require a read barrier. +// CHECK: define internal void @__test2_block_invoke_ +// CHECK: [[BLOCK:%.*]] = bitcast i8* {{%.*}} to [[BLOCK_T]]* +// CHECK-NEXT: [[T0:%.*]] = getelementptr inbounds [[BLOCK_T]]* [[BLOCK]], i32 0, i32 5 +// CHECK-NEXT: [[T1:%.*]] = load i8** [[T0]] +// CHECK-NEXT: [[T2:%.*]] = bitcast i8* [[T1]] to [[WEAK_T]]* +// CHECK-NEXT: [[T3:%.*]] = getelementptr inbounds [[WEAK_T]]* [[T2]], i32 0, i32 1 +// CHECK-NEXT: [[T4:%.*]] = load [[WEAK_T]]** [[T3]] +// CHECK-NEXT: [[WEAKX:%.*]] = getelementptr inbounds [[WEAK_T]]* [[T4]], i32 0, i32 6 +// CHECK-NEXT: [[T0:%.*]] = load [[TEST2]]** [[WEAKX]], align 4 diff --git a/test/CodeGenObjC/constant-strings.m b/test/CodeGenObjC/constant-strings.m index 227694969bfe..398981362e08 100644 --- a/test/CodeGenObjC/constant-strings.m +++ b/test/CodeGenObjC/constant-strings.m @@ -1,6 +1,18 @@ // RUN: %clang_cc1 -emit-llvm -o %t %s -// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s && grep NXConstantString %t | count 1 -// RUN: %clang_cc1 -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s && grep NSConstantString %t | count 1 +// RUN: FileCheck --check-prefix=CHECK-NEXT < %t %s +// Check that we set alignment 1 on the string. +// +// CHECK-NEXT: @.str = {{.*}}constant [13 x i8] c"Hello World!\00", align 1 + +// RUN: %clang_cc1 -fgnu-runtime -emit-llvm -o %t %s +// RUN: FileCheck --check-prefix=CHECK-GNU < %t %s +// CHECK-GNU: NXConstantString +// CHECK-GNU-NOT: NXConstantString + +// RUN: %clang_cc1 -fgnu-runtime -fconstant-string-class NSConstantString -emit-llvm -o %t %s +// RUN: FileCheck --check-prefix=CHECK-GNU-WITH-CLASS < %t %s +// CHECK-GNU-WITH-CLASS: NSConstantString +// CHECK-GNU-WITH-CLASS-NOT: NSConstantString id a = @"Hello World!"; diff --git a/test/CodeGenObjC/debug-info-foreach.m b/test/CodeGenObjC/debug-info-foreach.m index c056e0e249de..89b409c7169e 100644 --- a/test/CodeGenObjC/debug-info-foreach.m +++ b/test/CodeGenObjC/debug-info-foreach.m @@ -4,10 +4,17 @@ @class NSArray; +int i; void f(NSArray *a) { id keys; for (id thisKey in keys) { + int j = i; + ++j; + i = j; } for (id thisKey in keys) { + int k = i; + ++k; + i = k; } } diff --git a/test/CodeGenObjC/debug-info-getter-name.m b/test/CodeGenObjC/debug-info-getter-name.m index 0263f112aeb4..746fcee18298 100644 --- a/test/CodeGenObjC/debug-info-getter-name.m +++ b/test/CodeGenObjC/debug-info-getter-name.m @@ -1,5 +1,10 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -g %s -o %t -// RUN: grep "\[InstanceVariablesEverywhereButTheInterface someString\]" %t | count 6 +// RUN: %clang_cc1 -fno-dwarf2-cfi-asm -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -g %s -o - | FileCheck %s + +//CHECK: "-[InstanceVariablesEverywhereButTheInterface someString]": +//CHECK: .quad "-[InstanceVariablesEverywhereButTheInterface someString]" +//CHECK: .ascii "-[InstanceVariablesEverywhereButTheInterface someString]" +//CHECK: .asciz "-[InstanceVariablesEverywhereButTheInterface someString]" +//CHECK: "-[InstanceVariablesEverywhereButTheInterface someString].eh": //rdar: //8498026 diff --git a/test/CodeGenObjC/debug-info-property.m b/test/CodeGenObjC/debug-info-property.m new file mode 100644 index 000000000000..d86b7c7a5eba --- /dev/null +++ b/test/CodeGenObjC/debug-info-property.m @@ -0,0 +1,12 @@ +// RUN: %clang_cc1 -masm-verbose -S -g %s -o - | FileCheck %s + +// CHECK: AT_APPLE_property_name +@interface I1 { +int p1; +} +@property int p1; +@end + +@implementation I1 +@synthesize p1; +@end diff --git a/test/CodeGenObjC/fpret.m b/test/CodeGenObjC/fpret.m index 48848885c1f6..bde0caa8ff3a 100644 --- a/test/CodeGenObjC/fpret.m +++ b/test/CodeGenObjC/fpret.m @@ -16,7 +16,7 @@ // CHECK-X86_32: define void @t0() // CHECK-X86_32: call float bitcast {{.*}} @objc_msgSend_fpret to -// CHECK-X86_32: call double {{.*}} @objc_msgSend_fpret( +// CHECK-X86_32: call double bitcast {{.*}} @objc_msgSend_fpret to // CHECK-X86_32: call x86_fp80 bitcast {{.*}} @objc_msgSend_fpret to // CHECK-X86_32: } // diff --git a/test/CodeGenObjC/instance-method-metadata.m b/test/CodeGenObjC/instance-method-metadata.m new file mode 100644 index 000000000000..ae87c7a85345 --- /dev/null +++ b/test/CodeGenObjC/instance-method-metadata.m @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -o %t %s +// RUN: FileCheck < %t %s + +// rdar://9072317 + +/** The problem looks like clang getting confused when a single translation unit + contains a protocol with a property and two classes that implement that protocol + and synthesize the property. +*/ + +@protocol Proto +@property (assign) id prop; +@end + +@interface NSObject @end + +@interface Foo : NSObject <Proto> { int x; } @end + +@interface Bar : NSObject <Proto> @end + +@implementation Foo +@synthesize prop; +@end + +@implementation Bar +@synthesize prop; +@end + +// CHECK: l_OBJC_$_INSTANCE_METHODS_Bar: +// CHECK-NEXT .long 24 +// CHECK-NEXT .long 2 +// CHECK-NEXT .quad L_OBJC_METH_VAR_NAME_ +// CHECK-NEXT .quad L_OBJC_METH_VAR_TYPE_ +// CHECK-NEXT .quad "-[Bar prop]" diff --git a/test/CodeGenObjC/messages.m b/test/CodeGenObjC/messages.m index b36fe5b644ed..a921dc774ad1 100644 --- a/test/CodeGenObjC/messages.m +++ b/test/CodeGenObjC/messages.m @@ -13,35 +13,35 @@ void f0(id a) { int i; MyPoint pt = { 1, 2}; - // CHECK-MAC: call {{.*}} @objc_msgSend( - // CHECK-MAC-NF: call {{.*}} @objc_msgSend( + // CHECK-MAC: call {{.*}} @objc_msgSend to + // CHECK-MAC-NF: call {{.*}} @objc_msgSend to // CHECK-GNU: call {{.*}} @objc_msg_lookup( // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender( [a print0]; // CHECK-MAC: call {{.*}} @objc_msgSend to // CHECK-MAC-NF: call {{.*}} @objc_msgSend to - // CHECK-GNU: call {{.*}} @objc_msg_lookup to - // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to + // CHECK-GNU: call {{.*}} @objc_msg_lookup( + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender( [a print1: 10]; // CHECK-MAC: call {{.*}} @objc_msgSend to // CHECK-MAC-NF: call {{.*}} @objc_msgSend to - // CHECK-GNU: call {{.*}} @objc_msg_lookup to - // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to + // CHECK-GNU: call {{.*}} @objc_msg_lookup( + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender( [a print2: 10 and: "hello" and: 2.2]; // CHECK-MAC: call {{.*}} @objc_msgSend to // CHECK-MAC-NF: call {{.*}} @objc_msgSend to - // CHECK-GNU: call {{.*}} @objc_msg_lookup to - // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to + // CHECK-GNU: call {{.*}} @objc_msg_lookup( + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender( [a takeStruct: pt ]; void *s = @selector(print0); for (i=0; i<2; ++i) // CHECK-MAC: call {{.*}} @objc_msgSend to // CHECK-MAC-NF: call {{.*}} @objc_msgSend to - // CHECK-GNU: call {{.*}} @objc_msg_lookup to - // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender to + // CHECK-GNU: call {{.*}} @objc_msg_lookup( + // CHECK-GNU-NF: call {{.*}} @objc_msg_lookup_sender( [a performSelector:s]; } diff --git a/test/CodeGenObjC/metadata-symbols-64.m b/test/CodeGenObjC/metadata-symbols-64.m index dbc06d76cd50..908c95cdf5d2 100644 --- a/test/CodeGenObjC/metadata-symbols-64.m +++ b/test/CodeGenObjC/metadata-symbols-64.m @@ -7,11 +7,11 @@ // RUN: grep '@"OBJC_METACLASS_$_A" = global .* section "__DATA, __objc_data", align 8' %t // RUN: grep '@"\\01L_OBJC_CLASSLIST_REFERENCES_$_[0-9]*" = internal global .* section "__DATA, __objc_classrefs, regular, no_dead_strip", align 8' %t // RUN: grep '@"\\01L_OBJC_CLASSLIST_SUP_REFS_$_[0-9]*" = internal global .* section "__DATA, __objc_superrefs, regular, no_dead_strip", align 8' %t | count 2 -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t +// RUN: grep '@"\\01L_OBJC_CLASS_NAME_[0-9]*" = internal global .* section "__TEXT,__objc_classname,cstring_literals", align 1' %t // RUN: grep '@"\\01L_OBJC_LABEL_CATEGORY_$" = internal global .* section "__DATA, __objc_catlist, regular, no_dead_strip", align 8' %t // RUN: grep '@"\\01L_OBJC_LABEL_CLASS_$" = internal global .* section "__DATA, __objc_classlist, regular, no_dead_strip", align 8' %t -// RUN: grep '@"\\01L_OBJC_METH_VAR_NAME_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t -// RUN: grep '@"\\01L_OBJC_METH_VAR_TYPE_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t +// RUN: grep '@"\\01L_OBJC_METH_VAR_NAME_[0-9]*" = internal global .* section "__TEXT,__objc_methname,cstring_literals", align 1' %t +// RUN: grep '@"\\01L_OBJC_METH_VAR_TYPE_[0-9]*" = internal global .* section "__TEXT,__objc_methtype,cstring_literals", align 1' %t // RUN: grep '@"\\01L_OBJC_PROP_NAME_ATTR_[0-9]*" = internal global .* section "__TEXT,__cstring,cstring_literals", align 1' %t // RUN: grep '@"\\01L_OBJC_SELECTOR_REFERENCES_*" = internal global .* section "__DATA, __objc_selrefs, literal_pointers, no_dead_strip"' %t // RUN: grep '@"\\01l_OBJC_$_CATEGORY_A_$_Cat" = internal global .* section "__DATA, __objc_const", align 8' %t diff --git a/test/CodeGenObjC/metadata_symbols.m b/test/CodeGenObjC/metadata_symbols.m index d86422999f61..370ca6eccbe9 100644 --- a/test/CodeGenObjC/metadata_symbols.m +++ b/test/CodeGenObjC/metadata_symbols.m @@ -4,7 +4,7 @@ // CHECK-X86_64: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8 // CHECK-X86_64: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 8 -// CHECK-X86_64: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK-X86_64: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,cstring_literals", align 1 // 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 @@ -28,7 +28,7 @@ // CHECK-ARMV6: @"OBJC_CLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4 // CHECK-ARMV6: @"OBJC_METACLASS_$_A" = global {{.*}}, section "__DATA, __objc_data", align 4 -// CHECK-ARMV6: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__cstring,cstring_literals", align 1 +// CHECK-ARMV6: @"\01L_OBJC_CLASS_NAME_" = {{.*}}, section "__TEXT,__objc_classname,cstring_literals", align 1 // 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 diff --git a/test/CodeGenObjC/misc-atomic-property.m b/test/CodeGenObjC/misc-atomic-property.m new file mode 100644 index 000000000000..26402d355b59 --- /dev/null +++ b/test/CodeGenObjC/misc-atomic-property.m @@ -0,0 +1,80 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm -o - %s | FileCheck %s +// rdar: //8808439 + +typedef struct { +#ifdef __LP64__ + unsigned char b[15]; +#else + unsigned char b[7]; +#endif +} bools_minus_one; + +typedef struct { +#ifdef __LP64__ + unsigned char b[16]; +#else + unsigned char b[8]; +#endif +} bools; + + +@interface Foo +{ +#ifndef __LP64__ + bools x; + bools_minus_one y; +#endif +} +@property(assign) bools bools_p; +@property(assign) bools_minus_one bools_minus_one_p; +@end + +@implementation Foo +@synthesize bools_p=x; +@synthesize bools_minus_one_p=y; +@end + +#ifdef __LP64__ +typedef __int128_t dword; +#else +typedef long long int dword; +#endif + +@interface Test_dwords +{ +#ifndef __LP64__ + dword dw; +#endif +} +@property(assign) dword dword_p; +@end + +@implementation Test_dwords +@synthesize dword_p=dw; +@end + + +@interface Test_floats +{ + float fl; + double d; + long double ld; +} +@property(assign) float fl_p; +@property(assign) double d_p; +@property(assign) long double ld_p; +@end + +@implementation Test_floats +@synthesize fl_p = fl; +@synthesize d_p = d; +@synthesize ld_p = ld; +@end + +// CHECK: call void @objc_copyStruct +// CHECK: call void @objc_copyStruct +// CHECK: call void @objc_copyStruct +// CHECK: call void @objc_copyStruct +// CHECK: call void @objc_copyStruct +// CHECK: call void @objc_copyStruct diff --git a/test/CodeGenObjC/missing-atend-metadata.m b/test/CodeGenObjC/missing-atend-metadata.m deleted file mode 100644 index 50e597c8d1a8..000000000000 --- a/test/CodeGenObjC/missing-atend-metadata.m +++ /dev/null @@ -1,24 +0,0 @@ -// RUN: %clang_cc1 -triple i386-apple-darwin9 -emit-llvm %s -o - | FileCheck %s - -@interface I0 -@end - -@implementation I0 // expected-warning {{'@end' is missing in implementation context}} -- meth { return 0; } - -@interface I1 : I0 -@end - -@implementation I1 // expected-warning {{'@end' is missing in implementation context}} --(void) im0 { self = [super init]; } - -@interface I2 : I0 -- I2meth; -@end - -@implementation I2 // expected-warning {{'@end' is missing in implementation context}} -- I2meth { return 0; } - -@implementation I2(CAT) // expected-warning {{'@end' is missing in implementation context}} - -// CHECK: @"\01L_OBJC_CLASS_I1" = internal global diff --git a/test/CodeGenObjC/no-vararg-messaging.m b/test/CodeGenObjC/no-vararg-messaging.m new file mode 100644 index 000000000000..f72820a4b66e --- /dev/null +++ b/test/CodeGenObjC/no-vararg-messaging.m @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-nonfragile-abi -S -o - %s | FileCheck %s +// rdar://9048030 + +@interface Foo ++(id)alloc; +-(id)init; +-(id)self; +-(id)retain; +-(void)release; +-(id)autorelease; +@end + +void test(void) +{ + [[[[[[Foo alloc] init] retain] autorelease] self] release]; +} + +// CHECK-NOT: xorb diff --git a/test/CodeGenObjC/property-agrr-getter.m b/test/CodeGenObjC/property-agrr-getter.m index 2dd32bb4f373..6d8f1d6b03ad 100644 --- a/test/CodeGenObjC/property-agrr-getter.m +++ b/test/CodeGenObjC/property-agrr-getter.m @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -emit-llvm -o %t %s +// RUN: %clang_cc1 -emit-llvm-only %s typedef struct { unsigned f0; @@ -36,3 +36,9 @@ float f () AnObject* obj; return (obj.size).width; } + +// rdar://problem/9272392 +void test3(AnObject *obj) { + obj.size; + (void) obj.size; +} diff --git a/test/CodeGenObjC/simplify-exceptions.mm b/test/CodeGenObjC/simplify-exceptions.mm new file mode 100644 index 000000000000..a35b10d73d2d --- /dev/null +++ b/test/CodeGenObjC/simplify-exceptions.mm @@ -0,0 +1,18 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm \ +// RUN: -fexceptions -fobjc-exceptions -fobjc-nonfragile-abi \ +// RUN: -o %t %s +// RUN: FileCheck < %t %s +// +// <rdar://problem/7471679> [irgen] [eh] Exception code built with clang (x86_64) crashes + +// Check that we don't emit unnecessary personality function references. +struct t0_A { t0_A(); }; +struct t0_B { t0_A a; }; + +// CHECK: define {{.*}} @_Z2t0v(){{.*}} { +// CHECK-NOT: objc_personality +// CHECK: } +t0_B& t0() { + static t0_B x; + return x; +} |