diff options
| author | David Blaikie <dblaikie@gmail.com> | 2014-08-22 21:37:04 +0000 |
|---|---|---|
| committer | David Blaikie <dblaikie@gmail.com> | 2014-08-22 21:37:04 +0000 |
| commit | 93be0b24b85dd57cc1ec5e46aa657668f90829e4 (patch) | |
| tree | 221ee40cfef2b7e071b6bd0e39411e482e44c207 /clang/lib/CodeGen/CGStmt.cpp | |
| parent | cfe910b9d45a1e1a6af7fa85706fe464497f2b73 (diff) | |
| download | bcm5719-llvm-93be0b24b85dd57cc1ec5e46aa657668f90829e4.tar.gz bcm5719-llvm-93be0b24b85dd57cc1ec5e46aa657668f90829e4.zip | |
DebugInfo: Scope for condition variables more narrowly than the loop variable.
for loops introduce two scopes - one for the outer loop variable and its
initialization, and another for the body of the loop, including any
variable declared inside the loop condition.
llvm-svn: 216288
Diffstat (limited to 'clang/lib/CodeGen/CGStmt.cpp')
| -rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 11 |
1 files changed, 2 insertions, 9 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 1395d60ab07..de3b795fc2b 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -810,11 +810,7 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S, const ArrayRef<const Attr *> &ForAttrs) { JumpDest LoopExit = getJumpDestInCurrentScope("for.end"); - RunCleanupsScope ForScope(*this); - - CGDebugInfo *DI = getDebugInfo(); - if (DI) - DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); + LexicalScope ForScope(*this, S.getSourceRange()); // Evaluate the first part before the loop. if (S.getInit()) @@ -842,7 +838,7 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S, BreakContinueStack.push_back(BreakContinue(LoopExit, Continue)); // Create a cleanup scope for the condition variable cleanups. - RunCleanupsScope ConditionScope(*this); + LexicalScope ConditionScope(*this, S.getSourceRange()); if (S.getCond()) { // If the for statement has a condition scope, emit the local variable @@ -902,9 +898,6 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S, ForScope.ForceCleanup(); - if (DI) - DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); - LoopStack.pop(); // Emit the fall-through block. |

