Mercurial > projects > ldc
diff gen/irstate.h @ 319:e9c93739bc4c trunk
[svn r340] Rework exception handling to work with nested tryfinally and trycatch.
author | ChristianK |
---|---|
date | Sat, 05 Jul 2008 10:22:56 +0200 |
parents | a9697749e898 |
children | 0d52412d5b1a |
line wrap: on
line diff
--- a/gen/irstate.h Fri Jul 04 09:00:49 2008 +0200 +++ b/gen/irstate.h Sat Jul 05 10:22:56 2008 +0200 @@ -172,10 +172,6 @@ llvm::BasicBlock* scopeend(); bool scopereturned(); - // landing pads for try statements - typedef std::vector<llvm::BasicBlock*> BBVec; - BBVec landingPads; - // create a call or invoke, depending on the landing pad info // the template function is defined further down in this file template <typename InputIterator> @@ -229,15 +225,16 @@ template <typename InputIterator> CallOrInvoke* IRState::CreateCallOrInvoke(LLValue* Callee, InputIterator ArgBegin, InputIterator ArgEnd, const char* Name) { - if(landingPads.empty()) - return new CallOrInvoke_Call(ir->CreateCall(Callee, ArgBegin, ArgEnd, Name)); - else + llvm::BasicBlock* pad; + if(pad = func()->landingPad.get()) { llvm::BasicBlock* postinvoke = llvm::BasicBlock::Create("postinvoke", topfunc(), scopeend()); - llvm::InvokeInst* invoke = ir->CreateInvoke(Callee, postinvoke, *landingPads.rbegin(), ArgBegin, ArgEnd, Name); + llvm::InvokeInst* invoke = ir->CreateInvoke(Callee, postinvoke, pad, ArgBegin, ArgEnd, Name); scope() = IRScope(postinvoke, scopeend()); return new CallOrInvoke_Invoke(invoke); } + else + return new CallOrInvoke_Call(ir->CreateCall(Callee, ArgBegin, ArgEnd, Name)); } #endif // LLVMDC_GEN_IRSTATE_H