diff options
author | David Blaikie <dblaikie@gmail.com> | 2015-02-04 19:47:54 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2015-02-04 19:47:54 +0000 |
commit | 4d52443c0e329f0cd650cf208a77ed60df5e022b (patch) | |
tree | b2d5c873e689d455fc14a8b3f8ca4a73018736e2 /clang/lib/CodeGen | |
parent | 920df5c1bbb1fd179371e0a68af3e48517ca949b (diff) | |
download | bcm5719-llvm-4d52443c0e329f0cd650cf208a77ed60df5e022b.tar.gz bcm5719-llvm-4d52443c0e329f0cd650cf208a77ed60df5e022b.zip |
DebugInfo: Attribute cleanup code to the end of the scope, not the end of the function.
Now if you break on a dtor and go 'up' in your debugger (or you get an
asan failure in a dtor) during an exception unwind, you'll have more
context. Instead of all dtors appearing to be called from the '}' of the
function, they'll be attributed to the end of the scope of the variable,
the same as the non-exceptional dtor call.
This doesn't /quite/ remove all uses of CurEHLocation (which might be
nice to remove, for a few reasons) - it's still used to choose the
location for some other work in the landing pad. It'd be nice to
attribute that code to the same location as the exception calls within
the block and to remove CurEHLocation.
llvm-svn: 228181
Diffstat (limited to 'clang/lib/CodeGen')
-rw-r--r-- | clang/lib/CodeGen/CGCleanup.cpp | 2 | ||||
-rw-r--r-- | clang/lib/CodeGen/CGDebugInfo.cpp | 1 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.cpp | 4 | ||||
-rw-r--r-- | clang/lib/CodeGen/CodeGenFunction.h | 5 |
4 files changed, 6 insertions, 6 deletions
diff --git a/clang/lib/CodeGen/CGCleanup.cpp b/clang/lib/CodeGen/CGCleanup.cpp index bda8d8e942c..566befc915c 100644 --- a/clang/lib/CodeGen/CGCleanup.cpp +++ b/clang/lib/CodeGen/CGCleanup.cpp @@ -861,8 +861,6 @@ void CodeGenFunction::PopCleanupBlock(bool FallthroughIsBranchThrough) { // Emit the EH cleanup if required. if (RequiresEHCleanup) { - auto AL = ApplyDebugLocation::CreateDefaultArtificial(*this, CurEHLocation); - CGBuilderTy::InsertPoint SavedIP = Builder.saveAndClearIP(); EmitBlock(EHEntry); diff --git a/clang/lib/CodeGen/CGDebugInfo.cpp b/clang/lib/CodeGen/CGDebugInfo.cpp index 5624ce2f871..c5f358f7a1b 100644 --- a/clang/lib/CodeGen/CGDebugInfo.cpp +++ b/clang/lib/CodeGen/CGDebugInfo.cpp @@ -55,7 +55,6 @@ CGDebugInfo::~CGDebugInfo() { ApplyDebugLocation::ApplyDebugLocation(CodeGenFunction &CGF, SourceLocation TemporaryLocation) : CGF(CGF) { - assert(!TemporaryLocation.isInvalid() && "invalid location"); init(TemporaryLocation); } diff --git a/clang/lib/CodeGen/CodeGenFunction.cpp b/clang/lib/CodeGen/CodeGenFunction.cpp index e152bfd7491..43c9dfe87a0 100644 --- a/clang/lib/CodeGen/CodeGenFunction.cpp +++ b/clang/lib/CodeGen/CodeGenFunction.cpp @@ -241,8 +241,6 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { // edges will be *really* confused. bool EmitRetDbgLoc = true; if (EHStack.stable_begin() != PrologueCleanupDepth) { - PopCleanupBlocks(PrologueCleanupDepth); - // Make sure the line table doesn't jump back into the body for // the ret after it's been at EndLoc. EmitRetDbgLoc = false; @@ -250,6 +248,8 @@ void CodeGenFunction::FinishFunction(SourceLocation EndLoc) { if (CGDebugInfo *DI = getDebugInfo()) if (OnlySimpleReturnStmts) DI->EmitLocation(Builder, EndLoc); + + PopCleanupBlocks(PrologueCleanupDepth); } // Emit function epilog (to return). diff --git a/clang/lib/CodeGen/CodeGenFunction.h b/clang/lib/CodeGen/CodeGenFunction.h index 03d2ab313fb..60e81db3753 100644 --- a/clang/lib/CodeGen/CodeGenFunction.h +++ b/clang/lib/CodeGen/CodeGenFunction.h @@ -567,7 +567,10 @@ public: // If we should perform a cleanup, force them now. Note that // this ends the cleanup scope before rescoping any labels. - if (PerformCleanup) ForceCleanup(); + if (PerformCleanup) { + ApplyDebugLocation DL(CGF, Range.getEnd()); + ForceCleanup(); + } } /// \brief Force the emission of cleanups now, instead of waiting |