| 1 | // RUN: %clang_cc1 -fobjc-arc -fobjc-runtime-has-weak -triple x86_64-apple-darwin -print-ivar-layout -emit-llvm %s -o %t-64.s | FileCheck -check-prefix CHECK-LP64 %s |
| 2 | // rdar://8991729 |
| 3 | |
| 4 | @interface NSObject { |
| 5 | id isa; |
| 6 | } |
| 7 | @end |
| 8 | |
| 9 | @interface AllPointers : NSObject { |
| 10 | id foo; |
| 11 | id __strong bar; |
| 12 | NSObject *bletch; |
| 13 | } |
| 14 | @end |
| 15 | |
| 16 | @implementation AllPointers |
| 17 | @end |
| 18 | // CHECK-LP64: strong ivar layout for class 'AllPointers': 0x03, 0x00 |
| 19 | |
| 20 | @class NSString, NSNumber; |
| 21 | @interface A : NSObject { |
| 22 | NSString *foo; |
| 23 | NSNumber *bar; |
| 24 | unsigned int bletch; |
| 25 | __weak id delegate; |
| 26 | } |
| 27 | @end |
| 28 | |
| 29 | @interface B : A { |
| 30 | unsigned int x; |
| 31 | NSString *y; |
| 32 | NSString *z; |
| 33 | } |
| 34 | @end |
| 35 | |
| 36 | @implementation A @end |
| 37 | |
| 38 | // CHECK-LP64: strong ivar layout for class 'A': 0x02, 0x00 |
| 39 | // CHECK-LP64: weak ivar layout for class 'A': 0x31, 0x00 |
| 40 | |
| 41 | @implementation B @end |
| 42 | |
| 43 | // CHECK-LP64: strong ivar layout for class 'B': 0x12, 0x00 |
| 44 | |
| 45 | @interface UnsafePerson { |
| 46 | @public |
| 47 | __unsafe_unretained id name; |
| 48 | __unsafe_unretained id age; |
| 49 | id value; |
| 50 | } |
| 51 | @end |
| 52 | |
| 53 | @implementation UnsafePerson @end |
| 54 | |
| 55 | // CHECK-LP64: strong ivar layout for class 'UnsafePerson': 0x21, 0x00 |
| 56 | |
| 57 | // rdar://16136439 |
| 58 | @interface rdar16136439 |
| 59 | @property (nonatomic, readonly, weak) id first; |
| 60 | @end |
| 61 | |
| 62 | @implementation rdar16136439 @end |
| 63 | |
| 64 | // CHECK-LP64: weak ivar layout for class 'rdar16136439': 0x01, 0x00 |
| 65 | |
| 66 | @interface Misalign : NSObject { |
| 67 | char a; |
| 68 | } |
| 69 | @end |
| 70 | |
| 71 | @interface Misaligned : Misalign { |
| 72 | char b; |
| 73 | id x; |
| 74 | } |
| 75 | @end |
| 76 | |
| 77 | @implementation Misaligned @end |
| 78 | |
| 79 | // CHECK-LP64: strong ivar layout for class 'Misaligned': 0x01, 0x00 |
| 80 | |