diff options
author | David Blaikie <dblaikie@gmail.com> | 2014-08-04 19:30:08 +0000 |
---|---|---|
committer | David Blaikie <dblaikie@gmail.com> | 2014-08-04 19:30:08 +0000 |
commit | 448c066eea867a4e670a24bf505eae93eead59af (patch) | |
tree | 6961db20e146f9a7cdbf6f24af91aca485dc49e0 /llvm/lib/IR/DebugInfo.cpp | |
parent | 89872e99a51761419440e16c839f4e8b6b4e6fce (diff) | |
download | bcm5719-llvm-448c066eea867a4e670a24bf505eae93eead59af.tar.gz bcm5719-llvm-448c066eea867a4e670a24bf505eae93eead59af.zip |
Reapply "DebugInfo: Ensure that all debug location scope chains from instructions within a function, lead to the function itself."
Originally reverted in r213432 with flakey failures on an ASan self-host
build. After reduction it seems to be the same issue fixed in r213805
(ArgPromo + DebugInfo: Handle updating debug info over multiple
applications of argument promotion) and r213952 (by having
LiveDebugVariables strip dbg_value intrinsics in functions that are not
described by debug info). Though I cannot explain why this failure was
flakey...
llvm-svn: 214761
Diffstat (limited to 'llvm/lib/IR/DebugInfo.cpp')
-rw-r--r-- | llvm/lib/IR/DebugInfo.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/llvm/lib/IR/DebugInfo.cpp b/llvm/lib/IR/DebugInfo.cpp index c59b77eca0a..1bf90e49e7d 100644 --- a/llvm/lib/IR/DebugInfo.cpp +++ b/llvm/lib/IR/DebugInfo.cpp @@ -560,6 +560,32 @@ bool DISubprogram::Verify() const { if (isLValueReference() && isRValueReference()) return false; + if (auto *F = getFunction()) { + LLVMContext &Ctxt = F->getContext(); + for (auto &BB : *F) { + for (auto &I : BB) { + DebugLoc DL = I.getDebugLoc(); + if (DL.isUnknown()) + continue; + + MDNode *Scope = nullptr; + MDNode *IA = nullptr; + // walk the inlined-at scopes + while (DL.getScopeAndInlinedAt(Scope, IA, F->getContext()), IA) + DL = DebugLoc::getFromDILocation(IA); + DL.getScopeAndInlinedAt(Scope, IA, Ctxt); + assert(!IA); + while (!DIDescriptor(Scope).isSubprogram()) { + DILexicalBlockFile D(Scope); + Scope = D.isLexicalBlockFile() + ? D.getScope() + : DebugLoc::getFromDILexicalBlock(Scope).getScope(Ctxt); + } + if (!DISubprogram(Scope).describes(F)) + return false; + } + } + } return DbgNode->getNumOperands() == 20; } |