DwarfUnit: Refactor out DW_AT_stmt_list creation into common function for fission...
[oota-llvm.git] / lib / CodeGen / AsmPrinter / DwarfUnit.h
1 //===-- llvm/CodeGen/DwarfUnit.h - Dwarf Compile Unit ---*- C++ -*--===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 //
10 // This file contains support for writing dwarf compile unit.
11 //
12 //===----------------------------------------------------------------------===//
13
14 #ifndef CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
15 #define CODEGEN_ASMPRINTER_DWARFCOMPILEUNIT_H
16
17 #include "DIE.h"
18 #include "DwarfDebug.h"
19 #include "llvm/ADT/DenseMap.h"
20 #include "llvm/ADT/Optional.h"
21 #include "llvm/ADT/OwningPtr.h"
22 #include "llvm/ADT/StringMap.h"
23 #include "llvm/DebugInfo.h"
24 #include "llvm/MC/MCExpr.h"
25 #include "llvm/MC/MCSection.h"
26
27 namespace llvm {
28
29 class MachineLocation;
30 class MachineOperand;
31 class ConstantInt;
32 class ConstantFP;
33 class DbgVariable;
34 class DwarfCompileUnit;
35
36 // Data structure to hold a range for range lists.
37 class RangeSpan {
38 public:
39   RangeSpan(MCSymbol *S, MCSymbol *E) : Start(S), End(E) {}
40   const MCSymbol *getStart() const { return Start; }
41   const MCSymbol *getEnd() const { return End; }
42
43 private:
44   const MCSymbol *Start, *End;
45 };
46
47 class RangeSpanList {
48 private:
49   // Index for locating within the debug_range section this particular span.
50   MCSymbol *RangeSym;
51   // List of ranges.
52   SmallVector<RangeSpan, 2> Ranges;
53
54 public:
55   RangeSpanList(MCSymbol *Sym) : RangeSym(Sym) {}
56   MCSymbol *getSym() const { return RangeSym; }
57   const SmallVectorImpl<RangeSpan> &getRanges() const { return Ranges; }
58   void addRange(RangeSpan Range) { Ranges.push_back(Range); }
59 };
60
61 //===----------------------------------------------------------------------===//
62 /// Unit - This dwarf writer support class manages information associated
63 /// with a source file.
64 class DwarfUnit {
65 protected:
66   /// UniqueID - a numeric ID unique among all CUs in the module
67   unsigned UniqueID;
68
69   /// Node - MDNode for the compile unit.
70   DICompileUnit CUNode;
71
72   /// Unit debug information entry.
73   const OwningPtr<DIE> UnitDie;
74
75   /// Offset of the UnitDie from beginning of debug info section.
76   unsigned DebugInfoOffset;
77
78   /// Asm - Target of Dwarf emission.
79   AsmPrinter *Asm;
80
81   // Holders for some common dwarf information.
82   DwarfDebug *DD;
83   DwarfFile *DU;
84
85   /// IndexTyDie - An anonymous type for index type.  Owned by UnitDie.
86   DIE *IndexTyDie;
87
88   /// MDNodeToDieMap - Tracks the mapping of unit level debug information
89   /// variables to debug information entries.
90   DenseMap<const MDNode *, DIE *> MDNodeToDieMap;
91
92   /// MDNodeToDIEEntryMap - Tracks the mapping of unit level debug information
93   /// descriptors to debug information entries using a DIEEntry proxy.
94   DenseMap<const MDNode *, DIEEntry *> MDNodeToDIEEntryMap;
95
96   /// GlobalNames - A map of globally visible named entities for this unit.
97   StringMap<const DIE *> GlobalNames;
98
99   /// GlobalTypes - A map of globally visible types for this unit.
100   StringMap<const DIE *> GlobalTypes;
101
102   /// AccelNames - A map of names for the name accelerator table.
103   StringMap<std::vector<const DIE *> > AccelNames;
104
105   /// AccelObjC - A map of objc spec for the objc accelerator table.
106   StringMap<std::vector<const DIE *> > AccelObjC;
107
108   /// AccelNamespace - A map of names for the namespace accelerator table.
109   StringMap<std::vector<const DIE *> > AccelNamespace;
110
111   /// AccelTypes - A map of names for the type accelerator table.
112   StringMap<std::vector<std::pair<const DIE *, unsigned> > > AccelTypes;
113
114   /// DIEBlocks - A list of all the DIEBlocks in use.
115   std::vector<DIEBlock *> DIEBlocks;
116
117   /// ContainingTypeMap - This map is used to keep track of subprogram DIEs that
118   /// need DW_AT_containing_type attribute. This attribute points to a DIE that
119   /// corresponds to the MDNode mapped with the subprogram DIE.
120   DenseMap<DIE *, const MDNode *> ContainingTypeMap;
121
122   // List of ranges for a given compile unit.
123   SmallVector<RangeSpan, 1> CURanges;
124
125   // List of range lists for a given compile unit, separate from the ranges for
126   // the CU itself.
127   SmallVector<RangeSpanList, 1> CURangeLists;
128
129   // DIEValueAllocator - All DIEValues are allocated through this allocator.
130   BumpPtrAllocator DIEValueAllocator;
131
132   // DIEIntegerOne - A preallocated DIEValue because 1 is used frequently.
133   DIEInteger *DIEIntegerOne;
134
135   /// The section this unit will be emitted in.
136   const MCSection *Section;
137
138   /// A label at the start of the non-dwo section related to this unit.
139   MCSymbol *SectionSym;
140
141   /// The start of the unit within its section.
142   MCSymbol *LabelBegin;
143
144   /// The end of the unit within its section.
145   MCSymbol *LabelEnd;
146
147   /// The label for the start of the range sets for the elements of this unit.
148   MCSymbol *LabelRange;
149
150   /// Skeleton unit associated with this unit.
151   DwarfUnit *Skeleton;
152
153   DwarfUnit(unsigned UID, DIE *D, DICompileUnit CU, AsmPrinter *A,
154             DwarfDebug *DW, DwarfFile *DWU);
155
156 public:
157   virtual ~DwarfUnit();
158
159   /// Set the skeleton unit associated with this unit.
160   void setSkeleton(DwarfUnit *Skel) { Skeleton = Skel; }
161
162   /// Get the skeleton unit associated with this unit.
163   DwarfUnit *getSkeleton() const { return Skeleton; }
164
165   /// Pass in the SectionSym even though we could recreate it in every compile
166   /// unit (type units will have actually distinct symbols once they're in
167   /// comdat sections).
168   void initSection(const MCSection *Section, MCSymbol *SectionSym) {
169     assert(!this->Section);
170     this->Section = Section;
171     this->SectionSym = SectionSym;
172     this->LabelBegin =
173         Asm->GetTempSymbol(Section->getLabelBeginName(), getUniqueID());
174     this->LabelEnd =
175         Asm->GetTempSymbol(Section->getLabelEndName(), getUniqueID());
176     this->LabelRange = Asm->GetTempSymbol("gnu_ranges", getUniqueID());
177   }
178
179   const MCSection *getSection() const {
180     assert(Section);
181     return Section;
182   }
183
184   /// If there's a skeleton then return the section symbol for the skeleton
185   /// unit, otherwise return the section symbol for this unit.
186   MCSymbol *getLocalSectionSym() const {
187     if (Skeleton)
188       return Skeleton->getSectionSym();
189     return getSectionSym();
190   }
191
192   MCSymbol *getSectionSym() const {
193     assert(Section);
194     return SectionSym;
195   }
196
197   /// If there's a skeleton then return the begin label for the skeleton unit,
198   /// otherwise return the local label for this unit.
199   MCSymbol *getLocalLabelBegin() const {
200     if (Skeleton)
201       return Skeleton->getLabelBegin();
202     return getLabelBegin();
203   }
204
205   MCSymbol *getLabelBegin() const {
206     assert(Section);
207     return LabelBegin;
208   }
209
210   MCSymbol *getLabelEnd() const {
211     assert(Section);
212     return LabelEnd;
213   }
214
215   MCSymbol *getLabelRange() const {
216     assert(Section);
217     return LabelRange;
218   }
219
220   // Accessors.
221   unsigned getUniqueID() const { return UniqueID; }
222   uint16_t getLanguage() const { return CUNode.getLanguage(); }
223   DICompileUnit getCUNode() const { return CUNode; }
224   DIE *getUnitDie() const { return UnitDie.get(); }
225   const StringMap<const DIE *> &getGlobalNames() const { return GlobalNames; }
226   const StringMap<const DIE *> &getGlobalTypes() const { return GlobalTypes; }
227
228   const StringMap<std::vector<const DIE *> > &getAccelNames() const {
229     return AccelNames;
230   }
231   const StringMap<std::vector<const DIE *> > &getAccelObjC() const {
232     return AccelObjC;
233   }
234   const StringMap<std::vector<const DIE *> > &getAccelNamespace() const {
235     return AccelNamespace;
236   }
237   const StringMap<std::vector<std::pair<const DIE *, unsigned> > > &
238   getAccelTypes() const {
239     return AccelTypes;
240   }
241
242   unsigned getDebugInfoOffset() const { return DebugInfoOffset; }
243   void setDebugInfoOffset(unsigned DbgInfoOff) { DebugInfoOffset = DbgInfoOff; }
244
245   /// hasContent - Return true if this compile unit has something to write out.
246   bool hasContent() const { return !UnitDie->getChildren().empty(); }
247
248   /// addRange - Add an address range to the list of ranges for this unit.
249   void addRange(RangeSpan Range) { CURanges.push_back(Range); }
250
251   /// getRanges - Get the list of ranges for this unit.
252   const SmallVectorImpl<RangeSpan> &getRanges() const { return CURanges; }
253   SmallVectorImpl<RangeSpan> &getRanges() { return CURanges; }
254
255   /// addRangeList - Add an address range list to the list of range lists.
256   void addRangeList(RangeSpanList Ranges) { CURangeLists.push_back(Ranges); }
257
258   /// getRangeLists - Get the vector of range lists.
259   const SmallVectorImpl<RangeSpanList> &getRangeLists() const {
260     return CURangeLists;
261   }
262   SmallVectorImpl<RangeSpanList> &getRangeLists() { return CURangeLists; }
263
264   /// getParentContextString - Get a string containing the language specific
265   /// context for a global name.
266   std::string getParentContextString(DIScope Context) const;
267
268   /// addGlobalName - Add a new global entity to the compile unit.
269   ///
270   void addGlobalName(StringRef Name, DIE *Die, DIScope Context);
271
272   /// addAccelName - Add a new name to the name accelerator table.
273   void addAccelName(StringRef Name, const DIE *Die);
274
275   /// addAccelObjC - Add a new name to the ObjC accelerator table.
276   void addAccelObjC(StringRef Name, const DIE *Die);
277
278   /// addAccelNamespace - Add a new name to the namespace accelerator table.
279   void addAccelNamespace(StringRef Name, const DIE *Die);
280
281   /// addAccelType - Add a new type to the type accelerator table.
282   void addAccelType(StringRef Name, std::pair<const DIE *, unsigned> Die);
283
284   /// getDIE - Returns the debug information entry map slot for the
285   /// specified debug variable. We delegate the request to DwarfDebug
286   /// when the MDNode can be part of the type system, since DIEs for
287   /// the type system can be shared across CUs and the mappings are
288   /// kept in DwarfDebug.
289   DIE *getDIE(DIDescriptor D) const;
290
291   /// getDIEBlock - Returns a fresh newly allocated DIEBlock.
292   DIEBlock *getDIEBlock() { return new (DIEValueAllocator) DIEBlock(); }
293
294   /// insertDIE - Insert DIE into the map. We delegate the request to DwarfDebug
295   /// when the MDNode can be part of the type system, since DIEs for
296   /// the type system can be shared across CUs and the mappings are
297   /// kept in DwarfDebug.
298   void insertDIE(DIDescriptor Desc, DIE *D);
299
300   /// addDie - Adds or interns the DIE to the compile unit.
301   ///
302   void addDie(DIE *Buffer) { UnitDie->addChild(Buffer); }
303
304   /// addFlag - Add a flag that is true to the DIE.
305   void addFlag(DIE *Die, dwarf::Attribute Attribute);
306
307   /// addUInt - Add an unsigned integer attribute data and value.
308   void addUInt(DIE *Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,
309                uint64_t Integer);
310
311   void addUInt(DIEBlock *Block, dwarf::Form Form, uint64_t Integer);
312
313   /// addSInt - Add an signed integer attribute data and value.
314   void addSInt(DIE *Die, dwarf::Attribute Attribute, Optional<dwarf::Form> Form,
315                int64_t Integer);
316
317   void addSInt(DIEBlock *Die, Optional<dwarf::Form> Form, int64_t Integer);
318
319   /// addString - Add a string attribute data and value.
320   void addString(DIE *Die, dwarf::Attribute Attribute, const StringRef Str);
321
322   /// addLocalString - Add a string attribute data and value.
323   void addLocalString(DIE *Die, dwarf::Attribute Attribute,
324                       const StringRef Str);
325
326   /// addExpr - Add a Dwarf expression attribute data and value.
327   void addExpr(DIEBlock *Die, dwarf::Form Form, const MCExpr *Expr);
328
329   /// addLabel - Add a Dwarf label attribute data and value.
330   void addLabel(DIE *Die, dwarf::Attribute Attribute, dwarf::Form Form,
331                 const MCSymbol *Label);
332
333   void addLabel(DIEBlock *Die, dwarf::Form Form, const MCSymbol *Label);
334
335   /// addSectionLabel - Add a Dwarf section label attribute data and value.
336   ///
337   void addSectionLabel(DIE *Die, dwarf::Attribute Attribute,
338                        const MCSymbol *Label);
339
340   /// addSectionOffset - Add an offset into a section attribute data and value.
341   ///
342   void addSectionOffset(DIE *Die, dwarf::Attribute Attribute, uint64_t Integer);
343
344   /// addOpAddress - Add a dwarf op address data and value using the
345   /// form given and an op of either DW_FORM_addr or DW_FORM_GNU_addr_index.
346   void addOpAddress(DIEBlock *Die, const MCSymbol *Label);
347
348   /// addSectionDelta - Add a label delta attribute data and value.
349   void addSectionDelta(DIE *Die, dwarf::Attribute Attribute, const MCSymbol *Hi,
350                        const MCSymbol *Lo);
351
352   /// addDIEEntry - Add a DIE attribute data and value.
353   void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIE *Entry);
354
355   /// addDIEEntry - Add a DIE attribute data and value.
356   void addDIEEntry(DIE *Die, dwarf::Attribute Attribute, DIEEntry *Entry);
357
358   void addDIETypeSignature(DIE *Die, const DwarfTypeUnit &Type);
359
360   /// addBlock - Add block data.
361   void addBlock(DIE *Die, dwarf::Attribute Attribute, DIEBlock *Block);
362
363   /// addSourceLine - Add location information to specified debug information
364   /// entry.
365   void addSourceLine(DIE *Die, unsigned Line, StringRef File,
366                      StringRef Directory);
367   void addSourceLine(DIE *Die, DIVariable V);
368   void addSourceLine(DIE *Die, DIGlobalVariable G);
369   void addSourceLine(DIE *Die, DISubprogram SP);
370   void addSourceLine(DIE *Die, DIType Ty);
371   void addSourceLine(DIE *Die, DINameSpace NS);
372   void addSourceLine(DIE *Die, DIObjCProperty Ty);
373
374   /// addAddress - Add an address attribute to a die based on the location
375   /// provided.
376   void addAddress(DIE *Die, dwarf::Attribute Attribute,
377                   const MachineLocation &Location, bool Indirect = false);
378
379   /// addConstantValue - Add constant value entry in variable DIE.
380   void addConstantValue(DIE *Die, const MachineOperand &MO, DIType Ty);
381   void addConstantValue(DIE *Die, const ConstantInt *CI, bool Unsigned);
382   void addConstantValue(DIE *Die, const APInt &Val, bool Unsigned);
383
384   /// addConstantFPValue - Add constant value entry in variable DIE.
385   void addConstantFPValue(DIE *Die, const MachineOperand &MO);
386   void addConstantFPValue(DIE *Die, const ConstantFP *CFP);
387
388   /// addTemplateParams - Add template parameters in buffer.
389   void addTemplateParams(DIE &Buffer, DIArray TParams);
390
391   /// addRegisterOp - Add register operand.
392   void addRegisterOp(DIEBlock *TheDie, unsigned Reg);
393
394   /// addRegisterOffset - Add register offset.
395   void addRegisterOffset(DIEBlock *TheDie, unsigned Reg, int64_t Offset);
396
397   /// addComplexAddress - Start with the address based on the location provided,
398   /// and generate the DWARF information necessary to find the actual variable
399   /// (navigating the extra location information encoded in the type) based on
400   /// the starting location.  Add the DWARF information to the die.
401   void addComplexAddress(const DbgVariable &DV, DIE *Die,
402                          dwarf::Attribute Attribute,
403                          const MachineLocation &Location);
404
405   // FIXME: Should be reformulated in terms of addComplexAddress.
406   /// addBlockByrefAddress - Start with the address based on the location
407   /// provided, and generate the DWARF information necessary to find the
408   /// actual Block variable (navigating the Block struct) based on the
409   /// starting location.  Add the DWARF information to the die.  Obsolete,
410   /// please use addComplexAddress instead.
411   void addBlockByrefAddress(const DbgVariable &DV, DIE *Die,
412                             dwarf::Attribute Attribute,
413                             const MachineLocation &Location);
414
415   /// addVariableAddress - Add DW_AT_location attribute for a
416   /// DbgVariable based on provided MachineLocation.
417   void addVariableAddress(const DbgVariable &DV, DIE *Die,
418                           MachineLocation Location);
419
420   /// addType - Add a new type attribute to the specified entity. This takes
421   /// and attribute parameter because DW_AT_friend attributes are also
422   /// type references.
423   void addType(DIE *Entity, DIType Ty,
424                dwarf::Attribute Attribute = dwarf::DW_AT_type);
425
426   /// getOrCreateNameSpace - Create a DIE for DINameSpace.
427   DIE *getOrCreateNameSpace(DINameSpace NS);
428
429   /// getOrCreateSubprogramDIE - Create new DIE using SP.
430   DIE *getOrCreateSubprogramDIE(DISubprogram SP);
431
432   /// getOrCreateTypeDIE - Find existing DIE or create new DIE for the
433   /// given DIType.
434   DIE *getOrCreateTypeDIE(const MDNode *N);
435
436   /// getOrCreateContextDIE - Get context owner's DIE.
437   DIE *createTypeDIE(DICompositeType Ty);
438
439   /// getOrCreateContextDIE - Get context owner's DIE.
440   DIE *getOrCreateContextDIE(DIScope Context);
441
442   /// constructContainingTypeDIEs - Construct DIEs for types that contain
443   /// vtables.
444   void constructContainingTypeDIEs();
445
446   /// constructVariableDIE - Construct a DIE for the given DbgVariable.
447   DIE *constructVariableDIE(DbgVariable &DV, bool isScopeAbstract);
448
449   /// Create a DIE with the given Tag, add the DIE to its parent, and
450   /// call insertDIE if MD is not null.
451   DIE *createAndAddDIE(unsigned Tag, DIE &Parent,
452                        DIDescriptor N = DIDescriptor());
453
454   /// Compute the size of a header for this unit, not including the initial
455   /// length field.
456   virtual unsigned getHeaderSize() const {
457     return sizeof(int16_t) + // DWARF version number
458            sizeof(int32_t) + // Offset Into Abbrev. Section
459            sizeof(int8_t);   // Pointer Size (in bytes)
460   }
461
462   /// Emit the header for this unit, not including the initial length field.
463   virtual void emitHeader(const MCSection *ASection,
464                           const MCSymbol *ASectionSym) const;
465
466   virtual DwarfCompileUnit &getCU() = 0;
467
468 protected:
469   /// getOrCreateStaticMemberDIE - Create new static data member DIE.
470   DIE *getOrCreateStaticMemberDIE(DIDerivedType DT);
471
472 private:
473   /// constructTypeDIE - Construct basic type die from DIBasicType.
474   void constructTypeDIE(DIE &Buffer, DIBasicType BTy);
475
476   /// constructTypeDIE - Construct derived type die from DIDerivedType.
477   void constructTypeDIE(DIE &Buffer, DIDerivedType DTy);
478
479   /// constructTypeDIE - Construct type DIE from DICompositeType.
480   void constructTypeDIE(DIE &Buffer, DICompositeType CTy);
481
482   /// constructSubrangeDIE - Construct subrange DIE from DISubrange.
483   void constructSubrangeDIE(DIE &Buffer, DISubrange SR, DIE *IndexTy);
484
485   /// constructArrayTypeDIE - Construct array type DIE from DICompositeType.
486   void constructArrayTypeDIE(DIE &Buffer, DICompositeType CTy);
487
488   /// constructEnumTypeDIE - Construct enum type DIE from DIEnumerator.
489   void constructEnumTypeDIE(DIE &Buffer, DICompositeType CTy);
490
491   /// constructMemberDIE - Construct member DIE from DIDerivedType.
492   void constructMemberDIE(DIE &Buffer, DIDerivedType DT);
493
494   /// constructTemplateTypeParameterDIE - Construct new DIE for the given
495   /// DITemplateTypeParameter.
496   void constructTemplateTypeParameterDIE(DIE &Buffer,
497                                          DITemplateTypeParameter TP);
498
499   /// constructTemplateValueParameterDIE - Construct new DIE for the given
500   /// DITemplateValueParameter.
501   void constructTemplateValueParameterDIE(DIE &Buffer,
502                                           DITemplateValueParameter TVP);
503
504   /// getLowerBoundDefault - Return the default lower bound for an array. If the
505   /// DWARF version doesn't handle the language, return -1.
506   int64_t getDefaultLowerBound() const;
507
508   /// getDIEEntry - Returns the debug information entry for the specified
509   /// debug variable.
510   DIEEntry *getDIEEntry(const MDNode *N) const {
511     return MDNodeToDIEEntryMap.lookup(N);
512   }
513
514   /// insertDIEEntry - Insert debug information entry into the map.
515   void insertDIEEntry(const MDNode *N, DIEEntry *E) {
516     MDNodeToDIEEntryMap.insert(std::make_pair(N, E));
517   }
518
519   // getIndexTyDie - Get an anonymous type for index type.
520   DIE *getIndexTyDie() { return IndexTyDie; }
521
522   // setIndexTyDie - Set D as anonymous type for index which can be reused
523   // later.
524   void setIndexTyDie(DIE *D) { IndexTyDie = D; }
525
526   /// createDIEEntry - Creates a new DIEEntry to be a proxy for a debug
527   /// information entry.
528   DIEEntry *createDIEEntry(DIE *Entry);
529
530   /// resolve - Look in the DwarfDebug map for the MDNode that
531   /// corresponds to the reference.
532   template <typename T> T resolve(DIRef<T> Ref) const {
533     return DD->resolve(Ref);
534   }
535
536   /// If this is a named finished type then include it in the list of types for
537   /// the accelerator tables.
538   void updateAcceleratorTables(DIScope Context, DIType Ty, const DIE *TyDIE);
539 };
540
541 class DwarfCompileUnit : public DwarfUnit {
542 public:
543   DwarfCompileUnit(unsigned UID, DIE *D, DICompileUnit Node, AsmPrinter *A,
544                    DwarfDebug *DW, DwarfFile *DWU);
545   virtual ~DwarfCompileUnit() LLVM_OVERRIDE;
546
547   void initStmtList(MCSymbol *DwarfLineSectionSym);
548
549   /// createGlobalVariableDIE - create global variable DIE.
550   void createGlobalVariableDIE(DIGlobalVariable GV);
551
552   /// addLabelAddress - Add a dwarf label attribute data and value using
553   /// either DW_FORM_addr or DW_FORM_GNU_addr_index.
554   void addLabelAddress(DIE *Die, dwarf::Attribute Attribute, MCSymbol *Label);
555
556   DwarfCompileUnit &getCU() LLVM_OVERRIDE { return *this; }
557 };
558
559 class DwarfTypeUnit : public DwarfUnit {
560 private:
561   uint64_t TypeSignature;
562   const DIE *Ty;
563   DwarfCompileUnit &CU;
564
565 public:
566   DwarfTypeUnit(unsigned UID, DIE *D, DwarfCompileUnit &CU, AsmPrinter *A,
567                 DwarfDebug *DW, DwarfFile *DWU);
568   virtual ~DwarfTypeUnit() LLVM_OVERRIDE;
569
570   void setTypeSignature(uint64_t Signature) { TypeSignature = Signature; }
571   uint64_t getTypeSignature() const { return TypeSignature; }
572   void setType(const DIE *Ty) { this->Ty = Ty; }
573
574   /// Emit the header for this unit, not including the initial length field.
575   void emitHeader(const MCSection *ASection, const MCSymbol *ASectionSym) const
576       LLVM_OVERRIDE;
577   unsigned getHeaderSize() const LLVM_OVERRIDE {
578     return DwarfUnit::getHeaderSize() + sizeof(uint64_t) + // Type Signature
579            sizeof(uint32_t);                               // Type DIE Offset
580   }
581   void initSection(const MCSection *Section);
582   DwarfCompileUnit &getCU() LLVM_OVERRIDE { return CU; }
583 };
584 } // end llvm namespace
585 #endif