[objc-gnustep] Fix encoding of ivar size for _Bool.

llvm-svn: 352995
This commit is contained in:
David Chisnall 2019-02-03 15:05:52 +00:00
parent a2a3e5b811
commit ccc42869a7
2 changed files with 5 additions and 5 deletions

View File

@ -1728,7 +1728,6 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
CGM.getContext().getCharWidth());
// struct objc_ivar ivars[]
auto ivarArrayBuilder = ivarListBuilder.beginArray();
CodeGenTypes &Types = CGM.getTypes();
for (const ObjCIvarDecl *IVD = classDecl->all_declared_ivar_begin(); IVD;
IVD = IVD->getNextIvar()) {
auto ivarTy = IVD->getType();
@ -1762,8 +1761,7 @@ class CGObjCGNUstep2 : public CGObjCGNUstep {
ivarBuilder.add(OffsetVar);
// Ivar size
ivarBuilder.addInt(Int32Ty,
td.getTypeSizeInBits(Types.ConvertType(ivarTy)) /
CGM.getContext().getCharWidth());
CGM.getContext().getTypeSizeInChars(ivarTy).getQuantity());
// Alignment will be stored as a base-2 log of the alignment.
int align = llvm::Log2_32(Context.getTypeAlignInChars(ivarTy).getQuantity());
// Objects that require more than 2^64-byte alignment should be impossible!

View File

@ -19,10 +19,12 @@
@package
// CHECK: @__objc_ivar_offset_ANObject._intIvar.i = hidden global i32 16
int _intIvar;
_Bool boolIvar;
}
@end
@implementation ANObject @end
// Check that the ivar metadata contains 3 entries of the correct form and correctly sets the size.
// CHECK: @.objc_ivar_list = private global { i32, i64, [3 x { i8*, i8*, i32*, i32, i32 }] } { i32 3, i64 32,
// Check that we're emitting the extended type encoding for the string ivar.
// CHECK: @.objc_ivar_list = private global { i32, i64, [4 x { i8*, i8*, i32*, i32, i32 }] } { i32 4, i64 32,
// Check that we emit 1 as the size of _Bool, not 0.
// CHECK-SAME: @__objc_ivar_offset_ANObject.boolIvar.B, i32 1, i32 4