mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-02 16:11:08 +03:00
Fixed #6
This commit is contained in:
parent
a41b822420
commit
71a0a968ef
1 changed files with 9 additions and 12 deletions
|
@ -119,24 +119,21 @@ void ReturnStatement::toIR(IRState* p)
|
||||||
// the return type is not void, so this is a normal "register" return
|
// the return type is not void, so this is a normal "register" return
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
LLValue* v;
|
LLValue* v = 0;
|
||||||
|
if (!exp && (p->topfunc() == p->mainFunc)) {
|
||||||
|
v = LLConstant::getNullValue(p->mainFunc->getReturnType());
|
||||||
|
} else {
|
||||||
DValue* dval = exp->toElemDtor(p);
|
DValue* dval = exp->toElemDtor(p);
|
||||||
|
|
||||||
#if DMDV2
|
#if DMDV2
|
||||||
// call postblit if necessary
|
// call postblit if necessary
|
||||||
if (!p->func()->type->isref)
|
if (!p->func()->type->isref)
|
||||||
callPostblitHelper(loc, exp, dval->getRVal());
|
callPostblitHelper(loc, exp, dval->getRVal());
|
||||||
#endif
|
|
||||||
|
|
||||||
if (!exp && (p->topfunc() == p->mainFunc))
|
|
||||||
v = LLConstant::getNullValue(p->mainFunc->getReturnType());
|
|
||||||
else
|
|
||||||
// do abi specific transformations on the return value
|
// do abi specific transformations on the return value
|
||||||
#if DMDV2
|
|
||||||
v = p->func()->type->fty.putRet(exp->type, dval, p->func()->type->isref);
|
v = p->func()->type->fty.putRet(exp->type, dval, p->func()->type->isref);
|
||||||
#else
|
#else
|
||||||
v = p->func()->type->fty.putRet(exp->type, dval);
|
v = p->func()->type->fty.putRet(exp->type, dval);
|
||||||
#endif
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
if (Logger::enabled())
|
if (Logger::enabled())
|
||||||
Logger::cout() << "return value is '" <<*v << "'\n";
|
Logger::cout() << "return value is '" <<*v << "'\n";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue