@@ -4511,6 +4511,8 @@ void ASTContext::getObjCEncodingForStructureImpl(RecordDecl *RDecl,
4511
4511
BE = CXXRec->bases_end (); BI != BE; ++BI) {
4512
4512
if (!BI->isVirtual ()) {
4513
4513
CXXRecordDecl *base = BI->getType ()->getAsCXXRecordDecl ();
4514
+ if (base->isEmpty ())
4515
+ continue ;
4514
4516
uint64_t offs = layout.getBaseClassOffsetInBits (base);
4515
4517
FieldOrBaseOffsets.insert (FieldOrBaseOffsets.upper_bound (offs),
4516
4518
std::make_pair (offs, base));
@@ -4532,6 +4534,8 @@ void ASTContext::getObjCEncodingForStructureImpl(RecordDecl *RDecl,
4532
4534
BI = CXXRec->vbases_begin (),
4533
4535
BE = CXXRec->vbases_end (); BI != BE; ++BI) {
4534
4536
CXXRecordDecl *base = BI->getType ()->getAsCXXRecordDecl ();
4537
+ if (base->isEmpty ())
4538
+ continue ;
4535
4539
uint64_t offs = layout.getVBaseClassOffsetInBits (base);
4536
4540
FieldOrBaseOffsets.insert (FieldOrBaseOffsets.upper_bound (offs),
4537
4541
std::make_pair (offs, base));
@@ -4595,8 +4599,8 @@ void ASTContext::getObjCEncodingForStructureImpl(RecordDecl *RDecl,
4595
4599
// expands virtual bases each time one is encountered in the hierarchy,
4596
4600
// making the encoding type bigger than it really is.
4597
4601
getObjCEncodingForStructureImpl (base, S, FD, /* includeVBases*/ false );
4598
- if (!base->isEmpty ())
4599
- CurOffs += toBits (getASTRecordLayout (base).getNonVirtualSize ());
4602
+ assert (!base->isEmpty ());
4603
+ CurOffs += toBits (getASTRecordLayout (base).getNonVirtualSize ());
4600
4604
} else {
4601
4605
FieldDecl *field = cast<FieldDecl>(dcl);
4602
4606
if (FD) {
0 commit comments