[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:36 PST 2025
================
@@ -366,9 +387,15 @@ ABIArgInfo ARMABIInfo::classifyArgumentType(QualType Ty, bool isVariadic,
return getNaturalAlignIndirect(Ty, RAA == CGCXXABI::RAA_DirectInMemory);
}
- // Ignore empty records.
- if (isEmptyRecord(getContext(), Ty, true))
- return ABIArgInfo::getIgnore();
+ // Empty records are either ignored completely or passed as if they were a
+ // 1-byte object, depending on the ABI and language standard.
+ if (isEmptyRecord(getContext(), Ty, true) ||
+ getContext().getTypeSize(Ty) == 0) {
+ if (shouldIgnoreEmptyArg(Ty))
----------------
efriedma-quic wrote:
I think I'd prefer to write this something like:
```
if (size == zero)
return getIgnore();
if (isempty() && isWatchOS())
return getIgnore();
```
This should be equivalent because an empty struct in C is size zero anyway.
https://github.com/llvm/llvm-project/pull/124762
More information about the cfe-commits
mailing list