aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenObjC
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2009-04-22 03:45:12 +0000
committerDaniel Dunbar <daniel@zuster.org>2009-04-22 03:45:12 +0000
commit0c45793173ebdf15ba7345a1f71919c47abbeed0 (patch)
tree7a266c9216d7cbf61c0ca3923c5922d18af4580c /test/CodeGenObjC
parent3936024941229e235aed7f53949a117a54eebf68 (diff)
Rework the shadow struct that is layed out for Objective-C classes.
- Superclasses are now always laid out their shadow structure at the first field. - Prior to this, the entire class heirarchy was flattened into a single structure which meant that alignment, padding, and bitfields weren't packed correctly (the ASTRecordLayout was correct however, which meant our debug info didn't coincide with ivar offsets, for example). - This is still very suboptimal, but I believe the ivar layout itself is now at least close to correct. - <rdar://problem/6773388> error: objc[29823]: layout bitmap sliding backwards git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@69771 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/CodeGenObjC')
-rw-r--r--test/CodeGenObjC/ivar-layout-64.m56
1 files changed, 56 insertions, 0 deletions
diff --git a/test/CodeGenObjC/ivar-layout-64.m b/test/CodeGenObjC/ivar-layout-64.m
new file mode 100644
index 0000000000..57f89b4787
--- /dev/null
+++ b/test/CodeGenObjC/ivar-layout-64.m
@@ -0,0 +1,56 @@
+// RUN: clang-cc -triple x86_64-apple-darwin9 -emit-llvm -o %t %s &&
+// RUNX: llvm-gcc -m64 -emit-llvm -S -o %t %s &&
+
+// RUN: grep '@"OBJC_IVAR_$_I3._iv2" = global i64 8, section "__DATA, __objc_const", align 8' %t &&
+// RUN: grep '@"OBJC_IVAR_$_I3._iv3" = global i64 12, section "__DATA, __objc_const", align 8' %t &&
+// RUN: grep '@"OBJC_IVAR_$_I4._iv4" = global i64 16, section "__DATA, __objc_const", align 8' %t &&
+// RUN: grep '@"OBJC_IVAR_$_I5._iv5" = global i64 24, section "__DATA, __objc_const", align 8' %t &&
+// RUN: grep '@"OBJC_IVAR_$_I5._iv6_synth" = global i64 28, section "__DATA, __objc_const", align 8' %t &&
+// RUN: grep '@"OBJC_IVAR_$_I5._iv7_synth" = global i64 32, section "__DATA, __objc_const", align 8' %t &&
+
+// RUN: true
+
+struct s0 {
+ double x;
+};
+
+@interface I2 {
+ struct s0 _iv1;
+}
+@end
+
+@interface I3 : I2 {
+ unsigned int _iv2 :1;
+ unsigned : 0;
+ unsigned int _iv3 : 3;
+}
+@end
+
+@interface I4 : I3 {
+ char _iv4;
+}
+@end
+
+@interface I5 : I4 {
+ char _iv5;
+}
+
+@property int prop0;
+@end
+
+@implementation I3
+@end
+
+@implementation I4
+@end
+
+@interface I5 ()
+@property int prop1;
+@property char prop2;
+@end
+
+@implementation I5
+@synthesize prop0 = _iv6_synth;
+@synthesize prop1 = _iv7_synth;
+@synthesize prop2 = _iv5;
+@end