[cfe-commits] r64678 - /cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h
Ted Kremenek
kremenek at apple.com
Mon Feb 16 14:07:07 PST 2009
Author: kremenek
Date: Mon Feb 16 16:07:07 2009
New Revision: 64678
URL: http://llvm.org/viewvc/llvm-project?rev=64678&view=rev
Log:
BasicValueFactory: Add utility methods 'Add1' and 'Sub1' to get a persistent APSInt value that is 1 greater or 1 less than the provided value.
Modified:
cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h
Modified: cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h?rev=64678&r1=64677&r2=64678&view=diff
==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h Mon Feb 16 16:07:07 2009
@@ -101,6 +101,18 @@
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);
}
More information about the cfe-commits
mailing list