mirror of
https://github.com/xomboverlord/ldc.git
synced 2026-01-26 17:43:14 +01:00
Added missing calls of postBlit
This commit is contained in:
@@ -77,6 +77,23 @@ void ReturnStatement::toIR(IRState* p)
|
||||
// store return value
|
||||
DtoAssign(loc, rvar, e);
|
||||
|
||||
#if DMDV2
|
||||
// Call postBlit()
|
||||
Type *tb = exp->type->toBasetype();
|
||||
if ((exp->op == TOKvar || exp->op == TOKdotvar || exp->op == TOKstar) &&
|
||||
tb->ty == Tstruct)
|
||||
{ StructDeclaration *sd = ((TypeStruct *)tb)->sym;
|
||||
if (sd->postblit)
|
||||
{
|
||||
FuncDeclaration *fd = sd->postblit;
|
||||
fd->codegen(Type::sir);
|
||||
Expressions args;
|
||||
DFuncValue dfn(fd, fd->ir.irFunc->func, e->getLVal());
|
||||
DtoCallFunction(loc, Type::basic[Tvoid], &dfn, &args);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
// emit scopes
|
||||
DtoEnclosingHandlers(loc, NULL);
|
||||
|
||||
|
||||
18
gen/toir.cpp
18
gen/toir.cpp
@@ -2592,6 +2592,24 @@ DValue* StructLiteralExp::toElem(IRState* p)
|
||||
|
||||
// store the initializer there
|
||||
DtoAssign(loc, &field, val);
|
||||
|
||||
#if DMDV2
|
||||
Type *tb = vd->type->toBasetype();
|
||||
if (tb->ty == Tstruct)
|
||||
{
|
||||
// Call postBlit()
|
||||
StructDeclaration *sd = ((TypeStruct *)tb)->sym;
|
||||
if (sd->postblit)
|
||||
{
|
||||
FuncDeclaration *fd = sd->postblit;
|
||||
fd->codegen(Type::sir);
|
||||
Expressions args;
|
||||
DFuncValue dfn(fd, fd->ir.irFunc->func, val->getLVal());
|
||||
DtoCallFunction(loc, Type::basic[Tvoid], &dfn, &args);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
// initialize trailing padding
|
||||
if (sd->structsize != offset)
|
||||
|
||||
Reference in New Issue
Block a user