Mercurial > projects > ldc
changeset 517:9534dbc70a56
Fix continue inside dowhile statements.
Fixes:
run/do_while_02
author | Christian Kamm <kamm incasoftware de> |
---|---|
date | Sat, 16 Aug 2008 11:19:34 +0200 |
parents | eada571dc8ff |
children | 243485af6523 |
files | gen/statements.cpp |
diffstat | 1 files changed, 7 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/gen/statements.cpp Sat Aug 16 10:48:25 2008 +0200 +++ b/gen/statements.cpp Sat Aug 16 11:19:34 2008 +0200 @@ -282,6 +282,7 @@ // create while blocks llvm::BasicBlock* oldend = gIR->scopeend(); llvm::BasicBlock* dowhilebb = llvm::BasicBlock::Create("dowhile", gIR->topfunc(), oldend); + llvm::BasicBlock* condbb = llvm::BasicBlock::Create("dowhilecond", gIR->topfunc(), oldend); llvm::BasicBlock* endbb = llvm::BasicBlock::Create("enddowhile", gIR->topfunc(), oldend); // move into the while block @@ -289,13 +290,17 @@ llvm::BranchInst::Create(dowhilebb, gIR->scopebb()); // replace current scope - gIR->scope() = IRScope(dowhilebb,endbb); + gIR->scope() = IRScope(dowhilebb,condbb); // do-while body code - p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,dowhilebb,endbb)); + p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,condbb,endbb)); body->toIR(p); p->loopbbs.pop_back(); + // branch to condition block + llvm::BranchInst::Create(condbb, gIR->scopebb()); + gIR->scope() = IRScope(condbb,endbb); + // create the condition DValue* cond_e = condition->toElem(p); LLValue* cond_val = DtoBoolean(loc, cond_e);