diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-01-09 23:00:28 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-01-09 23:00:28 +0000 |
commit | f353d3ecd0329884110a8bd39f28b5cc111c9a69 (patch) | |
tree | 070b18a0745ca81118c1a5e32351cdcadcceb79e /clang/lib/CodeGen/CodeGenFunction.cpp | |
parent | a10379ad49b9a102d9f6ab1bdafba67dc42f430b (diff) | |
download | llvm-f353d3ecd0329884110a8bd39f28b5cc111c9a69.zip llvm-f353d3ecd0329884110a8bd39f28b5cc111c9a69.tar.gz llvm-f353d3ecd0329884110a8bd39f28b5cc111c9a69.tar.bz2 |
Revert "DebugInfo: Generalize debug info location handling" and related commits
This reverts commit r225000, r225021, r225083, r225086, r225090.
The root change (r225000) still has several issues where it's caused
calls to be emitted without debug locations. This causes assertion
failures if/when those calls are inlined.
I'll work up some test cases and fixes before recommitting this.
llvm-svn: 225555
Diffstat (limited to 'clang/lib/CodeGen/CodeGenFunction.cpp')
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index 826171a..4e97f9b 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -158,7 +158,7 @@ TypeEvaluationKind CodeGenFunction::getEvaluationKind(QualType type) { } } -llvm::DebugLoc CodeGenFunction::EmitReturnBlock() { +void CodeGenFunction::EmitReturnBlock() { // For cleanliness, we try to avoid emitting the return block for // simple cases. llvm::BasicBlock *CurBB = Builder.GetInsertBlock(); @@ -173,7 +173,7 @@ llvm::DebugLoc CodeGenFunction::EmitReturnBlock() { delete ReturnBlock.getBlock(); } else EmitBlock(ReturnBlock.getBlock()); - return llvm::DebugLoc(); + return; } // Otherwise, if the return block is the target of a single direct @@ -184,13 +184,15 @@ llvm::DebugLoc CodeGenFunction::EmitReturnBlock() { dyn_cast<llvm::BranchInst>(*ReturnBlock.getBlock()->user_begin()); if (BI && BI->isUnconditional() && BI->getSuccessor(0) == ReturnBlock.getBlock()) { - // Record/return the DebugLoc of the simple 'return' expression to be used - // later by the actual 'ret' instruction. - llvm::DebugLoc Loc = BI->getDebugLoc(); + // Reset insertion point, including debug location, and delete the + // branch. This is really subtle and only works because the next change + // in location will hit the caching in CGDebugInfo::EmitLocation and not + // override this. + Builder.SetCurrentDebugLocation(BI->getDebugLoc()); Builder.SetInsertPoint(BI->getParent()); BI->eraseFromParent(); delete ReturnBlock.getBlock(); - return Loc; + return; } } @@ -199,7 +201,6 @@ llvm::DebugLoc CodeGenFunction::EmitReturnBlock() { // region.end for now. EmitBlock(ReturnBlock.getBlock()); - return llvm::DebugLoc(); } static void EmitIfUsed(CodeGenFunction &CGF, llvm::BasicBlock *BB) { @@ -253,18 +254,16 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { } // Emit function epilog (to return). - llvm::DebugLoc Loc = EmitReturnBlock(); + EmitReturnBlock(); if (ShouldInstrumentFunction()) EmitFunctionInstrumentation("__cyg_profile_func_exit"); // Emit debug descriptor for function end. - if (CGDebugInfo *DI = getDebugInfo()) + if (CGDebugInfo *DI = getDebugInfo()) { DI->EmitFunctionEnd(Builder); + } - // Reset the debug location to that of the simple 'return' expression, if any - // rather than that of the end of the function's scope '}'. - ApplyDebugLocation AL(*this, Loc); EmitFunctionEpilog(*CurFnInfo, EmitRetDbgLoc, EndLoc); EmitEndEHSpec(CurCodeDecl); |