1f4a2713aSLionel Sambuc// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s 2f4a2713aSLionel Sambuc// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s 3f4a2713aSLionel Sambuc 4f4a2713aSLionel Sambuc/* 5f4a2713aSLionel Sambuc 6f4a2713aSLionel SambucHere is a handy command for looking at llvm-gcc's output: 7f4a2713aSLionel Sambucllvm-gcc -m64 -fobjc-gc -emit-llvm -S -o - ivar-layout-64.m | \ 8f4a2713aSLionel Sambuc grep 'OBJC_CLASS_NAME.* =.*global' | \ 9f4a2713aSLionel Sambuc sed -e 's#, section.*# ...#' | \ 10f4a2713aSLionel Sambuc sed -e 's#_[0-9]*"#_NNN#' | \ 11f4a2713aSLionel Sambuc sort 12f4a2713aSLionel Sambuc 13f4a2713aSLionel Sambuc*/ 14f4a2713aSLionel Sambuc 15f4a2713aSLionel Sambuc@interface B @end 16f4a2713aSLionel Sambuc 17f4a2713aSLionel Sambuc@interface A { 18f4a2713aSLionel Sambuc struct s0 { 19f4a2713aSLionel Sambuc int f0; 20f4a2713aSLionel Sambuc int f1; 21f4a2713aSLionel Sambuc } f0; 22f4a2713aSLionel Sambuc id f1; 23f4a2713aSLionel Sambuc__weak B *f2; 24f4a2713aSLionel Sambuc int f3 : 5; 25f4a2713aSLionel Sambuc struct s1 { 26f4a2713aSLionel Sambuc int *f0; 27f4a2713aSLionel Sambuc int *f1; 28f4a2713aSLionel Sambuc } f4[2][1]; 29f4a2713aSLionel Sambuc} 30f4a2713aSLionel Sambuc@end 31f4a2713aSLionel Sambuc 32f4a2713aSLionel Sambuc@interface C : A 33f4a2713aSLionel Sambuc@property int p3; 34f4a2713aSLionel Sambuc@end 35f4a2713aSLionel Sambuc 36*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"C\00" 37*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\11p\00" 38*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"!`\00" 39f4a2713aSLionel Sambuc 40f4a2713aSLionel Sambuc 41f4a2713aSLionel Sambuc@implementation C 42f4a2713aSLionel Sambuc@synthesize p3 = _p3; 43f4a2713aSLionel Sambuc@end 44f4a2713aSLionel Sambuc 45f4a2713aSLionel Sambuc@interface A() 46f4a2713aSLionel Sambuc@property int p0; 47f4a2713aSLionel Sambuc@property (assign) __strong id p1; 48f4a2713aSLionel Sambuc@property (assign) __weak id p2; 49f4a2713aSLionel Sambuc@end 50f4a2713aSLionel Sambuc 51*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"A\00" 52*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\11q\10\00" 53*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"!q\00" 54f4a2713aSLionel Sambuc 55f4a2713aSLionel Sambuc@implementation A 56f4a2713aSLionel Sambuc@synthesize p0 = _p0; 57f4a2713aSLionel Sambuc@synthesize p1 = _p1; 58f4a2713aSLionel Sambuc@synthesize p2 = _p2; 59f4a2713aSLionel Sambuc@end 60f4a2713aSLionel Sambuc 61f4a2713aSLionel Sambuc@interface D : A 62f4a2713aSLionel Sambuc@property int p3; 63f4a2713aSLionel Sambuc@end 64f4a2713aSLionel Sambuc 65*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"D\00" 66*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\11p\00" 67*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"!`\00" 68f4a2713aSLionel Sambuc 69f4a2713aSLionel Sambuc@implementation D 70f4a2713aSLionel Sambuc@synthesize p3 = _p3; 71f4a2713aSLionel Sambuc@end 72f4a2713aSLionel Sambuc 73f4a2713aSLionel Sambuctypedef unsigned short UInt16; 74f4a2713aSLionel Sambuc 75f4a2713aSLionel Sambuc 76f4a2713aSLionel Sambuctypedef signed char BOOL; 77f4a2713aSLionel Sambuctypedef unsigned int FSCatalogInfoBitmap; 78f4a2713aSLionel Sambuc 79f4a2713aSLionel Sambuc@interface NSFileLocationComponent { 80f4a2713aSLionel Sambuc @private 81f4a2713aSLionel Sambuc 82f4a2713aSLionel Sambuc id _specifierOrStandardizedPath; 83f4a2713aSLionel Sambuc BOOL _carbonCatalogInfoAndNameAreValid; 84f4a2713aSLionel Sambuc FSCatalogInfoBitmap _carbonCatalogInfoMask; 85f4a2713aSLionel Sambuc id _name; 86f4a2713aSLionel Sambuc id _containerComponent; 87f4a2713aSLionel Sambuc id _presentableName; 88f4a2713aSLionel Sambuc id _iconAsAttributedString; 89f4a2713aSLionel Sambuc} 90f4a2713aSLionel Sambuc@end 91f4a2713aSLionel Sambuc 92*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"NSFileLocationComponent\00" 93*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\01\14\00" 94f4a2713aSLionel Sambuc 95f4a2713aSLionel Sambuc@implementation NSFileLocationComponent @end 96f4a2713aSLionel Sambuc 97f4a2713aSLionel Sambuc@interface NSObject { 98f4a2713aSLionel Sambuc id isa; 99f4a2713aSLionel Sambuc} 100f4a2713aSLionel Sambuc@end 101f4a2713aSLionel Sambuc 102f4a2713aSLionel Sambuc@interface Foo : NSObject { 103f4a2713aSLionel Sambuc id ivar; 104f4a2713aSLionel Sambuc 105f4a2713aSLionel Sambuc unsigned long bitfield :31; 106f4a2713aSLionel Sambuc unsigned long bitfield2 :1; 107f4a2713aSLionel Sambuc unsigned long bitfield3 :32; 108f4a2713aSLionel Sambuc} 109f4a2713aSLionel Sambuc@end 110f4a2713aSLionel Sambuc 111*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"Foo\00" 112*0a6a1f1dSLionel Sambuc// CHECK: @OBJC_CLASS_NAME_{{.*}} = private global {{.*}} c"\02\10\00" 113f4a2713aSLionel Sambuc 114f4a2713aSLionel Sambuc@implementation Foo @end 115