[llvm] r201933 - Add const to some member functions of SuccIterator.

Logan Chien tzuhsiang.chien at gmail.com
Sat Feb 22 01:06:56 PST 2014


Author: logan
Date: Sat Feb 22 03:06:55 2014
New Revision: 201933

URL: http://llvm.org/viewvc/llvm-project?rev=201933&view=rev
Log:
Add const to some member functions of SuccIterator.

The operator+() and operator-() do not change the member
variables of SuccIterator.  This CL will qualify the *this*
pointer with const.

Modified:
    llvm/trunk/include/llvm/Support/CFG.h

Modified: llvm/trunk/include/llvm/Support/CFG.h
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/include/llvm/Support/CFG.h?rev=201933&r1=201932&r2=201933&view=diff
==============================================================================
--- llvm/trunk/include/llvm/Support/CFG.h (original)
+++ llvm/trunk/include/llvm/Support/CFG.h Sat Feb 22 03:06:55 2014
@@ -208,7 +208,7 @@ public:
     return *this;
   }
 
-  inline Self operator+(int Right) {
+  inline Self operator+(int Right) const {
     Self tmp = *this;
     tmp += Right;
     return tmp;
@@ -218,11 +218,11 @@ public:
     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;





More information about the llvm-commits mailing list