Fix a silly mistake in r167437.

llvm-svn: 167487
This commit is contained in:
Eli Friedman 2012-11-06 21:10:22 +00:00
parent cd47cbc7a4
commit 1e83d6f612
2 changed files with 38 additions and 18 deletions

View File

@ -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");

View File

@ -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