QualType FT = FD->getType();
- // Constant arrays of empty records count as empty, strip them off.
+ // Constant arrays of empty records count as empty, strip them off.
+ // Constant arrays of zero length always count as empty.
if (AllowArrays)
- while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT))
+ while (const ConstantArrayType *AT = Context.getAsConstantArrayType(FT)) {
+ if (AT->getSize() == 0)
+ return true;
FT = AT->getElementType();
+ }
const RecordType *RT = FT->getAs<RecordType>();
if (!RT)
}
// Ignore empty structs/unions.
- if (Ty->isRecordType() && getContext().getTypeSize(Ty) == 0)
+ if (isEmptyRecord(Context, Ty, true))
return ABIArgInfo::getIgnore();
// Expand small (<= 128-bit) record types when we know that the stack layout
__builtin_va_end(ap);
return s.y;
}
+
+// CHECK: define i32 @f64(%struct.s64* nocapture byval align 4 %x)
+struct s64 { signed char a[0]; signed char b[]; };
+void f64(struct s64 x) {}
+
+// CHECK: define float @f65()
+struct s65 { signed char a[0]; float b; };
+struct s65 f65() { return (struct s65){{},2}; }