diff options
author | Devang Patel <dpatel@apple.com> | 2010-01-20 02:05:23 +0000 |
---|---|---|
committer | Devang Patel <dpatel@apple.com> | 2010-01-20 02:05:23 +0000 |
commit | 42aafd7e578707ca20dec456e8996849984272bb (patch) | |
tree | fd85dfe91d0ee901f3e90ec693af1f1dcff9ff19 /lib | |
parent | 221925eccace7433cb3b3c42875645c499db91a2 (diff) | |
download | external_llvm-42aafd7e578707ca20dec456e8996849984272bb.zip external_llvm-42aafd7e578707ca20dec456e8996849984272bb.tar.gz external_llvm-42aafd7e578707ca20dec456e8996849984272bb.tar.bz2 |
If a instruction belongs to another function (and not current function) as per debug info attached with the instruction then ignore the dangling lexical scope of this instruction. Such scopes are unreachable.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@93967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter/DwarfDebug.cpp | 16 |
1 files changed, 12 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp index b9910c3..ccadac0 100644 --- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp +++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp @@ -2042,10 +2042,18 @@ bool DwarfDebug::extractScopeInformation(MachineFunction *MF) { // Each scope has first instruction and last instruction to mark beginning // and end of a scope respectively. Create an inverse map that list scopes // starts (and ends) with an instruction. One instruction may start (or end) - // multiple scopes. - for (DenseMap<MDNode *, DbgScope *>::iterator DI = DbgScopeMap.begin(), - DE = DbgScopeMap.end(); DI != DE; ++DI) { - DbgScope *S = DI->second; + // multiple scopes. Ignore scopes that are not reachable. + SmallVector<DbgScope *, 4> WorkList; + WorkList.push_back(CurrentFnDbgScope); + while (!WorkList.empty()) { + DbgScope *S = WorkList.back(); WorkList.pop_back(); + + SmallVector<DbgScope *, 4> &Children = S->getScopes(); + if (!Children.empty()) + for (SmallVector<DbgScope *, 4>::iterator SI = Children.begin(), + SE = Children.end(); SI != SE; ++SI) + WorkList.push_back(*SI); + if (S->isAbstractScope()) continue; const MachineInstr *MI = S->getFirstInsn(); |