DwarfDebug: Emit dwo_id+dwo_name for DICompileUnits that provide a dwoId.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfDebug.cpp
index 4a673d49cedf24524ad4e6dcff0ca0624e31915b..31d73a9035f6263f81e2e9283f5bcc6a92ba382b 100644 (file)
@@ -459,6 +459,14 @@ DwarfDebug::constructDwarfCompileUnit(const DICompileUnit *DIUnit) {
   else
     NewCU.initSection(Asm->getObjFileLowering().getDwarfInfoSection());
 
+  // Module debugging: This is a prefabricated skeleton CU.
+  if (DIUnit->getDWOId()) {
+    NewCU.addUInt(Die, dwarf::DW_AT_GNU_dwo_id, dwarf::DW_FORM_data8,
+                  DIUnit->getDWOId());
+    NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
+                    DIUnit->getSplitDebugFilename());
+  }
+
   CUMap.insert(std::make_pair(DIUnit, &NewCU));
   CUDieMap.insert(std::make_pair(&Die, &NewCU));
   return NewCU;