[svn r369] Fix nested classes when nestedVar is not generated.

This commit is contained in:
Christian Kamm
2008-07-13 21:16:40 +02:00
parent dbd640a3dc
commit c2697dbce0

View File

@@ -837,9 +837,14 @@ DValue* DtoNewClass(TypeClass* tc, NewExp* newexp)
{
Logger::println("Resolving nested context");
LOG_SCOPE;
// this value might be zero if it was not necessary to generate it ...
LLValue* nest = gIR->func()->nestedVar;
// ... then revert to the this ptr if there is one
if (!nest)
nest = gIR->func()->thisVar;
// ... or just use zero, since it must be unused.
if (!nest)
nest = llvm::ConstantPointerNull::get(getVoidPtrType());
assert(nest);
LLValue* gep = DtoGEPi(mem,0,2,"tmp");
nest = DtoBitCast(nest, gep->getType()->getContainedType(0));