1010//
1111// ===----------------------------------------------------------------------===//
1212
13- #include " CGRecordLayout .h"
13+ #include " ABIInfoImpl .h"
1414#include " CGCXXABI.h"
15+ #include " CGRecordLayout.h"
1516#include " CodeGenTypes.h"
1617#include " clang/AST/ASTContext.h"
1718#include " clang/AST/Attr.h"
@@ -384,7 +385,7 @@ void CGRecordLowering::accumulateFields(bool isNonVirtualBaseType) {
384385 Field = accumulateBitFields (isNonVirtualBaseType, Field, FieldEnd);
385386 assert ((Field == FieldEnd || !Field->isBitField ()) &&
386387 " Failed to accumulate all the bitfields" );
387- } else if (Field-> isZeroSize (Context)) {
388+ } else if (isEmptyFieldForLayout (Context, *Field )) {
388389 // Empty fields have no storage.
389390 ++Field;
390391 } else {
@@ -633,7 +634,7 @@ CGRecordLowering::accumulateBitFields(bool isNonVirtualBaseType,
633634 // non-reusable tail padding.
634635 CharUnits LimitOffset;
635636 for (auto Probe = Field; Probe != FieldEnd; ++Probe)
636- if (!Probe-> isZeroSize (Context)) {
637+ if (!isEmptyFieldForLayout (Context, *Probe )) {
637638 // A member with storage sets the limit.
638639 assert ((getFieldBitOffset (*Probe) % CharBits) == 0 &&
639640 " Next storage is not byte-aligned" );
@@ -731,7 +732,7 @@ void CGRecordLowering::accumulateBases() {
731732 // Bases can be zero-sized even if not technically empty if they
732733 // contain only a trailing array member.
733734 const CXXRecordDecl *BaseDecl = Base.getType ()->getAsCXXRecordDecl ();
734- if (!BaseDecl-> isEmpty ( ) &&
735+ if (!isEmptyRecordForLayout (Context, Base. getType () ) &&
735736 !Context.getASTRecordLayout (BaseDecl).getNonVirtualSize ().isZero ())
736737 Members.push_back (MemberInfo (Layout.getBaseClassOffset (BaseDecl),
737738 MemberInfo::Base, getStorageType (BaseDecl), BaseDecl));
@@ -879,7 +880,7 @@ CGRecordLowering::calculateTailClippingOffset(bool isNonVirtualBaseType) const {
879880 if (!isNonVirtualBaseType && isOverlappingVBaseABI ())
880881 for (const auto &Base : RD->vbases ()) {
881882 const CXXRecordDecl *BaseDecl = Base.getType ()->getAsCXXRecordDecl ();
882- if (BaseDecl-> isEmpty ( ))
883+ if (isEmptyRecordForLayout (Context, Base. getType () ))
883884 continue ;
884885 // If the vbase is a primary virtual base of some base, then it doesn't
885886 // get its own storage location but instead lives inside of that base.
@@ -895,7 +896,7 @@ CGRecordLowering::calculateTailClippingOffset(bool isNonVirtualBaseType) const {
895896void CGRecordLowering::accumulateVBases () {
896897 for (const auto &Base : RD->vbases ()) {
897898 const CXXRecordDecl *BaseDecl = Base.getType ()->getAsCXXRecordDecl ();
898- if (BaseDecl-> isEmpty ( ))
899+ if (isEmptyRecordForLayout (Context, Base. getType () ))
899900 continue ;
900901 CharUnits Offset = Layout.getVBaseClassOffset (BaseDecl);
901902 // If the vbase is a primary virtual base of some base, then it doesn't
@@ -1161,7 +1162,7 @@ CodeGenTypes::ComputeRecordLayout(const RecordDecl *D, llvm::StructType *Ty) {
11611162 const FieldDecl *FD = *it;
11621163
11631164 // Ignore zero-sized fields.
1164- if (FD-> isZeroSize (getContext ()))
1165+ if (isEmptyFieldForLayout (getContext (), FD ))
11651166 continue ;
11661167
11671168 // For non-bit-fields, just check that the LLVM struct offset matches the
0 commit comments