[cfe-commits] r167487 - in /cfe/trunk: lib/CodeGen/CGObjCMac.cpp test/CodeGenObjC/ivar-layout-64.m
Eli Friedman
eli.friedman at gmail.com
Tue Nov 6 13:10:22 PST 2012
Author: efriedma
Date: Tue Nov 6 15:10:22 2012
New Revision: 167487
URL: http://llvm.org/viewvc/llvm-project?rev=167487&view=rev
Log:
Fix a silly mistake in r167437.
Modified:
cfe/trunk/lib/CodeGen/CGObjCMac.cpp
cfe/trunk/test/CodeGenObjC/ivar-layout-64.m
Modified: cfe/trunk/lib/CodeGen/CGObjCMac.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGObjCMac.cpp?rev=167487&r1=167486&r2=167487&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGObjCMac.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGObjCMac.cpp Tue Nov 6 15:10:22 2012
@@ -2102,7 +2102,7 @@
= 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 @@
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");
Modified: cfe/trunk/test/CodeGenObjC/ivar-layout-64.m
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/test/CodeGenObjC/ivar-layout-64.m?rev=167487&r1=167486&r2=167487&view=diff
==============================================================================
--- cfe/trunk/test/CodeGenObjC/ivar-layout-64.m (original)
+++ cfe/trunk/test/CodeGenObjC/ivar-layout-64.m Tue Nov 6 15:10:22 2012
@@ -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 @@
@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 @@
@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 @@
@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 @@
}
@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
+ at interface NSObject {
+ id isa;
+}
+ at end
+
+ at interface Foo : NSObject {
+ id ivar;
+
+ unsigned long bitfield :31;
+ unsigned long bitfield2 :1;
+ unsigned long bitfield3 :32;
+}
+ at end
+
+// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"Foo\00"
+// CHECK: @"\01L_OBJC_CLASS_NAME_{{.*}}" = internal global {{.*}} c"\02\10\00"
+
+ at implementation Foo @end
More information about the cfe-commits
mailing list