]> granicus.if.org Git - clang/commitdiff
BasicValueFactory: Add utility methods 'Add1' and 'Sub1' to get a persistent APSInt...
authorTed Kremenek <kremenek@apple.com>
Mon, 16 Feb 2009 22:07:07 +0000 (22:07 +0000)
committerTed Kremenek <kremenek@apple.com>
Mon, 16 Feb 2009 22:07:07 +0000 (22:07 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64678 91177308-0d34-0410-b5e6-96231b3b80d8

include/clang/Analysis/PathSensitive/BasicValueFactory.h

index edf9ce5ab9b290bbc8d79a185b7d7f29bc60bfce..a494962789745ab8afade0a3e9ea0788d813bf2d 100644 (file)
@@ -101,6 +101,18 @@ public:
                                               T->isUnsignedIntegerType()));
   }
   
+  inline const llvm::APSInt& Add1(const llvm::APSInt& V) {
+    llvm::APSInt X = V;
+    ++X;
+    return getValue(X);
+  }
+  
+  inline const llvm::APSInt& Sub1(const llvm::APSInt& V) {
+    llvm::APSInt X = V;
+    --X;
+    return getValue(X);
+  }
+  
   inline const llvm::APSInt& getZeroWithPtrWidth(bool isUnsigned = true) {
     return getValue(0, Ctx.getTypeSize(Ctx.VoidPtrTy), isUnsigned);
   }