Index: lib/DebugInfo/DWARFUnit.h =================================================================== --- lib/DebugInfo/DWARFUnit.h +++ lib/DebugInfo/DWARFUnit.h @@ -14,6 +14,7 @@ #include "DWARFDebugInfoEntry.h" #include "DWARFDebugRangeList.h" #include "DWARFRelocMap.h" +#include #include namespace llvm { @@ -39,8 +40,8 @@ /// Concrete instance of DWARFUnitSection, specialized for one Unit type. template -class DWARFUnitSection : public SmallVector, 1>, - public DWARFUnitSectionBase { +class DWARFUnitSection : public DWARFUnitSectionBase { + SmallVector, 1> Units; struct UnitOffsetComparator { bool operator()(const std::unique_ptr &LHS, @@ -59,13 +60,58 @@ public: typedef llvm::SmallVectorImpl> UnitVector; + typedef typename UnitVector::size_type size_type; typedef typename UnitVector::iterator iterator; + typedef typename UnitVector::const_iterator const_iterator; + typedef typename UnitVector::reference reference; + typedef typename UnitVector::const_reference const_reference; typedef llvm::iterator_range iterator_range; + typedef llvm::iterator_range const_iterator_range; + + iterator begin() { + return Units.begin(); + } + const_iterator begin() const { + return Units.begin(); + } + + iterator end() { + return Units.end(); + } + const_iterator end() const { + return Units.end(); + } + + size_type size() { + return Units.size(); + } + + reference operator[](unsigned Index) { + return Units[Index]; + } + const_reference operator[](unsigned Index) const { + return Units[Index]; + } + + bool empty() const { + return Units.empty(); + } + + reference back() { + return Units.back(); + } + const_reference back() const { + return Units.back(); + } + + void push_back(std::unique_ptr &&Elt) { + Units.push_back(std::forward &&>(Elt)); + } UnitType *getUnitForOffset(uint32_t Offset) const { - auto *CU = std::lower_bound(this->begin(), this->end(), Offset, + auto *CU = std::lower_bound(Units.begin(), Units.end(), Offset, UnitOffsetComparator()); - if (CU != this->end()) + if (CU != Units.end()) return CU->get(); return nullptr; }