Prototype of skeleton type units for fission
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfUnit.cpp
index b066c95fe9baf5e75481474d5d21975b0463e81b..7cf66954e486aadcfc87a3fc0d9bf715dfb78f44 100644 (file)
@@ -1987,7 +1987,9 @@ void DwarfTypeUnit::emitHeader(const MCSection *ASection,
   Asm->OutStreamer.AddComment("Type Signature");
   Asm->OutStreamer.EmitIntValue(TypeSignature, sizeof(TypeSignature));
   Asm->OutStreamer.AddComment("Type DIE Offset");
-  Asm->OutStreamer.EmitIntValue(Ty->getOffset(), sizeof(Ty->getOffset()));
+  // In a skeleton type unit there is no type DIE so emit a zero offset.
+  Asm->OutStreamer.EmitIntValue(Ty ? Ty->getOffset() : 0,
+                                sizeof(Ty->getOffset()));
 }
 
 void DwarfTypeUnit::initSection(const MCSection *Section) {