DebugInfo: Push header handling down into CompileUnit
This is a preliminary step to handling type units by abstracting over
all (type or compile) units.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@193714 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
index 4a59ec5..8e2d69d 100644
--- a/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
+++ b/lib/CodeGen/AsmPrinter/DwarfCompileUnit.h
@@ -315,6 +315,17 @@
/// call insertDIE if MD is not null.
DIE *createAndAddDIE(unsigned Tag, DIE &Parent, const MDNode *MD = NULL);
+ /// Compute the size of a header for this unit, not including the initial
+ /// length field.
+ unsigned getHeaderSize() const {
+ return sizeof(int16_t) + // DWARF version number
+ sizeof(int32_t) + // Offset Into Abbrev. Section
+ sizeof(int8_t); // Pointer Size (in bytes)
+ }
+
+ /// Emit the header for this unit, not including the initial length field.
+ void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym);
+
private:
/// constructTypeDIE - Construct basic type die from DIBasicType.
void constructTypeDIE(DIE &Buffer, DIBasicType BTy);