Added missing calls of postBlit

This commit is contained in:
Alexey Prokhin
2010-11-04 12:50:19 +03:00
parent d7047f639e
commit 20b2b4b7f5
2 changed files with 35 additions and 0 deletions

View File

@@ -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);

View File

@@ -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)