Fariborz Jahanian | 9b4d4fc | 2010-04-28 22:30:33 +0000 | [diff] [blame] | 1 | // RUN: %clang_cc1 %s -triple=x86_64-apple-darwin10 -emit-llvm -o - | FileCheck %s |
| 2 | // CHECK: -[A .cxx_construct] |
| 3 | // CHECK: -[A .cxx_destruct] |
| 4 | |
| 5 | @interface NSObject |
| 6 | - alloc; |
| 7 | - init; |
| 8 | - (void) release; |
| 9 | @end |
| 10 | |
| 11 | extern "C" int printf(const char *, ...); |
| 12 | |
| 13 | int count = 17; |
| 14 | struct X { |
| 15 | X() : value(count++) { printf( "X::X()\n"); } |
| 16 | ~X() { printf( "X::~X()\n"); } |
| 17 | int value; |
| 18 | }; |
| 19 | |
| 20 | struct Y { |
| 21 | Y() : value(count++) { printf( "Y::Y()\n"); } |
| 22 | ~Y() { printf( "Y::~Y()\n"); } |
| 23 | int value; |
| 24 | }; |
| 25 | |
| 26 | @interface Super : NSObject { |
| 27 | Y yvar; |
| 28 | Y yvar1; |
| 29 | Y ya[3]; |
| 30 | } |
| 31 | - (void)finalize; |
| 32 | @end |
| 33 | |
| 34 | @interface A : Super { |
| 35 | X xvar; |
| 36 | X xvar1; |
| 37 | X xvar2; |
| 38 | X xa[2][2]; |
| 39 | } |
| 40 | |
| 41 | - (void)print; |
| 42 | - (void)finalize; |
| 43 | @end |
| 44 | |
| 45 | @implementation Super |
| 46 | - (void)print { |
| 47 | printf( "yvar.value = %d\n", yvar.value); |
| 48 | printf( "yvar1.value = %d\n", yvar1.value); |
| 49 | printf( "ya[0..2] = %d %d %d\n", ya[0].value, ya[1].value, ya[2].value); |
| 50 | } |
| 51 | - (void)finalize {} |
| 52 | @end |
| 53 | |
| 54 | @implementation A |
| 55 | - (void)print { |
| 56 | printf( "xvar.value = %d\n", xvar.value); |
| 57 | printf( "xvar1.value = %d\n", xvar1.value); |
| 58 | printf( "xvar2.value = %d\n", xvar2.value); |
| 59 | printf( "xa[0..1][0..1] = %d %d %d %d\n", |
| 60 | xa[0][0].value, xa[0][1].value, xa[1][0].value, xa[1][1].value); |
| 61 | [super print]; |
| 62 | } |
| 63 | - (void)finalize { [super finalize]; } |
| 64 | @end |
| 65 | |
| 66 | int main() { |
| 67 | A *a = [[A alloc] init]; |
| 68 | [a print]; |
| 69 | [a release]; |
| 70 | } |
| 71 | |
Fariborz Jahanian | 8b688ed | 2010-05-04 19:29:32 +0000 | [diff] [blame^] | 72 | // rdar: // 7468090 |
| 73 | class S { |
| 74 | public: |
| 75 | S& operator = (const S&); |
| 76 | }; |
| 77 | |
| 78 | @interface I { |
| 79 | S position; |
| 80 | } |
| 81 | @property(assign, nonatomic) S position; |
| 82 | @end |
| 83 | |
| 84 | @implementation I |
| 85 | @synthesize position; |
| 86 | @end |