mirror of
https://github.com/ldc-developers/ldc.git
synced 2025-05-03 08:30:47 +03:00
Handle new throw expressions
This commit is contained in:
parent
78681e12e1
commit
5c9f1e5fd6
4 changed files with 32 additions and 14 deletions
|
@ -270,7 +270,7 @@ LLValue *DtoAllocaDump(LLValue *val, LLType *asType, int alignment,
|
|||
}
|
||||
|
||||
/******************************************************************************
|
||||
* ASSERT HELPER
|
||||
* ASSERT HELPERS
|
||||
******************************************************************************/
|
||||
|
||||
void DtoAssert(Module *M, const Loc &loc, DValue *msg) {
|
||||
|
@ -339,6 +339,21 @@ void DtoCAssert(Module *M, const Loc &loc, LLValue *msg) {
|
|||
gIR->ir->CreateUnreachable();
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* THROW HELPER
|
||||
******************************************************************************/
|
||||
|
||||
void DtoThrow(const Loc &loc, DValue *e) {
|
||||
LLFunction *fn = getRuntimeFunction(loc, gIR->module, "_d_throw_exception");
|
||||
LLValue *arg = DtoBitCast(DtoRVal(e), fn->getFunctionType()->getParamType(0));
|
||||
|
||||
gIR->CreateCallOrInvoke(fn, arg);
|
||||
gIR->ir->CreateUnreachable();
|
||||
|
||||
llvm::BasicBlock *bb = gIR->insertBB("afterthrow");
|
||||
gIR->ir->SetInsertPoint(bb);
|
||||
}
|
||||
|
||||
/******************************************************************************
|
||||
* MODULE FILE NAME
|
||||
******************************************************************************/
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue