|
@@ -476,7 +476,7 @@ bool ConstStructBuilder::Build(const APValue &Val, const RecordDecl *RD,
|
|
for (RecordDecl::field_iterator Field = RD->field_begin(),
|
|
for (RecordDecl::field_iterator Field = RD->field_begin(),
|
|
FieldEnd = RD->field_end(); Field != FieldEnd; ++Field, ++FieldNo) {
|
|
FieldEnd = RD->field_end(); Field != FieldEnd; ++Field, ++FieldNo) {
|
|
// If this is a union, skip all the fields that aren't being initialized.
|
|
// If this is a union, skip all the fields that aren't being initialized.
|
|
- if (RD->isUnion() && Val.getUnionField() != *Field)
|
|
|
|
|
|
+ if (RD->isUnion() && !declaresSameEntity(Val.getUnionField(), *Field))
|
|
continue;
|
|
continue;
|
|
|
|
|
|
// Don't emit anonymous bitfields, they just affect layout.
|
|
// Don't emit anonymous bitfields, they just affect layout.
|