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