[clang] [ARM] Empty structs are 1-byte for C++ ABI (PR #124762)

Oliver Stannard via cfe-commits cfe-commits at lists.llvm.org
Wed Jan 29 08:45:51 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));
----------------
ostannard wrote:

This was left over from a previous version, I'll remove it.

https://github.com/llvm/llvm-project/pull/124762


More information about the cfe-commits mailing list