forked from OSchip/llvm-project
Use CharUnits for argument passed to AppendPadding() from AppendBitField().
No change in functionality intended. llvm-svn: 127538
This commit is contained in:
parent
fa453cfdc3
commit
a862d95054
|
@ -124,17 +124,18 @@ AppendField(const FieldDecl *Field, uint64_t FieldOffset,
|
|||
void ConstStructBuilder::AppendBitField(const FieldDecl *Field,
|
||||
uint64_t FieldOffset,
|
||||
llvm::ConstantInt *CI) {
|
||||
const ASTContext &Context = CGM.getContext();
|
||||
if (FieldOffset > NextFieldOffsetInBytes * 8) {
|
||||
// We need to add padding.
|
||||
uint64_t NumBytes =
|
||||
llvm::RoundUpToAlignment(FieldOffset -
|
||||
NextFieldOffsetInBytes * 8, 8) / 8;
|
||||
CharUnits PadSize = Context.toCharUnitsFromBits(
|
||||
llvm::RoundUpToAlignment(FieldOffset - NextFieldOffsetInBytes * 8,
|
||||
Context.Target.getCharAlign()));
|
||||
|
||||
AppendPadding(CharUnits::fromQuantity(NumBytes));
|
||||
AppendPadding(PadSize);
|
||||
}
|
||||
|
||||
uint64_t FieldSize =
|
||||
Field->getBitWidth()->EvaluateAsInt(CGM.getContext()).getZExtValue();
|
||||
Field->getBitWidth()->EvaluateAsInt(Context).getZExtValue();
|
||||
|
||||
llvm::APInt FieldValue = CI->getValue();
|
||||
|
||||
|
|
Loading…
Reference in New Issue