Do not assume first function scope seen represents current function. 


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@86771 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
index 75b42cd..e7e596d 100644
--- a/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
+++ b/lib/CodeGen/AsmPrinter/DwarfDebug.cpp
@@ -1347,8 +1347,9 @@
   NScope->setFirstInsn(MI);
 
   if (!Parent && !InlinedAt) {
-    assert (!CurrentFnDbgScope && "Unexpected function scope!");
-    CurrentFnDbgScope = NScope;
+    StringRef SPName = DISubprogram(N).getLinkageName();
+    if (SPName == MF->getFunction()->getName())
+      CurrentFnDbgScope = NScope;
   }
 
   if (GetConcreteScope) {