X-Git-Url: http://demsky.eecs.uci.edu/git/?a=blobdiff_plain;f=lib%2FDebugInfo%2FDWARFUnit.h;h=206d86c3087f6b0d16a53650130f1fdd5ae373da;hb=78f686d37cc3b4e70bbfc2acdfcfec8443fd3250;hp=9743b22f7276dcdabbd6c273a3f501583ddd6967;hpb=a189d1ad57e712ff20167269b9014241ed2d84be;p=oota-llvm.git diff --git a/lib/DebugInfo/DWARFUnit.h b/lib/DebugInfo/DWARFUnit.h index 9743b22f727..206d86c3087 100644 --- a/lib/DebugInfo/DWARFUnit.h +++ b/lib/DebugInfo/DWARFUnit.h @@ -7,8 +7,8 @@ // //===----------------------------------------------------------------------===// -#ifndef LLVM_DEBUGINFO_DWARFUNIT_H -#define LLVM_DEBUGINFO_DWARFUNIT_H +#ifndef LLVM_LIB_DEBUGINFO_DWARFUNIT_H +#define LLVM_LIB_DEBUGINFO_DWARFUNIT_H #include "DWARFDebugAbbrev.h" #include "DWARFDebugInfoEntry.h" @@ -52,13 +52,15 @@ class DWARFUnit { std::unique_ptr DWOContext; DWARFUnit *DWOU; public: - DWOHolder(object::ObjectFile *DWOFile); + DWOHolder(std::unique_ptr DWOFile); DWARFUnit *getUnit() const { return DWOU; } }; std::unique_ptr DWO; protected: virtual bool extractImpl(DataExtractor debug_info, uint32_t *offset_ptr); + /// Size in bytes of the unit header. + virtual uint32_t getHeaderSize() const { return 11; } public: DWARFUnit(const DWARFDebugAbbrev *DA, StringRef IS, StringRef RS, @@ -100,12 +102,7 @@ public: DWARFDebugRangeList &RangeList) const; void clear(); uint32_t getOffset() const { return Offset; } - /// Size in bytes of the compile unit header. - virtual uint32_t getSize() const { return 11; } - uint32_t getFirstDIEOffset() const { return Offset + getSize(); } uint32_t getNextUnitOffset() const { return Offset + Length + 4; } - /// Size in bytes of the .debug_info data associated with this compile unit. - size_t getDebugInfoSize() const { return Length + 4 - getSize(); } uint32_t getLength() const { return Length; } uint16_t getVersion() const { return Version; } const DWARFAbbreviationDeclarationSet *getAbbreviations() const { @@ -121,7 +118,7 @@ public: const DWARFDebugInfoEntryMinimal * getCompileUnitDIE(bool extract_cu_die_only = true) { extractDIEsIfNeeded(extract_cu_die_only); - return DieArray.empty() ? NULL : &DieArray[0]; + return DieArray.empty() ? nullptr : &DieArray[0]; } const char *getCompilationDir(); @@ -135,6 +132,9 @@ public: DWARFDebugInfoEntryInlinedChain getInlinedChainForAddress(uint64_t Address); private: + /// Size in bytes of the .debug_info data associated with this compile unit. + size_t getDebugInfoSize() const { return Length + 4 - getHeaderSize(); } + /// extractDIEsIfNeeded - Parses a compile unit and indexes its DIEs if it /// hasn't already been done. Returns the number of DIEs parsed at this call. size_t extractDIEsIfNeeded(bool CUDieOnly);