Skip to content

Commit

Permalink
Add const to some member functions of SuccIterator.
Browse files Browse the repository at this point in the history
The operator+() and operator-() do not change the member
variables of SuccIterator.  This CL will qualify the *this*
pointer with const.


git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@201933 91177308-0d34-0410-b5e6-96231b3b80d8
  • Loading branch information
loganchien committed Feb 22, 2014
1 parent a7101eb commit 8c0eb3e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions include/llvm/Support/CFG.h
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ class SuccIterator : public std::iterator<std::random_access_iterator_tag, BB_,
return *this;
}

inline Self operator+(int Right) {
inline Self operator+(int Right) const {
Self tmp = *this;
tmp += Right;
return tmp;
Expand All @@ -218,11 +218,11 @@ class SuccIterator : public std::iterator<std::random_access_iterator_tag, BB_,
return operator+=(-Right);
}

inline Self operator-(int Right) {
inline Self operator-(int Right) const {
return operator+(-Right);
}

inline int operator-(const Self& x) {
inline int operator-(const Self& x) const {
assert(Term == x.Term && "Cannot work on iterators of different blocks!");
int distance = idx - x.idx;
return distance;
Expand Down

0 comments on commit 8c0eb3e

Please sign in to comment.