Mercurial > projects > ldc
comparison gen/statements.cpp @ 311:9967a3270837 trunk
[svn r332] Fix codegen for continue within switch.
author | ChristianK |
---|---|
date | Sat, 28 Jun 2008 18:37:27 +0200 |
parents | d59c363fccad |
children | 8d98e42ece93 |
comparison
equal
deleted
inserted
replaced
310:d20cf0dec9c1 | 311:9967a3270837 |
---|---|
456 } | 456 } |
457 } | 457 } |
458 assert(0); | 458 assert(0); |
459 } | 459 } |
460 else { | 460 else { |
461 DtoEnclosingHandlers(enclosinghandler, gIR->loopbbs.back().enclosinghandler); | 461 // can't 'continue' within switch, so omit them |
462 llvm::BranchInst::Create(gIR->loopbbs.back().begin, gIR->scopebb()); | 462 IRState::LoopScopeVec::reverse_iterator it; |
463 for(it = gIR->loopbbs.rbegin(); it != gIR->loopbbs.rend(); ++it) { | |
464 if(!it->isSwitch) { | |
465 break; | |
466 } | |
467 } | |
468 DtoEnclosingHandlers(enclosinghandler, it->enclosinghandler); | |
469 llvm::BranchInst::Create(it->begin, gIR->scopebb()); | |
463 } | 470 } |
464 } | 471 } |
465 | 472 |
466 ////////////////////////////////////////////////////////////////////////////// | 473 ////////////////////////////////////////////////////////////////////////////// |
467 | 474 |
755 | 762 |
756 // do switch body | 763 // do switch body |
757 assert(body); | 764 assert(body); |
758 | 765 |
759 p->scope() = IRScope(bodybb, endbb); | 766 p->scope() = IRScope(bodybb, endbb); |
760 p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,p->scopebb(),endbb)); | 767 p->loopbbs.push_back(IRLoopScope(this,enclosinghandler,p->scopebb(),endbb,true)); |
761 body->toIR(p); | 768 body->toIR(p); |
762 p->loopbbs.pop_back(); | 769 p->loopbbs.pop_back(); |
763 | 770 |
764 if (!p->scopereturned()) | 771 if (!p->scopereturned()) |
765 llvm::BranchInst::Create(endbb, p->scopebb()); | 772 llvm::BranchInst::Create(endbb, p->scopebb()); |