@@ -385,7 +385,7 @@ void CGRecordLowering::accumulateFields(bool isNonVirtualBaseType) {
385
385
Field = accumulateBitFields (isNonVirtualBaseType, Field, FieldEnd);
386
386
assert ((Field == FieldEnd || !Field->isBitField ()) &&
387
387
" Failed to accumulate all the bitfields" );
388
- } else if (isEmptyField (Context, *Field, false , true )) {
388
+ } else if (isEmptyFieldForLayout (Context, *Field)) {
389
389
// Empty fields have no storage.
390
390
++Field;
391
391
} else {
@@ -635,9 +635,7 @@ CGRecordLowering::accumulateBitFields(bool isNonVirtualBaseType,
635
635
// non-reusable tail padding.
636
636
CharUnits LimitOffset;
637
637
for (auto Probe = Field; Probe != FieldEnd; ++Probe)
638
- if (!Probe->isZeroLengthBitField (Context) &&
639
- !(isEmptyField (Context, *Probe, false , true ) &&
640
- !Probe->isBitField ())) {
638
+ if (!isEmptyFieldForLayout (Context, *Probe)) {
641
639
// A member with storage sets the limit.
642
640
assert ((getFieldBitOffset (*Probe) % CharBits) == 0 &&
643
641
" Next storage is not byte-aligned" );
@@ -735,7 +733,7 @@ void CGRecordLowering::accumulateBases() {
735
733
// Bases can be zero-sized even if not technically empty if they
736
734
// contain only a trailing array member.
737
735
const CXXRecordDecl *BaseDecl = Base.getType ()->getAsCXXRecordDecl ();
738
- if (!isEmptyRecord (Context, Base.getType (), false , true ) &&
736
+ if (!isEmptyRecordForLayout (Context, Base.getType ()) &&
739
737
!Context.getASTRecordLayout (BaseDecl).getNonVirtualSize ().isZero ())
740
738
Members.push_back (MemberInfo (Layout.getBaseClassOffset (BaseDecl),
741
739
MemberInfo::Base, getStorageType (BaseDecl), BaseDecl));
@@ -883,7 +881,7 @@ CGRecordLowering::calculateTailClippingOffset(bool isNonVirtualBaseType) const {
883
881
if (!isNonVirtualBaseType && isOverlappingVBaseABI ())
884
882
for (const auto &Base : RD->vbases ()) {
885
883
const CXXRecordDecl *BaseDecl = Base.getType ()->getAsCXXRecordDecl ();
886
- if (isEmptyRecord (Context, Base.getType (), false , true ))
884
+ if (isEmptyRecordForLayout (Context, Base.getType ()))
887
885
continue ;
888
886
// If the vbase is a primary virtual base of some base, then it doesn't
889
887
// get its own storage location but instead lives inside of that base.
@@ -899,7 +897,7 @@ CGRecordLowering::calculateTailClippingOffset(bool isNonVirtualBaseType) const {
899
897
void CGRecordLowering::accumulateVBases () {
900
898
for (const auto &Base : RD->vbases ()) {
901
899
const CXXRecordDecl *BaseDecl = Base.getType ()->getAsCXXRecordDecl ();
902
- if (isEmptyRecord (Context, Base.getType (), false , true ))
900
+ if (isEmptyRecordForLayout (Context, Base.getType ()))
903
901
continue ;
904
902
CharUnits Offset = Layout.getVBaseClassOffset (BaseDecl);
905
903
// If the vbase is a primary virtual base of some base, then it doesn't
@@ -1165,8 +1163,7 @@ CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, llvm::StructType *Ty) {
1165
1163
const FieldDecl *FD = *it;
1166
1164
1167
1165
// Ignore zero-sized fields.
1168
- if (FD->isZeroLengthBitField (Context) ||
1169
- (isEmptyField (Context, FD, false , true ) && !FD->isBitField ()))
1166
+ if (isEmptyFieldForLayout (getContext (), FD))
1170
1167
continue ;
1171
1168
1172
1169
// For non-bit-fields, just check that the LLVM struct offset matches the
0 commit comments