================ @@ -389,14 +389,28 @@ void CGRecordLowering::accumulateFields(bool isNonVirtualBaseType) { // Empty fields have no storage. ++Field; } else { - // Use base subobject layout for the potentially-overlapping field, - // as it is done in RecordLayoutBuilder - Members.push_back(MemberInfo( - bitsToCharUnits(getFieldBitOffset(*Field)), MemberInfo::Field, - Field->isPotentiallyOverlapping() - ? getStorageType(Field->getType()->getAsCXXRecordDecl()) - : getStorageType(*Field), - *Field)); + CharUnits CurOffset = bitsToCharUnits(getFieldBitOffset(*Field)); + llvm::Type *StorageType = getStorageType(*Field); + + // Detect cases when the next field needs to be packed into tail padding + // of a record field. This is typically caused by [[no_unique_address]], + // but we try to infer when that is the case rather than checking for the + // attribute explicitly because the attribute is typically not present in + // debug info. Use the base subobject LLVM struct type in these cases, ---------------- efriedma-quic wrote:
Maybe state more explicitly that this is an issue when the class layout is computed from debug info? https://github.com/llvm/llvm-project/pull/122197 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits