forked from OSchip/llvm-project
Handle zero width bit fields in unions correctly (by ignoring them).
llvm-svn: 76847
This commit is contained in:
parent
697f65943d
commit
f814ee6003
|
@ -160,6 +160,15 @@ void CGRecordLayoutBuilder::LayoutUnion(const RecordDecl *D) {
|
|||
FieldEnd = D->field_end(); Field != FieldEnd; ++Field, ++FieldNo) {
|
||||
assert(Layout.getFieldOffset(FieldNo) == 0 &&
|
||||
"Union field offset did not start at the beginning of record!");
|
||||
|
||||
if (Field->isBitField()) {
|
||||
uint64_t FieldSize =
|
||||
Field->getBitWidth()->EvaluateAsInt(Types.getContext()).getZExtValue();
|
||||
|
||||
// Ignore zero sized bit fields.
|
||||
if (FieldSize == 0)
|
||||
continue;
|
||||
}
|
||||
|
||||
const llvm::Type *FieldTy =
|
||||
Types.ConvertTypeForMemRecursive(Field->getType());
|
||||
|
|
Loading…
Reference in New Issue