Handle new throw expressions

This commit is contained in:
Martin Kinkelin 2022-02-19 19:28:08 +01:00
parent 78681e12e1
commit 5c9f1e5fd6
4 changed files with 32 additions and 14 deletions

View file

@ -934,19 +934,7 @@ public:
emitCoverageLinecountInc(stmt->loc);
assert(stmt->exp);
DValue *e = toElemDtor(stmt->exp);
llvm::Function *fn =
getRuntimeFunction(stmt->loc, irs->module, "_d_throw_exception");
LLValue *arg =
DtoBitCast(DtoRVal(e), fn->getFunctionType()->getParamType(0));
irs->CreateCallOrInvoke(fn, arg);
irs->ir->CreateUnreachable();
// TODO: Should not be needed.
llvm::BasicBlock *bb = irs->insertBB("afterthrow");
irs->ir->SetInsertPoint(bb);
DtoThrow(stmt->loc, toElemDtor(stmt->exp));
}
//////////////////////////////////////////////////////////////////////////