If subprogram die is not available then construct new one.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfDebug.cpp
index 2aff2f2593b624caa907d5cae8b6de4823cc79d2..b80d2e75aadfef21e8baa10d6620da9840b16baf 100644 (file)
@@ -1464,6 +1464,10 @@ void DwarfDebug::ConstructFunctionDbgScope(DbgScope *RootScope,
 
   // Get the subprogram die.
   DIE *SPDie = ModuleCU->getDieMapSlotFor(SPD.getNode());
+  if (!SPDie) {
+    ConstructSubprogram(SPD.getNode());
+    SPDie = ModuleCU->getDieMapSlotFor(SPD.getNode());
+  }
   assert(SPDie && "Missing subprogram descriptor");
 
   if (!AbstractScope) {