diff options
Diffstat (limited to 'lib/CodeGen/CGStmt.cpp')
-rw-r--r-- | lib/CodeGen/CGStmt.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/lib/CodeGen/CGStmt.cpp b/lib/CodeGen/CGStmt.cpp index 2a5d5edd25..62e465d702 100644 --- a/lib/CodeGen/CGStmt.cpp +++ b/lib/CodeGen/CGStmt.cpp @@ -148,12 +148,13 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast, CGDebugInfo *DI = getDebugInfo(); if (DI) { +#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN + DI->setLocation(S.getLBracLoc()); + DI->EmitRegionStart(CurFn, Builder); +#else EnsureInsertPoint(); DI->setLocation(S.getLBracLoc()); - // FIXME: The llvm backend is currently not ready to deal with region_end - // for block scoping. In the presence of always_inline functions it gets so - // confused that it doesn't emit any debug info. Just disable this for now. - //DI->EmitRegionStart(CurFn, Builder); +#endif } // Keep track of the current cleanup stack depth. @@ -166,13 +167,13 @@ RValue CodeGenFunction::EmitCompoundStmt(const CompoundStmt &S, bool GetLast, EmitStmt(*I); if (DI) { +#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN + DI->setLocation(S.getLBracLoc()); + DI->EmitRegionEnd(CurFn, Builder); +#else EnsureInsertPoint(); - DI->setLocation(S.getRBracLoc()); - - // FIXME: The llvm backend is currently not ready to deal with region_end - // for block scoping. In the presence of always_inline functions it gets so - // confused that it doesn't emit any debug info. Just disable this for now. - //DI->EmitRegionEnd(CurFn, Builder); + DI->setLocation(S.getLBracLoc()); +#endif } RValue RV; @@ -478,6 +479,13 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { BreakContinueStack.push_back(BreakContinue(AfterFor, ContinueBlock)); // If the condition is true, execute the body of the for stmt. +#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN + CGDebugInfo *DI = getDebugInfo(); + if (DI) { + DI->setLocation(S.getSourceRange().getBegin()); + DI->EmitRegionStart(CurFn, Builder); + } +#endif EmitStmt(S.getBody()); BreakContinueStack.pop_back(); @@ -490,6 +498,12 @@ void CodeGenFunction::EmitForStmt(const ForStmt &S) { // Finally, branch back up to the condition for the next iteration. EmitBranch(CondBlock); +#ifdef ATTACH_DEBUG_INFO_TO_AN_INSN + if (DI) { + DI->setLocation(S.getSourceRange().getEnd()); + DI->EmitRegionEnd(CurFn, Builder); + } +#endif // Emit the fall-through block. EmitBlock(AfterFor, true); |