diff options
| author | Eli Friedman <eli.friedman@gmail.com> | 2012-11-06 21:10:22 +0000 |
|---|---|---|
| committer | Eli Friedman <eli.friedman@gmail.com> | 2012-11-06 21:10:22 +0000 |
| commit | 1e83d6f6123f43d2d2e7c855030e68e74834b2c3 (patch) | |
| tree | a0664fa103e795634482a9646a5f7c5dc057959e /clang | |
| parent | cd47cbc7a44604a65d3ef391822a32b79b2f61e4 (diff) | |
| download | bcm5719-llvm-1e83d6f6123f43d2d2e7c855030e68e74834b2c3.tar.gz bcm5719-llvm-1e83d6f6123f43d2d2e7c855030e68e74834b2c3.zip | |
Fix a silly mistake in r167437.
llvm-svn: 167487
Diffstat (limited to 'clang')
| -rw-r--r-- | clang/lib/CodeGen/CGObjCMac.cpp | 4 | ||||
| -rw-r--r-- | clang/test/CodeGenObjC/ivar-layout-64.m | 52 |
2 files changed, 38 insertions, 18 deletions
diff --git a/clang/lib/CodeGen/CGObjCMac.cpp b/clang/lib/CodeGen/CGObjCMac.cpp index 3b188ec5463..6c0b82bb264 100644 --- a/clang/lib/CodeGen/CGObjCMac.cpp +++ b/clang/lib/CodeGen/CGObjCMac.cpp @@ -2102,7 +2102,7 @@ void CGObjCCommonMac::BuildRCRecordLayout(const llvm::StructLayout *RecLayout, = LastFieldBitfieldOrUnnamed->getBitWidthValue(CGM.getContext()); CharUnits Size = CharUnits::fromQuantity( - (BitFieldSize + ByteSizeInBits) / ByteSizeInBits); + (BitFieldSize + ByteSizeInBits - 1) / ByteSizeInBits); Size += LastBitfieldOrUnnamedOffset; UpdateRunSkipBlockVars(false, getBlockCaptureLifetime(LastFieldBitfieldOrUnnamed->getType()), @@ -4552,7 +4552,7 @@ void CGObjCCommonMac::BuildAggrIvarLayout(const ObjCImplementationDecl *OI, GC_IVAR skivar; skivar.ivar_bytepos = BytePos + LastBitfieldOrUnnamedOffset; skivar.ivar_size = CharUnits::fromQuantity( - (BitFieldSize + ByteSizeInBits) / ByteSizeInBits); + (BitFieldSize + ByteSizeInBits - 1) / ByteSizeInBits); SkipIvars.push_back(skivar); } else { assert(!LastFieldBitfieldOrUnnamed->getIdentifier() &&"Expected unnamed"); diff --git a/clang/test/CodeGenObjC/ivar-layout-64.m b/clang/test/CodeGenObjC/ivar-layout-64.m index ea4cdce4b8b..91a8375e636 100644 --- a/clang/test/CodeGenObjC/ivar-layout-64.m +++ b/clang/test/CodeGenObjC/ivar-layout-64.m @@ -1,15 +1,5 @@ -// RUNX: llvm-gcc -m64 -fobjc-gc -emit-llvm -S -o %t %s && -// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"A\\00"' %t -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\01\\14\\00"' %t -// RUNX: llvm-gcc -ObjC++ -m64 -fobjc-gc -emit-llvm -S -o %t %s && -// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o %t %s -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"A\\00"' %t -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\11q\\10\\00"' %t -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"!q\\00"' %t -// RUN: grep '@"\\01L_OBJC_CLASS_NAME_.*" = internal global .* c"\\01\\14\\00"' %t +// RUN: %clang_cc1 -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s +// RUN: %clang_cc1 -x objective-c++ -triple x86_64-apple-darwin10 -fobjc-gc -emit-llvm -o - %s | FileCheck %s /* @@ -43,6 +33,11 @@ __weak B *f2; @property int p3; @end +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"C\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11p\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!`\00" + + @implementation C @synthesize p3 = _p3; @end @@ -53,8 +48,10 @@ __weak B *f2; @property (assign) __weak id p2; @end -// FIXME: Check layout for this class, once it is clear what the right -// answer is. +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"A\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11q\10\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!q\00" + @implementation A @synthesize p0 = _p0; @synthesize p1 = _p1; @@ -65,8 +62,10 @@ __weak B *f2; @property int p3; @end -// FIXME: Check layout for this class, once it is clear what the right -// answer is. +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"D\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\11p\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"!`\00" + @implementation D @synthesize p3 = _p3; @end @@ -90,5 +89,26 @@ typedef unsigned int FSCatalogInfoBitmap; } @end +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"NSFileLocationComponent\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\01\14\00" + @implementation NSFileLocationComponent @end +@interface NSObject { + id isa; +} +@end + +@interface Foo : NSObject { + id ivar; + + unsigned long bitfield :31; + unsigned long bitfield2 :1; + unsigned long bitfield3 :32; +} +@end + +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"Foo\00" +// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\02\10\00" + +@implementation Foo @end |

