Removed TODO-riddled DtoInitializer only used in DtoVarDeclaration.

This commit is contained in:
David Nadlinger 2013-06-02 19:49:44 +02:00
parent 0a7eec400f
commit d9ce9ce67b
2 changed files with 9 additions and 35 deletions

View file

@ -1071,7 +1071,15 @@ void DtoVarDeclaration(VarDeclaration* vd)
if (Logger::enabled())
Logger::cout() << "llvm value for decl: " << *vd->ir.irLocal->value << '\n';
DtoInitializer(vd->ir.irLocal->value, vd->init); // TODO: Remove altogether?
if (vd->init)
{
if (ExpInitializer* ex = vd->init->isExpInitializer())
{
// TODO: Refactor this so that it doesn't look like toElem has no effect.
Logger::println("expression initializer");
ex->exp->toElem(gIR);
}
}
Lexit:
/* Mark the point of construction of a variable that needs to be destructed.
@ -1300,39 +1308,6 @@ LLConstant* DtoConstInitializer(Loc loc, Type* type, Initializer* init)
//////////////////////////////////////////////////////////////////////////////////////////
DValue* DtoInitializer(LLValue* target, Initializer* init)
{
if (!init)
return 0;
if (ExpInitializer* ex = init->isExpInitializer())
{
Logger::println("expression initializer");
assert(ex->exp);
return ex->exp->toElem(gIR);
}
else if (init->isArrayInitializer())
{
// TODO: do nothing ?
}
else if (init->isVoidInitializer())
{
// do nothing
}
else if (init->isStructInitializer())
{
// TODO: again nothing ?
}
else
{
llvm_unreachable("Unknown initializer type.");
}
return 0;
}
//////////////////////////////////////////////////////////////////////////////////////////
static LLConstant* expand_to_sarray(Type *base, Expression* exp)
{
Logger::println("building type %s from expression (%s) of type %s", base->toChars(), exp->toChars(), exp->type->toChars());