Skip to content

[llvm][ADT] Some AddressRanges.h improvements #132847

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 28, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions llvm/include/llvm/ADT/AddressRanges.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,12 @@ template <typename T> class AddressRangesBase {
typename Collection::const_iterator begin() const { return Ranges.begin(); }
typename Collection::const_iterator end() const { return Ranges.end(); }

const T &operator[](size_t i) const {
assert(i < Ranges.size());
return Ranges[i];
const T &operator[](size_t I) const {
assert(I < Ranges.size());
return Ranges[I];
}

bool operator==(const AddressRangesBase<T> &RHS) const {
bool operator==(const AddressRangesBase &RHS) const {
return Ranges == RHS.Ranges;
}

Expand Down Expand Up @@ -124,7 +124,7 @@ class AddressRanges : public AddressRangesBase<AddressRange> {
if (Range.empty())
return Ranges.end();

auto It = llvm::upper_bound(Ranges, Range);
auto It = upper_bound(Ranges, Range);
auto It2 = It;
while (It2 != Ranges.end() && It2->start() <= Range.end())
++It2;
Expand All @@ -144,7 +144,7 @@ class AddressRanges : public AddressRangesBase<AddressRange> {

class AddressRangeValuePair {
public:
operator AddressRange() const { return Range; }
explicit operator AddressRange() const { return Range; }

AddressRange Range;
int64_t Value = 0;
Expand Down
Loading