Merge pull request #1082 from klickverbot/empty-structs-linux

x86: Only skip empty structs on OS X
This commit is contained in:
Kai Nacke 2015-09-19 18:12:33 +02:00
commit dc8ff497ac
2 changed files with 25 additions and 11 deletions

View file

@ -164,17 +164,6 @@ llvm::FunctionType* DtoFunctionType(Type* type, IrFuncTy &irFty, Type* thistype,
}
else if (!passPointer)
{
if (loweredDType->toBasetype()->ty == Tstruct)
{
// Do not pass empty structs at all for C++ ABI compatibility.
// Tests with clang reveal that more complex "empty" types, for
// example a struct containing an empty struct, are not
// optimized in the same way.
StructDeclaration *sd =
static_cast<TypeStruct*>(loweredDType->toBasetype())->sym;
if (sd->fields.empty()) continue;
}
if (abi->passByVal(loweredDType))
{
attrBuilder.add(LDC_ATTRIBUTE(ByVal));