forked from OSchip/llvm-project
Check whether next slot meets field type's alignment requirements.
If it does not then assert at the moment. llvm-svn: 43576
This commit is contained in:
parent
aaba027717
commit
6029cbf872
|
@ -368,7 +368,10 @@ void RecordOrganizer::layoutStructFields(CodeGenTypes &CGT,
|
||||||
const llvm::Type *Ty = CGT.ConvertType(FD->getType());
|
const llvm::Type *Ty = CGT.ConvertType(FD->getType());
|
||||||
|
|
||||||
uint64_t Offset = RL.getFieldOffset(FieldNo);
|
uint64_t Offset = RL.getFieldOffset(FieldNo);
|
||||||
assert (Offset == Cursor && "FIXME Invalid struct layout");
|
unsigned align = CGT.getTargetData().getABITypeAlignment(Ty);
|
||||||
|
if (Cursor % align != 0)
|
||||||
|
assert (Offset == Cursor && "FIXME Invalid struct layout");
|
||||||
|
|
||||||
Cursor += CGT.getTargetData().getTypeSizeInBits(Ty);
|
Cursor += CGT.getTargetData().getTypeSizeInBits(Ty);
|
||||||
|
|
||||||
Fields.push_back(Ty);
|
Fields.push_back(Ty);
|
||||||
|
|
Loading…
Reference in New Issue