Index: llvm/trunk/lib/DebugInfo/DWARFUnit.h =================================================================== --- llvm/trunk/lib/DebugInfo/DWARFUnit.h +++ llvm/trunk/lib/DebugInfo/DWARFUnit.h @@ -46,17 +46,9 @@ public DWARFUnitSectionBase { struct UnitOffsetComparator { - bool operator()(const std::unique_ptr &LHS, - const std::unique_ptr &RHS) const { - return LHS->getOffset() < RHS->getOffset(); - } - bool operator()(const std::unique_ptr &LHS, - uint32_t RHS) const { - return LHS->getOffset() < RHS; - } bool operator()(uint32_t LHS, const std::unique_ptr &RHS) const { - return LHS < RHS->getOffset(); + return LHS < RHS->getNextUnitOffset(); } }; @@ -66,7 +58,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();