diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-02-16 22:07:07 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-02-16 22:07:07 +0000 |
commit | 6175dc676c515a74e5f41afb4ac2b44cc2367a24 (patch) | |
tree | 66be9bdc4dd532f4743e38dd15624656e69ae089 /include/clang/Analysis/PathSensitive/BasicValueFactory.h | |
parent | 0d3aeae8bf09fb9cdc536cfa5fefa983bd900dfc (diff) |
BasicValueFactory: Add utility methods 'Add1' and 'Sub1' to get a persistent APSInt value that is 1 greater or 1 less than the provided value.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64678 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/BasicValueFactory.h')
-rw-r--r-- | include/clang/Analysis/PathSensitive/BasicValueFactory.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/clang/Analysis/PathSensitive/BasicValueFactory.h b/include/clang/Analysis/PathSensitive/BasicValueFactory.h index edf9ce5ab9..a494962789 100644 --- a/include/clang/Analysis/PathSensitive/BasicValueFactory.h +++ b/include/clang/Analysis/PathSensitive/BasicValueFactory.h @@ -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); } |