diff options
Diffstat (limited to 'test/CodeGenObjCXX')
-rw-r--r-- | test/CodeGenObjCXX/exceptions.mm | 17 | ||||
-rw-r--r-- | test/CodeGenObjCXX/property-objects.mm | 8 | ||||
-rw-r--r-- | test/CodeGenObjCXX/references.mm | 20 | ||||
-rw-r--r-- | test/CodeGenObjCXX/rtti.mm | 52 |
4 files changed, 97 insertions, 0 deletions
diff --git a/test/CodeGenObjCXX/exceptions.mm b/test/CodeGenObjCXX/exceptions.mm new file mode 100644 index 0000000..00de88c --- /dev/null +++ b/test/CodeGenObjCXX/exceptions.mm @@ -0,0 +1,17 @@ +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -fobjc-nonfragile-abi -fexceptions -o - %s | FileCheck %s + +@interface OCType @end +void opaque(); + +namespace test0 { + + // CHECK: define void @_ZN5test03fooEv + void foo() { + try { + // CHECK: invoke void @_Z6opaquev + opaque(); + } catch (OCType *T) { + // CHECK: call i32 (i8*, i8*, ...)* @llvm.eh.selector({{.*}} @__objc_personality_v0 {{.*}} @"OBJC_EHTYPE_$_OCType" + } + } +} diff --git a/test/CodeGenObjCXX/property-objects.mm b/test/CodeGenObjCXX/property-objects.mm index 662dacc..724cf68 100644 --- a/test/CodeGenObjCXX/property-objects.mm +++ b/test/CodeGenObjCXX/property-objects.mm @@ -25,6 +25,8 @@ struct CGRect { - (void)setFrame:(CGRect)frameRect; - (CGRect)frame; - (void) initWithOwner; +- (struct CGRect)extent; +- (void)dealloc; @end @implementation I @@ -40,6 +42,12 @@ struct CGRect { labelLayerFrame = self.bounds; _labelLayer.frame = labelLayerFrame; } +// rdar://8366604 +- (void)dealloc + { + CGRect cgrect = self.extent; + } +- (struct CGRect)extent {return bounds;} @end int main() { diff --git a/test/CodeGenObjCXX/references.mm b/test/CodeGenObjCXX/references.mm index c2232e2..8875fd6 100644 --- a/test/CodeGenObjCXX/references.mm +++ b/test/CodeGenObjCXX/references.mm @@ -19,7 +19,27 @@ struct A { ~A(); }; // CHECK: define void @_Z1fP1B // CHECK: objc_msgSend to +// CHECK-NOT: call void @_ZN1AD1Ev // CHECK: ret void void f(B* b) { (void)[b getA]; } + +// PR7741 +@protocol P1 @end +@protocol P2 @end +@protocol P3 @end +@interface foo<P1> {} @end +@interface bar : foo <P1, P2> {} @end +typedef bar baz; +void f5(foo&); +void f5b(foo<P1>&); +void f5c(foo<P2>&); +void f5d(foo<P3>&); +void f6(baz* x) { + f5(*x); + f5b(*x); + f5c(*x); + f5d(*x); + (void)((foo&)*x); +} diff --git a/test/CodeGenObjCXX/rtti.mm b/test/CodeGenObjCXX/rtti.mm new file mode 100644 index 0000000..27d24cb --- /dev/null +++ b/test/CodeGenObjCXX/rtti.mm @@ -0,0 +1,52 @@ +// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s + +// PR7864. This all follows GCC's lead. + +namespace std { class type_info; } + +// CHECK: @_ZTI1A = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS1A +@interface A +@end + +// CHECK: @_ZTI1B = weak_odr constant {{.*}}@_ZTVN10__cxxabiv120__si_class_type_infoE{{.*}}@_ZTS1B{{.*}}@_ZTI1A +@interface B : A +@end + +// CHECK: @_ZTIP1B = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP1B{{.*}}), i32 0, {{.*}}@_ZTI1B +// CHECK: @_ZTI11objc_object = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS11objc_object +// CHECK: @_ZTIP11objc_object = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP11objc_object{{.*}}@_ZTI11objc_object +// CHECK: @_ZTI10objc_class = weak_odr constant {{.*}}@_ZTVN10__cxxabiv117__class_type_infoE{{.*}}@_ZTS10objc_class +// CHECK: @_ZTIP10objc_class = weak_odr constant {{.*}}@_ZTVN10__cxxabiv119__pointer_type_infoE{{.*}}@_ZTSP10objc_class{{.*}}@_ZTI10objc_class + +@protocol P; + +int main() { + // CHECK: store {{.*}} @_ZTIP1B + // CHECK: store {{.*}} @_ZTI1B + const std::type_info &t1 = typeid(B*); + const std::type_info &t2 = typeid(B); + + // CHECK: store {{.*}} @_ZTIP11objc_object + // CHECK: store {{.*}} @_ZTI11objc_object + id i = 0; + const std::type_info &t3 = typeid(i); + const std::type_info &t4 = typeid(*i); + + // CHECK: store {{.*}} @_ZTIP10objc_class + // CHECK: store {{.*}} @_ZTI10objc_class + Class c = 0; + const std::type_info &t5 = typeid(c); + const std::type_info &t6 = typeid(*c); + + // CHECK: store {{.*}} @_ZTIP11objc_object + // CHECK: store {{.*}} @_ZTI11objc_object + id<P> i2 = 0; + const std::type_info &t7 = typeid(i2); + const std::type_info &t8 = typeid(*i2); + + // CHECK: store {{.*}} @_ZTIP10objc_class + // CHECK: store {{.*}} @_ZTI10objc_class + Class<P> c2 = 0; + const std::type_info &t9 = typeid(c2); + const std::type_info &t10 = typeid(*c2); +} |