diff --git a/gen/llvmhelpers.cpp b/gen/llvmhelpers.cpp index cfd88b63..bee487f1 100644 --- a/gen/llvmhelpers.cpp +++ b/gen/llvmhelpers.cpp @@ -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()); diff --git a/gen/llvmhelpers.h b/gen/llvmhelpers.h index f5b89f8a..483e24c7 100644 --- a/gen/llvmhelpers.h +++ b/gen/llvmhelpers.h @@ -116,7 +116,6 @@ LLValue* DtoRawVarDeclaration(VarDeclaration* var, LLValue* addr = 0); // initializer helpers LLConstant* DtoConstInitializer(Loc loc, Type* type, Initializer* init); LLConstant* DtoConstExpInit(Loc loc, Type* t, Expression* exp); -DValue* DtoInitializer(LLValue* target, Initializer* init); // getting typeinfo of type, base=true casts to object.TypeInfo LLConstant* DtoTypeInfoOf(Type* ty, bool base=true);