Fixed a druntime crash in _d_delclass

This commit is contained in:
Alexey Prokhin 2010-10-31 12:23:35 +03:00
parent bca5491974
commit 2fe6817294
2 changed files with 12 additions and 1 deletions

View file

@ -60,6 +60,12 @@ void DtoDeleteClass(LLValue* inst)
llvm::Function* fn = LLVM_D_GetRuntimeFunction(gIR->module, "_d_delclass");
// build args
LLSmallVector<LLValue*,1> arg;
#if DMDV2
// druntime wants a pointer to object
LLValue *ptr = DtoRawAlloca(inst->getType(), 0, "objectPtr");
DtoStore(inst, ptr);
inst = ptr;
#endif
arg.push_back(DtoBitCast(inst, fn->getFunctionType()->getParamType(0), ".tmp"));
// call
gIR->CreateCallOrInvoke(fn, arg.begin(), arg.end());