Skip to content

Commit

Permalink
[NFC][sanitizer] Extend ArrayRef
Browse files Browse the repository at this point in the history
  • Loading branch information
vitalybuka committed May 31, 2023
1 parent 319d5d9 commit 6114579
Showing 1 changed file with 11 additions and 4 deletions.
15 changes: 11 additions & 4 deletions compiler-rt/lib/sanitizer_common/sanitizer_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -1085,12 +1085,19 @@ class ArrayRef {
ArrayRef() {}
ArrayRef(T *begin, T *end) : begin_(begin), end_(end) {}

T *begin() { return begin_; }
T *end() { return end_; }
template <typename C>
ArrayRef(const C &src) : begin_(src.begin()), end_(src.end()) {}

const T *begin() const { return begin_; }
const T *end() const { return end_; }

bool empty() const { return begin_ == end_; }

uptr size() const { return end_ - begin_; }

private:
T *begin_ = nullptr;
T *end_ = nullptr;
const T *begin_ = nullptr;
const T *end_ = nullptr;
};

} // namespace __sanitizer
Expand Down

0 comments on commit 6114579

Please sign in to comment.