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 | 0f8b34d70754d2d86842ec94f353560f8d597599 (patch) | |
| tree | f6167640e440e8aaf1ffc5a5638d4f33f6c54b69 | |
| parent | 9eebd9709ab0a47855526f0847370ab65c96217b (diff) | |
| download | bcm5719-llvm-0f8b34d70754d2d86842ec94f353560f8d597599.tar.gz bcm5719-llvm-0f8b34d70754d2d86842ec94f353560f8d597599.zip | |
BasicValueFactory: Add getMaxValue and getMinValue variants that take QualTypes.
llvm-svn: 64677
| -rw-r--r-- | clang/include/clang/Analysis/PathSensitive/BasicValueFactory.h | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/clang/include/clang/Analysis/PathSensitive/BasicValueFactory.h b/clang/include/clang/Analysis/PathSensitive/BasicValueFactory.h index 1e08fb9a026..edf9ce5ab9b 100644 --- a/clang/include/clang/Analysis/PathSensitive/BasicValueFactory.h +++ b/clang/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); |

