[llvm-commits] [llvm] r135232 - /llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Devang Patel dpatel at apple.com
Thu Jul 14 17:30:40 PDT 2011


Author: dpatel
Date: Thu Jul 14 19:30:39 2011
New Revision: 135232

URL: http://llvm.org/viewvc/llvm-project?rev=135232&view=rev
Log:
Do not get confused by multiple empty lexical scopes inlined at one location. 

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp?rev=135232&r1=135231&r2=135232&view=diff
==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/DwarfDebug.cpp Thu Jul 14 19:30:39 2011
@@ -1587,18 +1587,22 @@
   }
 
   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 *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));
 





More information about the llvm-commits mailing list