diff options
author | Ted Kremenek <kremenek@apple.com> | 2009-02-16 22:00:30 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2009-02-16 22:00:30 +0000 |
commit | 0d3aeae8bf09fb9cdc536cfa5fefa983bd900dfc (patch) | |
tree | 1cf68a99a0790f032801358fb3e3cfb28566fcb2 /include/clang/Analysis/PathSensitive/BasicValueFactory.h | |
parent | b1152d842c6599e41581302a85a0f53928253add (diff) |
BasicValueFactory: Add getMaxValue and getMinValue variants that take QualTypes.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64677 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/Analysis/PathSensitive/BasicValueFactory.h')
-rw-r--r-- | include/clang/Analysis/PathSensitive/BasicValueFactory.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/include/clang/Analysis/PathSensitive/BasicValueFactory.h b/include/clang/Analysis/PathSensitive/BasicValueFactory.h index 1e08fb9a02..edf9ce5ab9 100644 --- a/include/clang/Analysis/PathSensitive/BasicValueFactory.h +++ b/include/clang/Analysis/PathSensitive/BasicValueFactory.h @@ -80,7 +80,27 @@ public: QualType T = isUnsigned ? Ctx.UnsignedIntTy : Ctx.IntTy; return getValue(X, T); } + + inline const llvm::APSInt& getMaxValue(const llvm::APSInt &v) { + return getValue(llvm::APSInt::getMaxValue(v.getBitWidth(), v.isUnsigned())); + } + + inline const llvm::APSInt& getMinValue(const llvm::APSInt &v) { + return getValue(llvm::APSInt::getMinValue(v.getBitWidth(), v.isUnsigned())); + } + inline const llvm::APSInt& getMaxValue(QualType T) { + assert(T->isIntegerType()); + return getValue(llvm::APSInt::getMaxValue(Ctx.getTypeSize(T), + T->isUnsignedIntegerType())); + } + + inline const llvm::APSInt& getMinValue(QualType T) { + assert(T->isIntegerType()); + return getValue(llvm::APSInt::getMinValue(Ctx.getTypeSize(T), + T->isUnsignedIntegerType())); + } + inline const llvm::APSInt& getZeroWithPtrWidth(bool isUnsigned = true) { return getValue(0, Ctx.getTypeSize(Ctx.VoidPtrTy), isUnsigned); } @@ -88,7 +108,7 @@ public: inline const llvm::APSInt& getTruthValue(bool b) { return getValue(b ? 1 : 0, Ctx.getTypeSize(Ctx.IntTy), false); } - + const SymIntConstraint& getConstraint(SymbolRef sym, BinaryOperator::Opcode Op, const llvm::APSInt& V); |