diff options
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 43 |
1 files changed, 27 insertions, 16 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index c56931bbc6..06a045f69b 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -31,12 +31,11 @@ using namespace CodeGen; void CodeGenFunction::EmitStopPoint(const Stmt *S) { if (CGDebugInfo *DI = getDebugInfo()) { - SourceLocation Loc; if (isa<DeclStmt>(S)) - Loc = S->getLocEnd(); + DI->setLocation(S->getLocEnd()); else - Loc = S->getLocStart(); - DI->EmitLocation(Builder, Loc); + DI->setLocation(S->getLocStart()); + DI->EmitLocation(Builder); } } @@ -191,8 +190,10 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast, "LLVM IR generation of compound statement ('{}')"); CGDebugInfo *DI = getDebugInfo(); - if (DI) - DI->EmitLexicalBlockStart(Builder, S.getLBracLoc()); + if (DI) { + DI->setLocation(S.getLBracLoc()); + DI->EmitLexicalBlockStart(Builder); + } // Keep track of the current cleanup stack depth. RunCleanupsScope Scope(*this); @@ -201,8 +202,10 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast, E = S.body_end()-GetLast; I != E; ++I) EmitStmt(*I); - if (DI) - DI->EmitLexicalBlockEnd(Builder, S.getRBracLoc()); + if (DI) { + DI->setLocation(S.getRBracLoc()); + DI->EmitLexicalBlockEnd(Builder); + } RValue RV; if (!GetLast) @@ -567,8 +570,10 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { RunCleanupsScope ForScope(*this); CGDebugInfo *DI = getDebugInfo(); - if (DI) - DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); + if (DI) { + DI->setLocation(S.getSourceRange().getBegin()); + DI->EmitLexicalBlockStart(Builder); + } // Evaluate the first part before the loop. if (S.getInit()) @@ -647,8 +652,10 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { ForScope.ForceCleanup(); - if (DI) - DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); + if (DI) { + DI->setLocation(S.getSourceRange().getEnd()); + DI->EmitLexicalBlockEnd(Builder); + } // Emit the fall-through block. EmitBlock(LoopExit.getBlock(), true); @@ -660,8 +667,10 @@ void CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S) { RunCleanupsScope ForScope(*this); CGDebugInfo *DI = getDebugInfo(); - if (DI) - DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); + if (DI) { + DI->setLocation(S.getSourceRange().getBegin()); + DI->EmitLexicalBlockStart(Builder); + } // Evaluate the first pieces before the loop. EmitStmt(S.getRangeStmt()); @@ -717,8 +726,10 @@ void CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S) { ForScope.ForceCleanup(); - if (DI) - DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); + if (DI) { + DI->setLocation(S.getSourceRange().getEnd()); + DI->EmitLexicalBlockEnd(Builder); + } // Emit the fall-through block. EmitBlock(LoopExit.getBlock(), true); |