diff options
author | John McCall <rjmccall@apple.com> | 2015-11-19 02:27:55 +0000 |
---|---|---|
committer | John McCall <rjmccall@apple.com> | 2015-11-19 02:27:55 +0000 |
commit | d80218fa4221c76fa1b822a406253921d4c7f8fc (patch) | |
tree | 175bcce0f7357453b5f5fe2994370e9e3a058135 /clang/test/CodeGenObjC | |
parent | 61fcb521fa1dd3426b653818fd315f9e542fc12b (diff) | |
download | bcm5719-llvm-d80218fa4221c76fa1b822a406253921d4c7f8fc.tar.gz bcm5719-llvm-d80218fa4221c76fa1b822a406253921d4c7f8fc.zip |
Fix the emission of ARC-style ivar layouts in the fragile runtime
to start at the offset of the first ivar instead of the rounded-up
end of the superclass. The latter could include a large amount of
tail padding because of a highly-aligned ivar, and subclass ivars
can be laid out within that.
llvm-svn: 253533
Diffstat (limited to 'clang/test/CodeGenObjC')
-rw-r--r-- | clang/test/CodeGenObjC/mrc-weak.m | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/clang/test/CodeGenObjC/mrc-weak.m b/clang/test/CodeGenObjC/mrc-weak.m index f9c4ff1b123..9072b1a0832 100644 --- a/clang/test/CodeGenObjC/mrc-weak.m +++ b/clang/test/CodeGenObjC/mrc-weak.m @@ -6,6 +6,26 @@ - (void) run; @end +// The ivars in HighlyAlignedSubclass should be placed in the tail-padding +// of the superclass. Ensure that they're still covered by layouts. +@interface HighlyAligned : Object { + __attribute__((aligned(32))) void *array[2]; +} +@end +// CHECK-MODERN: @"OBJC_IVAR_$_HighlyAlignedSubclass.ivar2" = global i64 24, +// CHECK-MODERN: @"OBJC_IVAR_$_HighlyAlignedSubclass.ivar" = global i64 16, +// CHECK-MODERN: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\02\00" +// CHECK-MODERN: @"\01l_OBJC_CLASS_RO_$_HighlyAlignedSubclass" = {{.*}} { +// CHECK-FRAGILE: @OBJC_INSTANCE_VARIABLES_HighlyAlignedSubclass = {{.*}}, i32 8 }, {{.*}}, i32 12 }] +// CHECK-FRAGILE: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\02\00" +// CHECK-FRAGILE: @OBJC_CLASS_HighlyAlignedSubclass +@interface HighlyAlignedSubclass : HighlyAligned { + __weak id ivar; + __weak id ivar2; +} +@end +@implementation HighlyAlignedSubclass @end + // CHECK-MODERN: @OBJC_CLASS_NAME_{{.*}} = {{.*}} c"\01\00" // CHECK-MODERN: @"\01l_OBJC_CLASS_RO_$_Foo" = {{.*}} { i32 772 // 772 == 0x304 |