mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-14 07:09:50 +03:00
Fixed a druntime crash in _d_delclass
This commit is contained in:
parent
bca5491974
commit
2fe6817294
2 changed files with 12 additions and 1 deletions
|
@ -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());
|
||||
|
|
|
@ -456,11 +456,16 @@ static void LLVM_D_BuildRuntimeModule()
|
|||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname3, M);
|
||||
}
|
||||
|
||||
// void _d_delclass(Object p)
|
||||
// D1: void _d_delclass(Object p)
|
||||
// D2: void _d_delclass(Object* p)
|
||||
{
|
||||
llvm::StringRef fname("_d_delclass");
|
||||
std::vector<const LLType*> types;
|
||||
#if DMDV2
|
||||
types.push_back(rt_ptr(objectTy));
|
||||
#else
|
||||
types.push_back(objectTy);
|
||||
#endif
|
||||
const llvm::FunctionType* fty = llvm::FunctionType::get(voidTy, types, false);
|
||||
llvm::Function::Create(fty, llvm::GlobalValue::ExternalLinkage, fname, M);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue