diff options
author | Eric Christopher <echristo@apple.com> | 2011-10-11 23:00:55 +0000 |
---|---|---|
committer | Eric Christopher <echristo@apple.com> | 2011-10-11 23:00:55 +0000 |
commit | 4b2d5498729a74a8e952bdf762e6f2d8c6b52690 (patch) | |
tree | 3ca9bd8b46c467997c178215147c51deab34af89 /lib/CodeGen/CGStmt.cpp | |
parent | ab5278e0ead5697ff27ef69d960c3e138b299ce6 (diff) |
Start handling debug line and scope information better:
Migrate most of the location setting within the larger API in CGDebugInfo and
update a lot of callers.
Remove the existing file/scope change machinery in UpdateLineDirectiveRegion
and replace it with DILexicalBlockFile usage.
Finishes off the rest of rdar://10246360
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@141732 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 43 |
1 files changed, 16 insertions, 27 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 06a045f69b..c56931bbc6 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -31,11 +31,12 @@ using namespace CodeGen; void CodeGenFunction::EmitStopPoint(const Stmt *S) { if (CGDebugInfo *DI = getDebugInfo()) { + SourceLocation Loc; if (isa<DeclStmt>(S)) - DI->setLocation(S->getLocEnd()); + Loc = S->getLocEnd(); else - DI->setLocation(S->getLocStart()); - DI->EmitLocation(Builder); + Loc = S->getLocStart(); + DI->EmitLocation(Builder, Loc); } } @@ -190,10 +191,8 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast, "LLVM IR generation of compound statement ('{}')"); CGDebugInfo *DI = getDebugInfo(); - if (DI) { - DI->setLocation(S.getLBracLoc()); - DI->EmitLexicalBlockStart(Builder); - } + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getLBracLoc()); // Keep track of the current cleanup stack depth. RunCleanupsScope Scope(*this); @@ -202,10 +201,8 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast, E = S.body_end()-GetLast; I != E; ++I) EmitStmt(*I); - if (DI) { - DI->setLocation(S.getRBracLoc()); - DI->EmitLexicalBlockEnd(Builder); - } + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getRBracLoc()); RValue RV; if (!GetLast) @@ -570,10 +567,8 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { RunCleanupsScope ForScope(*this); CGDebugInfo *DI = getDebugInfo(); - if (DI) { - DI->setLocation(S.getSourceRange().getBegin()); - DI->EmitLexicalBlockStart(Builder); - } + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); // Evaluate the first part before the loop. if (S.getInit()) @@ -652,10 +647,8 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { ForScope.ForceCleanup(); - if (DI) { - DI->setLocation(S.getSourceRange().getEnd()); - DI->EmitLexicalBlockEnd(Builder); - } + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); // Emit the fall-through block. EmitBlock(LoopExit.getBlock(), true); @@ -667,10 +660,8 @@ void CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S) { RunCleanupsScope ForScope(*this); CGDebugInfo *DI = getDebugInfo(); - if (DI) { - DI->setLocation(S.getSourceRange().getBegin()); - DI->EmitLexicalBlockStart(Builder); - } + if (DI) + DI->EmitLexicalBlockStart(Builder, S.getSourceRange().getBegin()); // Evaluate the first pieces before the loop. EmitStmt(S.getRangeStmt()); @@ -726,10 +717,8 @@ void CodeGenFunction::EmitCXXForRangeStmt(const CXXForRangeStmt &S) { ForScope.ForceCleanup(); - if (DI) { - DI->setLocation(S.getSourceRange().getEnd()); - DI->EmitLexicalBlockEnd(Builder); - } + if (DI) + DI->EmitLexicalBlockEnd(Builder, S.getSourceRange().getEnd()); // Emit the fall-through block. EmitBlock(LoopExit.getBlock(), true); |