diff options
Diffstat (limited to 'test/CodeGenObjCXX')
| -rw-r--r-- | test/CodeGenObjCXX/exceptions.mm | 2 | ||||
| -rw-r--r-- | test/CodeGenObjCXX/ivar-objects.mm | 18 | ||||
| -rw-r--r-- | test/CodeGenObjCXX/message-reference.mm | 20 | ||||
| -rw-r--r-- | test/CodeGenObjCXX/property-reference.mm | 34 | ||||
| -rw-r--r-- | test/CodeGenObjCXX/references.mm | 2 |
5 files changed, 74 insertions, 2 deletions
diff --git a/test/CodeGenObjCXX/exceptions.mm b/test/CodeGenObjCXX/exceptions.mm index 00de88c15220..d4c0756cb89f 100644 --- a/test/CodeGenObjCXX/exceptions.mm +++ b/test/CodeGenObjCXX/exceptions.mm @@ -1,4 +1,4 @@ -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -o - %s | FileCheck %s +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fcxx-exceptions -fexceptions -o - %s | FileCheck %s @interface OCType @end void opaque(); diff --git a/test/CodeGenObjCXX/ivar-objects.mm b/test/CodeGenObjCXX/ivar-objects.mm index d0432edf2b29..d05763b3fcf8 100644 --- a/test/CodeGenObjCXX/ivar-objects.mm +++ b/test/CodeGenObjCXX/ivar-objects.mm @@ -1,6 +1,10 @@ // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s // CHECK: -[A .cxx_construct] // CHECK: -[A .cxx_destruct] +// CHECK: -[B .cxx_construct] +// CHECK-NOT: -[B .cxx_destruct] +// CHECK-NOT: -[C .cxx_construct] +// CHECK: -[C .cxx_destruct] @interface NSObject - alloc; @@ -84,3 +88,17 @@ public: @implementation I @synthesize position; @end + +// This class should have a .cxx_construct but no .cxx_destruct. +namespace test3 { struct S { S(); }; } +@implementation B { + test3::S s; +} +@end + +// This class should have a .cxx_destruct but no .cxx_construct. +namespace test4 { struct S { ~S(); }; } +@implementation C { + test4::S s; +} +@end diff --git a/test/CodeGenObjCXX/message-reference.mm b/test/CodeGenObjCXX/message-reference.mm new file mode 100644 index 000000000000..b7cf98d88c66 --- /dev/null +++ b/test/CodeGenObjCXX/message-reference.mm @@ -0,0 +1,20 @@ +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s +// rdar://8604515 + +@interface I {} +-(unsigned int&)referenceCount; +@end + +@interface MyClass ++(int)writeBlip:(I*)srcBlip; +@end + +@implementation MyClass ++(int)writeBlip:(I*)srcBlip{ + return ([srcBlip referenceCount] == 0); +} +@end + +// CHECK: [[T:%.*]] = call i32* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: [[U:%.*]] = load i32* [[T]] +// CHECK [[V:%.*]] = icmp eq i32 [[U]], 0 diff --git a/test/CodeGenObjCXX/property-reference.mm b/test/CodeGenObjCXX/property-reference.mm new file mode 100644 index 000000000000..7c235cb9b4ef --- /dev/null +++ b/test/CodeGenObjCXX/property-reference.mm @@ -0,0 +1,34 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s +// rdar://9208606 + +struct MyStruct +{ + int x; + int y; + int z; +}; + +@interface MyClass +{ + MyStruct _foo; +} + +@property (assign, readwrite) const MyStruct& foo; + +- (const MyStruct&) foo; +- (void) setFoo:(const MyStruct&)inFoo; +@end + +int main() +{ + MyClass* myClass; + MyStruct myStruct; + + myClass.foo = myStruct; + + const MyStruct& currentMyStruct = myClass.foo; + return 0; +} + +// CHECK: [[C:%.*]] = call %struct.MyStruct* bitcast (i8* (i8*, i8*, ...)* @objc_msgSend +// CHECK: store %struct.MyStruct* [[C]], %struct.MyStruct** [[D:%.*]] diff --git a/test/CodeGenObjCXX/references.mm b/test/CodeGenObjCXX/references.mm index 8875fd624074..6265c7be7613 100644 --- a/test/CodeGenObjCXX/references.mm +++ b/test/CodeGenObjCXX/references.mm @@ -30,7 +30,7 @@ void f(B* b) { @protocol P2 @end @protocol P3 @end @interface foo<P1> {} @end -@interface bar : foo <P1, P2> {} @end +@interface bar : foo <P1, P2, P3> {} @end typedef bar baz; void f5(foo&); void f5b(foo<P1>&); |
