[cfe-commits] r127937 - /cfe/trunk/include/clang/AST/CharUnits.h

Ken Dyck kd at kendyck.com
Fri Mar 18 18:25:59 PDT 2011


Author: kjdyck
Date: Fri Mar 18 20:25:59 2011
New Revision: 127937

URL: http://llvm.org/viewvc/llvm-project?rev=127937&view=rev
Log:
Add pre- and post-increment/decrement operators to CharUnits.

Modified:
    cfe/trunk/include/clang/AST/CharUnits.h

Modified: cfe/trunk/include/clang/AST/CharUnits.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/AST/CharUnits.h?rev=127937&r1=127936&r2=127937&view=diff
==============================================================================
--- cfe/trunk/include/clang/AST/CharUnits.h (original)
+++ cfe/trunk/include/clang/AST/CharUnits.h Fri Mar 18 20:25:59 2011
@@ -70,10 +70,24 @@
         Quantity += Other.Quantity;
         return *this;
       }
+      CharUnits& operator++ () {
+        ++Quantity;
+        return *this;
+      }
+      CharUnits operator++ (int) {
+        return CharUnits(Quantity++);
+      }
       CharUnits& operator-= (const CharUnits &Other) {
         Quantity -= Other.Quantity;
         return *this;
       }
+      CharUnits& operator-- () {
+        --Quantity;
+        return *this;
+      }
+      CharUnits operator-- (int) {
+        return CharUnits(Quantity--);
+      }
        
       // Comparison operators.
       bool operator== (const CharUnits &Other) const {





More information about the cfe-commits mailing list