Index: lib/DebugInfo/DWARFUnit.h =================================================================== --- lib/DebugInfo/DWARFUnit.h +++ lib/DebugInfo/DWARFUnit.h @@ -45,15 +45,15 @@ struct UnitOffsetComparator { bool operator()(const std::unique_ptr &LHS, const std::unique_ptr &RHS) const { - return LHS->getOffset() < RHS->getOffset(); + return LHS->getNextUnitOffset() < RHS->getNextUnitOffset(); } bool operator()(const std::unique_ptr &LHS, uint32_t RHS) const { - return LHS->getOffset() < RHS; + return LHS->getNextUnitOffset() < RHS; } bool operator()(uint32_t LHS, const std::unique_ptr &RHS) const { - return LHS < RHS->getOffset(); + return LHS < RHS->getNextUnitOffset(); } }; @@ -63,7 +63,7 @@ typedef llvm::iterator_range iterator_range; UnitType *getUnitForOffset(uint32_t Offset) const { - auto *CU = std::lower_bound(this->begin(), this->end(), Offset, + auto *CU = std::upper_bound(this->begin(), this->end(), Offset, UnitOffsetComparator()); if (CU != this->end()) return CU->get();