X-Git-Url: http://plrg.eecs.uci.edu/git/?p=oota-llvm.git;a=blobdiff_plain;f=include%2Fllvm%2FDebugInfo%2FDWARF%2FDWARFUnit.h;h=2d05a520b50fd4273d3381fbaea85cf5cf89a23a;hp=628852f219e62162da17c358215e062d9d5a7d2c;hb=10f0544c8b7f0871632ad4aa2b274e5a09b7b193;hpb=ae0c4604d488cd2055195c06ca1dd3e68c8fac9b diff --git a/include/llvm/DebugInfo/DWARF/DWARFUnit.h b/include/llvm/DebugInfo/DWARF/DWARFUnit.h index 628852f219e..2d05a520b50 100644 --- a/include/llvm/DebugInfo/DWARF/DWARFUnit.h +++ b/include/llvm/DebugInfo/DWARF/DWARFUnit.h @@ -10,6 +10,7 @@ #ifndef LLVM_LIB_DEBUGINFO_DWARFUNIT_H #define LLVM_LIB_DEBUGINFO_DWARFUNIT_H +#include "llvm/ADT/STLExtras.h" #include "llvm/DebugInfo/DWARF/DWARFDebugAbbrev.h" #include "llvm/DebugInfo/DWARF/DWARFDebugInfoEntry.h" #include "llvm/DebugInfo/DWARF/DWARFDebugRangeList.h" @@ -45,21 +46,13 @@ protected: const DWARFDebugAbbrev *DA, StringRef RS, StringRef SS, StringRef SOS, StringRef AOS, bool isLittleEndian) = 0; - ~DWARFUnitSectionBase() {} + ~DWARFUnitSectionBase() = default; }; /// Concrete instance of DWARFUnitSection, specialized for one Unit type. template class DWARFUnitSection final : public SmallVector, 1>, public DWARFUnitSectionBase { - - struct UnitOffsetComparator { - bool operator()(uint32_t LHS, - const std::unique_ptr &RHS) const { - return LHS < RHS->getNextUnitOffset(); - } - }; - bool Parsed; public: @@ -72,8 +65,11 @@ public: typedef llvm::iterator_range iterator_range; UnitType *getUnitForOffset(uint32_t Offset) const override { - auto *CU = std::upper_bound(this->begin(), this->end(), Offset, - UnitOffsetComparator()); + auto *CU = std::upper_bound( + this->begin(), this->end(), Offset, + [](uint32_t LHS, const std::unique_ptr &RHS) { + return LHS < RHS->getNextUnitOffset(); + }); if (CU != this->end()) return CU->get(); return nullptr; @@ -194,9 +190,8 @@ public: BaseAddr = base_addr; } - const DWARFDebugInfoEntryMinimal * - getCompileUnitDIE(bool extract_cu_die_only = true) { - extractDIEsIfNeeded(extract_cu_die_only); + const DWARFDebugInfoEntryMinimal *getUnitDIE(bool ExtractUnitDIEOnly = true) { + extractDIEsIfNeeded(ExtractUnitDIEOnly); return DieArray.empty() ? nullptr : &DieArray[0]; } @@ -225,8 +220,7 @@ public: /// It is illegal to call this method with a DIE that hasn't be /// created by this unit. In other word, it's illegal to call this /// method on a DIE that isn't accessible by following - /// children/sibling links starting from this unit's - /// getCompileUnitDIE(). + /// children/sibling links starting from this unit's getUnitDIE(). uint32_t getDIEIndex(const DWARFDebugInfoEntryMinimal *DIE) { assert(!DieArray.empty() && DIE >= &DieArray[0] && DIE < &DieArray[0] + DieArray.size());