[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)
Eli Friedman via cfe-commits
cfe-commits at lists.llvm.org
Tue Jan 28 11:01:35 PST 2025
================
@@ -752,10 +780,13 @@ RValue ARMABIInfo::EmitVAArg(CodeGenFunction &CGF, Address VAListAddr,
CharUnits SlotSize = CharUnits::fromQuantity(4);
// Empty records are ignored for parameter passing purposes.
- if (isEmptyRecord(getContext(), Ty, true))
+ uint64_t Size = getContext().getTypeSize(Ty);
+ bool IsEmpty = isEmptyRecord(getContext(), Ty, true);
+ if ((IsEmpty || Size == 0) && shouldIgnoreEmptyArg(Ty))
return Slot.asRValue();
- CharUnits TySize = getContext().getTypeSizeInChars(Ty);
+ CharUnits TySize =
+ std::max(getContext().getTypeSizeInChars(Ty), CharUnits::fromQuantity(1));
----------------
efriedma-quic wrote:
If we get here, we know the size isn't zero, I think?
https://github.com/llvm/llvm-project/pull/124762
More information about the cfe-commits
mailing list