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 | 45d3fe1898d3726d269a0bd2ccb8527102e29d79 (patch) | |
tree | 56c77e6dd5fadb48770a3205fa4567f31c3ec115 /lib/CodeGen/CGStmt.cpp | |
parent | 74d4031b9a7dbb6204c4f97062d44bd26e21b014 (diff) |
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.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@104335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 496fd2fe1f..589273da43 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/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. |