public DWARFUnitSectionBase {
struct UnitOffsetComparator {
- bool operator()(const std::unique_ptr<UnitType> &LHS,
- const std::unique_ptr<UnitType> &RHS) const {
- return LHS->getOffset() < RHS->getOffset();
- }
- bool operator()(const std::unique_ptr<UnitType> &LHS,
- uint32_t RHS) const {
- return LHS->getOffset() < RHS;
- }
bool operator()(uint32_t LHS,
const std::unique_ptr<UnitType> &RHS) const {
- return LHS < RHS->getOffset();
+ return LHS < RHS->getNextUnitOffset();
}
};
typedef llvm::iterator_range<typename UnitVector::iterator> 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();