1 // RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s
2 // RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s
6 Here is a handy command for looking at llvm-gcc's output:
7 llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o - ivar-layout-64.m | \
8 grep 'OBJC_CLASS_NAME.* =.*global' | \
9 sed -e 's#, section.*# ...#' | \
10 sed -e 's#_[0-9]*"#_NNN#' | \
36 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"C\00"
37 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\11p\00"
38 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!`\00"
47 @property (assign) __strong id p1;
48 @property (assign) __weak id p2;
51 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"A\00"
52 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\11q\10\00"
53 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!q\00"
65 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"D\00"
66 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\11p\00"
67 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!`\00"
73 typedef unsigned short UInt16;
76 typedef signed char BOOL;
77 typedef unsigned int FSCatalogInfoBitmap;
79 @interface NSFileLocationComponent {
82 id _specifierOrStandardizedPath;
83 BOOL _carbonCatalogInfoAndNameAreValid;
84 FSCatalogInfoBitmap _carbonCatalogInfoMask;
86 id _containerComponent;
88 id _iconAsAttributedString;
92 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"NSFileLocationComponent\00"
93 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\01\14\00"
95 @implementation NSFileLocationComponent @end
102 @interface Foo : NSObject {
105 unsigned long bitfield :31;
106 unsigned long bitfield2 :1;
107 unsigned long bitfield3 :32;
111 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"Foo\00"
112 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\02\10\00"
114 @implementation Foo @end
116 // GC layout strings aren't capable of expressing __strong ivars at
117 // non-word alignments.
118 struct __attribute__((packed)) PackedStruct {
122 @interface Packed : NSObject {
123 struct PackedStruct _packed;
126 @implementation Packed @end
127 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"Packed\00"
128 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\01 \00"
131 // Ensure that layout descends into anonymous unions and structs.
132 // Hilariously, anonymous unions and structs that appear directly as ivars
133 // are completely ignored by layout.
135 @interface AnonymousUnion : NSObject {
144 @implementation AnonymousUnion @end
145 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"AnonymousUnion\00"
146 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\02\00"
148 @interface AnonymousStruct : NSObject {
157 @implementation AnonymousStruct @end
158 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"AnonymousStruct\00"
159 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"\02\10\00"
160 // CHECK: @OBJC_CLASS_NAME_{{.*}} = private unnamed_addr constant {{.*}} c"!\00"