aboutsummaryrefslogtreecommitdiff
path: root/clang/lib/AST/ByteCode/Compiler.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'clang/lib/AST/ByteCode/Compiler.cpp')
-rw-r--r--clang/lib/AST/ByteCode/Compiler.cpp48
1 files changed, 24 insertions, 24 deletions
diff --git a/clang/lib/AST/ByteCode/Compiler.cpp b/clang/lib/AST/ByteCode/Compiler.cpp
index 86b4358..2e22c85 100644
--- a/clang/lib/AST/ByteCode/Compiler.cpp
+++ b/clang/lib/AST/ByteCode/Compiler.cpp
@@ -5431,39 +5431,39 @@ bool Compiler<Emitter>::visitForStmt(const ForStmt *S) {
this->fallthrough(CondLabel);
this->emitLabel(CondLabel);
- {
- LocalScope<Emitter> CondScope(this);
- if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
- if (!visitDeclStmt(CondDecl))
- return false;
-
- if (Cond) {
- if (!this->visitBool(Cond))
- return false;
- if (!this->jumpFalse(EndLabel))
- return false;
- }
-
- if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
- return false;
-
- if (Body && !this->visitStmt(Body))
+ // Start of loop body.
+ LocalScope<Emitter> CondScope(this);
+ if (const DeclStmt *CondDecl = S->getConditionVariableDeclStmt())
+ if (!visitDeclStmt(CondDecl))
return false;
- this->fallthrough(IncLabel);
- this->emitLabel(IncLabel);
- if (Inc && !this->discard(Inc))
+ if (Cond) {
+ if (!this->visitBool(Cond))
return false;
-
- if (!CondScope.destroyLocals())
+ if (!this->jumpFalse(EndLabel))
return false;
}
+ if (!this->maybeEmitDeferredVarInit(S->getConditionVariable()))
+ return false;
+
+ if (Body && !this->visitStmt(Body))
+ return false;
+
+ this->fallthrough(IncLabel);
+ this->emitLabel(IncLabel);
+ if (Inc && !this->discard(Inc))
+ return false;
+
+ if (!CondScope.destroyLocals())
+ return false;
if (!this->jump(CondLabel))
return false;
+ // End of loop body.
- this->fallthrough(EndLabel);
this->emitLabel(EndLabel);
- return true;
+ // If we jumped out of the loop above, we still need to clean up the condition
+ // scope.
+ return CondScope.destroyLocals();
}
template <class Emitter>