summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorDevang Patel <dpatel@apple.com>2011-07-15 00:30:39 +0000
committerDevang Patel <dpatel@apple.com>2011-07-15 00:30:39 +0000
commit0bf164605dd83d65f6c510dad26449fcf9a79a51 (patch)
tree246a9b34329410c8d5163f06be2cf722b92b4b6f /lib
parent291e767dcf19d60b8e774114efc6e10f2e022844 (diff)
downloadllvm-0bf164605dd83d65f6c510dad26449fcf9a79a51.tar.gz
llvm-0bf164605dd83d65f6c510dad26449fcf9a79a51.tar.bz2
llvm-0bf164605dd83d65f6c510dad26449fcf9a79a51.tar.xz
Do not get confused by multiple empty lexical scopes inlined at one location.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@135232 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r--lib/CodeGen/AsmPrinter/DwarfDebug.cpp18
1 files changed, 13 insertions, 5 deletions
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 03fb8d1fa3..b7fc41b77b 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1587,18 +1587,22 @@ DbgScope *DwarfDebug::getOrCreateDbgScope(DebugLoc DL) {
}
getOrCreateAbstractScope(Scope);
- DbgScope *WScope = DbgScopeMap.lookup(InlinedAt);
+ DbgScope *WScope = NULL;
+ const MDNode *Key = InlinedAt;
+ if (const MDNode *Nest = DILocation(InlinedAt).getOrigLocation())
+ Key = Nest;
+ WScope = DbgScopeMap.lookup(Key);
if (WScope)
return WScope;
WScope = new DbgScope(NULL, DIDescriptor(Scope), InlinedAt);
- DbgScopeMap.insert(std::make_pair(InlinedAt, WScope));
+ DbgScopeMap[Key] = WScope;
DbgScope *Parent =
getOrCreateDbgScope(DebugLoc::getFromDILocation(InlinedAt));
WScope->setParent(Parent);
Parent->addScope(WScope);
- ConcreteScopes[InlinedAt] = WScope;
+ ConcreteScopes[Key] = WScope;
return WScope;
}
@@ -2083,8 +2087,12 @@ DbgScope *DwarfDebug::findDbgScope(DebugLoc DL) {
DbgScope *Scope = NULL;
LLVMContext &Ctx = Asm->MF->getFunction()->getContext();
- if (const MDNode *IA = DL.getInlinedAt(Ctx))
- Scope = ConcreteScopes.lookup(IA);
+ if (const MDNode *IA = DL.getInlinedAt(Ctx)) {
+ const MDNode *Key = IA;
+ if (const MDNode *Nest = DILocation(IA).getOrigLocation())
+ Key = Nest;
+ Scope = ConcreteScopes.lookup(Key);
+ }
if (Scope == 0)
Scope = DbgScopeMap.lookup(DL.getScope(Ctx));