diff options
| author | Douglas Gregor <dgregor@apple.com> | 2010-05-21 18:36:48 +0000 |
|---|---|---|
| committer | Douglas Gregor <dgregor@apple.com> | 2010-05-21 18:36:48 +0000 |
| commit | 3fe900e410a0668764720e437e034a8e953d8497 (patch) | |
| tree | 9c69d967b780c9ea9d3a45713b399693a8294b61 /clang/lib/CodeGen | |
| parent | ea91abddfe8b9681d92b75721991acc3f9746256 (diff) | |
| download | bcm5719-llvm-3fe900e410a0668764720e437e034a8e953d8497.tar.gz bcm5719-llvm-3fe900e410a0668764720e437e034a8e953d8497.zip | |
Don't remove the break/continue scope of a for loop until after we've
emitted the increment expression. Fixes PR7189.
If someone knows how to write a useful test for this, I'd be grateful.
llvm-svn: 104335
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 496fd2fe1fb..589273da439 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -487,8 +487,6 @@ void CodeGenFunction::EmitDoStmt(const DoStmt &S) { } void CodeGenFunction::EmitForStmt(const ForStmt &S) { - // FIXME: What do we do if the increment (f.e.) contains a stmt expression, - // which contains a continue/break? CleanupScope ForScope(*this); // Evaluate the first part before the loop. @@ -558,14 +556,14 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { EmitStmt(S.getBody()); } - BreakContinueStack.pop_back(); - // If there is an increment, emit it next. if (S.getInc()) { EmitBlock(IncBlock); EmitStmt(S.getInc()); } + BreakContinueStack.pop_back(); + // Finally, branch back up to the condition for the next iteration. if (CondCleanup) { // Branch to the cleanup block. |

