Mercurial > projects > ldc
changeset 267:c43911baea21 trunk
[svn r288] Let return statements start a new basic block after terminating the current one.
This fixes problems such as
void main()
{ return; return; }
author | ChristianK |
---|---|
date | Sun, 15 Jun 2008 18:37:23 +0200 |
parents | 5d2f4814bb2e |
children | 23d0d9855cad |
files | gen/statements.cpp |
diffstat | 1 files changed, 5 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/statements.cpp Sun Jun 15 12:58:48 2008 +0200 +++ b/gen/statements.cpp Sun Jun 15 18:37:23 2008 +0200 @@ -140,6 +140,11 @@ if (global.params.symdebug) DtoDwarfFuncEnd(p->func()->decl); llvm::ReturnInst::Create(p->scopebb()); } + + // the return terminated this basicblock, start a new one + llvm::BasicBlock* oldend = gIR->scopeend(); + llvm::BasicBlock* bb = llvm::BasicBlock::Create("afterreturn", p->topfunc(), oldend); + p->scope() = IRScope(bb,oldend); } //////////////////////////////////////////////////////////////////////////////