1*f4a2713aSLionel Sambuc// RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s 2*f4a2713aSLionel Sambuc// CHECK: -[A .cxx_construct] 3*f4a2713aSLionel Sambuc// CHECK: -[A .cxx_destruct] 4*f4a2713aSLionel Sambuc// CHECK: -[B .cxx_construct] 5*f4a2713aSLionel Sambuc// CHECK-NOT: -[B .cxx_destruct] 6*f4a2713aSLionel Sambuc// CHECK-NOT: -[C .cxx_construct] 7*f4a2713aSLionel Sambuc// CHECK: -[C .cxx_destruct] 8*f4a2713aSLionel Sambuc 9*f4a2713aSLionel Sambuc@interface NSObject 10*f4a2713aSLionel Sambuc- alloc; 11*f4a2713aSLionel Sambuc- init; 12*f4a2713aSLionel Sambuc- (void) release; 13*f4a2713aSLionel Sambuc@end 14*f4a2713aSLionel Sambuc 15*f4a2713aSLionel Sambucextern "C" int printf(const char *, ...); 16*f4a2713aSLionel Sambuc 17*f4a2713aSLionel Sambucint count = 17; 18*f4a2713aSLionel Sambucstruct X { 19*f4a2713aSLionel Sambuc X() : value(count++) { printf( "X::X()\n"); } 20*f4a2713aSLionel Sambuc ~X() { printf( "X::~X()\n"); } 21*f4a2713aSLionel Sambuc int value; 22*f4a2713aSLionel Sambuc}; 23*f4a2713aSLionel Sambuc 24*f4a2713aSLionel Sambucstruct Y { 25*f4a2713aSLionel Sambuc Y() : value(count++) { printf( "Y::Y()\n"); } 26*f4a2713aSLionel Sambuc ~Y() { printf( "Y::~Y()\n"); } 27*f4a2713aSLionel Sambuc int value; 28*f4a2713aSLionel Sambuc}; 29*f4a2713aSLionel Sambuc 30*f4a2713aSLionel Sambuc@interface Super : NSObject { 31*f4a2713aSLionel Sambuc Y yvar; 32*f4a2713aSLionel Sambuc Y yvar1; 33*f4a2713aSLionel Sambuc Y ya[3]; 34*f4a2713aSLionel Sambuc} 35*f4a2713aSLionel Sambuc- (void)finalize; 36*f4a2713aSLionel Sambuc@end 37*f4a2713aSLionel Sambuc 38*f4a2713aSLionel Sambuc@interface A : Super { 39*f4a2713aSLionel Sambuc X xvar; 40*f4a2713aSLionel Sambuc X xvar1; 41*f4a2713aSLionel Sambuc X xvar2; 42*f4a2713aSLionel Sambuc X xa[2][2]; 43*f4a2713aSLionel Sambuc} 44*f4a2713aSLionel Sambuc 45*f4a2713aSLionel Sambuc- (void)print; 46*f4a2713aSLionel Sambuc- (void)finalize; 47*f4a2713aSLionel Sambuc@end 48*f4a2713aSLionel Sambuc 49*f4a2713aSLionel Sambuc@implementation Super 50*f4a2713aSLionel Sambuc- (void)print { 51*f4a2713aSLionel Sambuc printf( "yvar.value = %d\n", yvar.value); 52*f4a2713aSLionel Sambuc printf( "yvar1.value = %d\n", yvar1.value); 53*f4a2713aSLionel Sambuc printf( "ya[0..2] = %d %d %d\n", ya[0].value, ya[1].value, ya[2].value); 54*f4a2713aSLionel Sambuc} 55*f4a2713aSLionel Sambuc- (void)finalize {} 56*f4a2713aSLionel Sambuc@end 57*f4a2713aSLionel Sambuc 58*f4a2713aSLionel Sambuc@implementation A 59*f4a2713aSLionel Sambuc- (void)print { 60*f4a2713aSLionel Sambuc printf( "xvar.value = %d\n", xvar.value); 61*f4a2713aSLionel Sambuc printf( "xvar1.value = %d\n", xvar1.value); 62*f4a2713aSLionel Sambuc printf( "xvar2.value = %d\n", xvar2.value); 63*f4a2713aSLionel Sambuc printf( "xa[0..1][0..1] = %d %d %d %d\n", 64*f4a2713aSLionel Sambuc xa[0][0].value, xa[0][1].value, xa[1][0].value, xa[1][1].value); 65*f4a2713aSLionel Sambuc [super print]; 66*f4a2713aSLionel Sambuc} 67*f4a2713aSLionel Sambuc- (void)finalize { [super finalize]; } 68*f4a2713aSLionel Sambuc@end 69*f4a2713aSLionel Sambuc 70*f4a2713aSLionel Sambucint main() { 71*f4a2713aSLionel Sambuc A *a = [[A alloc] init]; 72*f4a2713aSLionel Sambuc [a print]; 73*f4a2713aSLionel Sambuc [a release]; 74*f4a2713aSLionel Sambuc} 75*f4a2713aSLionel Sambuc 76*f4a2713aSLionel Sambuc// rdar: // 7468090 77*f4a2713aSLionel Sambucclass S { 78*f4a2713aSLionel Sambucpublic: 79*f4a2713aSLionel Sambuc S& operator = (const S&); 80*f4a2713aSLionel Sambuc}; 81*f4a2713aSLionel Sambuc 82*f4a2713aSLionel Sambuc@interface I { 83*f4a2713aSLionel Sambuc S position; 84*f4a2713aSLionel Sambuc} 85*f4a2713aSLionel Sambuc@property(assign, nonatomic) S position; 86*f4a2713aSLionel Sambuc@end 87*f4a2713aSLionel Sambuc 88*f4a2713aSLionel Sambuc@implementation I 89*f4a2713aSLionel Sambuc @synthesize position; 90*f4a2713aSLionel Sambuc@end 91*f4a2713aSLionel Sambuc 92*f4a2713aSLionel Sambuc// This class should have a .cxx_construct but no .cxx_destruct. 93*f4a2713aSLionel Sambucnamespace test3 { struct S { S(); }; } 94*f4a2713aSLionel Sambuc@implementation B { 95*f4a2713aSLionel Sambuc test3::S s; 96*f4a2713aSLionel Sambuc} 97*f4a2713aSLionel Sambuc@end 98*f4a2713aSLionel Sambuc 99*f4a2713aSLionel Sambuc// This class should have a .cxx_destruct but no .cxx_construct. 100*f4a2713aSLionel Sambucnamespace test4 { struct S { ~S(); }; } 101*f4a2713aSLionel Sambuc@implementation C { 102*f4a2713aSLionel Sambuc test4::S s; 103*f4a2713aSLionel Sambuc} 104*f4a2713aSLionel Sambuc@end 105