diff options
| author | Adrian Prantl <aprantl@apple.com> | 2013-06-08 00:16:55 +0000 |
|---|---|---|
| committer | Adrian Prantl <aprantl@apple.com> | 2013-06-08 00:16:55 +0000 |
| commit | 0ffce6ec99aee341ba2b2586eac862160f9fc004 (patch) | |
| tree | 593f2d3594feb73ea08de809b2751b4e61055bcc /clang/lib/CodeGen | |
| parent | ae9d8e21d6ff01a2d35c7efc948f89fbc1a9cc92 (diff) | |
| download | bcm5719-llvm-0ffce6ec99aee341ba2b2586eac862160f9fc004.tar.gz bcm5719-llvm-0ffce6ec99aee341ba2b2586eac862160f9fc004.zip | |
Debug info: An if condition now creates a lexical scope of its own.
Two variables with the same name declared in two if conditions in the same
scope are no longer coalesced into one.
rdar://problem/14024005
llvm-svn: 183597
Diffstat (limited to 'clang/lib/CodeGen')
| -rw-r--r-- | clang/lib/CodeGen/CGStmt.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/clang/lib/CodeGen/CGStmt.cpp b/clang/lib/CodeGen/CGStmt.cpp index 3e9b8d47ea0..0db31ac49c1 100644 --- a/clang/lib/CodeGen/CGStmt.cpp +++ b/clang/lib/CodeGen/CGStmt.cpp @@ -419,6 +419,11 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { // unequal to 0. The condition must be a scalar type. RunCleanupsScope ConditionScope(*this); + // Also open a debugger-visible lexical scope for the condition. + CGDebugInfo *DI = getDebugInfo(); + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); + if (S.getConditionVariable()) EmitAutoVarDecl(*S.getConditionVariable()); @@ -439,6 +444,8 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { RunCleanupsScope ExecutedScope(*this); EmitStmt(Executed); } + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); return; } } @@ -476,6 +483,9 @@ void CodeGenFunction::EmitIfStmt(const IfStmt &S) { EmitBranch(ContBlock); } + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); + // Emit the continuation block for code after the if. EmitBlock(ContBlock, true); } |

