• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -emit-llvm -o - %s | FileCheck %s
2
3// CHECK: @"OBJC_IVAR_$_I3._iv2" = global i64 8, section "__DATA, __objc_ivar", align 8
4// CHECK: @"OBJC_IVAR_$_I3._iv3" = global i64 12, section "__DATA, __objc_ivar", align 8
5// CHECK: _OBJC_CLASS_RO_$_I3" = private global {{.*}} { i32 0, i32 8, i32 13
6// CHECK: @"OBJC_IVAR_$_I4._iv4" = global i64 13, section "__DATA, __objc_ivar", align 8
7// CHECK: _OBJC_CLASS_RO_$_I4" = private global {{.*}} { i32 0, i32 13, i32 14, {{.*}}
8// CHECK: @"OBJC_IVAR_$_I5._iv6_synth" = hidden global i64 16, section "__DATA, __objc_ivar", align 8
9// CHECK: @"OBJC_IVAR_$_I5._iv7_synth" = hidden global i64 20, section "__DATA, __objc_ivar", align 8
10// CHECK: @"OBJC_IVAR_$_I5._iv5" = global i64 14, section "__DATA, __objc_ivar", align 8
11// CHECK: _OBJC_CLASS_RO_$_I5" = private global {{.*}} { i32 0, i32 14, i32 24, {{.*}}
12// CHECK: @"OBJC_IVAR_$_I6.iv0" = global i64 0, section "__DATA, __objc_ivar", align 8
13// CHECK: _OBJC_CLASS_RO_$_I6" = private global {{.*}} { i32 2, i32 0, i32 1, {{.*}}
14// CHECK: @"OBJC_IVAR_$_I8.b" = global i64 8, section "__DATA, __objc_ivar", align 8
15// CHECK: _OBJC_CLASS_RO_$_I8" = private global {{.*}} { i32 0, i32 8, i32 16, {{.*}}
16// CHECK: @"OBJC_IVAR_$_I9.iv0" = global i64 0, section "__DATA, __objc_ivar", align 8
17// CHECK: _OBJC_CLASS_RO_$_I9" = private global {{.*}} { i32 2, i32 0, i32 4, {{.*}}
18// CHECK: @"OBJC_IVAR_$_I10.iv1" = global i64 4, section "__DATA, __objc_ivar", align 8
19// CHECK: _OBJC_CLASS_RO_$_I10" = private global {{.*}} { i32 0, i32 4, i32 5, {{.*}}
20// CHECK: _OBJC_CLASS_RO_$_I11" = private global {{.*}} { i32 0, i32 5, i32 5, {{.*}}
21// CHECK: @"OBJC_IVAR_$_I12.iv2" = global i64 8, section "__DATA, __objc_ivar", align 8
22// CHECK: _OBJC_CLASS_RO_$_I12" = private global {{.*}} { i32 0, i32 8, i32 12, {{.*}}
23
24/*
25  Compare to:
26    gcc -m64 -S -o - interface-layout-64.m | grep '^_OBJC_IVAR_$_*{{.*}}' -A 1
27  and
28    gcc -m64 -S -o - interface-layout-64.m | grep '^l{{.*}}_CLASS_RO_$_I[0-9]*' -A 3
29 */
30
31struct s0 {
32  double x;
33};
34
35@interface I2 {
36  struct s0 _iv1;
37}
38@end
39
40@interface I3 : I2 {
41  unsigned int _iv2 :1;
42  unsigned : 0;
43  unsigned int _iv3 : 3;
44}
45@end
46
47@interface I4 : I3 {
48 char _iv4;
49}
50@end
51
52@interface I5 : I4 {
53 char _iv5;
54}
55
56@property int prop0;
57@end
58
59@implementation I3
60@end
61
62@implementation I4
63@end
64
65@interface I5 ()
66@property int prop1;
67@property char prop2;
68@end
69
70@implementation I5
71@synthesize prop0 = _iv6_synth;
72@synthesize prop1 = _iv7_synth;
73@synthesize prop2 = _iv5;
74@end
75
76// The size rounds up to the next available byte.
77@interface I6 {
78  unsigned iv0 : 2;
79}
80@end
81@implementation I6
82@end
83
84// The start of the subclass includes padding for its own alignment.
85@interface I7 {
86  char a;
87}
88@end
89@interface I8 : I7 {
90  double b;
91}
92@end
93@implementation I8
94@end
95
96// Padding bit-fields
97@interface I9 {
98  unsigned iv0 : 2;
99  unsigned : 0;
100}
101@end
102@implementation I9
103@end
104@interface I10 : I9 {
105  unsigned iv1 : 2;
106}
107@end
108@implementation I10
109@end
110
111// Empty structures
112@interface I11 : I10
113@end
114@implementation I11
115@end
116@interface I12 : I11 {
117  unsigned iv2;
118}
119@end
120@implementation I12
121@end
122