[cfe-commits] r104335 - /cfe/trunk/lib/CodeGen/CGStmt.cpp
Douglas Gregor
dgregor at apple.com
Fri May 21 11:36:48 PDT 2010
Author: dgregor
Date: Fri May 21 13:36:48 2010
New Revision: 104335
URL: http://llvm.org/viewvc/llvm-project?rev=104335&view=rev
Log:
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.
Modified:
cfe/trunk/lib/CodeGen/CGStmt.cpp
Modified: cfe/trunk/lib/CodeGen/CGStmt.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/CodeGen/CGStmt.cpp?rev=104335&r1=104334&r2=104335&view=diff
==============================================================================
--- cfe/trunk/lib/CodeGen/CGStmt.cpp (original)
+++ cfe/trunk/lib/CodeGen/CGStmt.cpp Fri May 21 13:36:48 2010
@@ -487,8 +487,6 @@
}
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 @@
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.
More information about the cfe-commits
mailing list