Debug Info: Emit the dwo_name only in skeleton CUs, not in DWOs.
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfDebug.cpp
index 31d73a9035f6263f81e2e9283f5bcc6a92ba382b..e218b01353ab45b21d3ac30590312543796a0a55 100644 (file)
@@ -459,12 +459,14 @@ DwarfDebug::constructDwarfCompileUnit(const DICompileUnit *DIUnit) {
   else
     NewCU.initSection(Asm->getObjFileLowering().getDwarfInfoSection());
 
-  // Module debugging: This is a prefabricated skeleton CU.
   if (DIUnit->getDWOId()) {
+    // This CU is either a clang module DWO or a skeleton CU.
     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());
+    if (!DIUnit->getSplitDebugFilename().empty())
+      // This is a prefabricated skeleton CU.
+      NewCU.addString(Die, dwarf::DW_AT_GNU_dwo_name,
+                      DIUnit->getSplitDebugFilename());
   }
 
   CUMap.insert(std::make_pair(DIUnit, &NewCU));