From: Ted Kremenek Date: Mon, 16 Feb 2009 22:21:33 +0000 (+0000) Subject: Modify getMaxValue/getMinValue to take pointer values as well. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=4b441f057688cf0d3e6d74ac530ce3eb2d965c5e;p=clang Modify getMaxValue/getMinValue to take pointer values as well. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@64682 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/include/clang/Analysis/PathSensitive/BasicValueFactory.h b/include/clang/Analysis/PathSensitive/BasicValueFactory.h index a494962789..f25bf5da1d 100644 --- a/include/clang/Analysis/PathSensitive/BasicValueFactory.h +++ b/include/clang/Analysis/PathSensitive/BasicValueFactory.h @@ -90,15 +90,15 @@ public: } inline const llvm::APSInt& getMaxValue(QualType T) { - assert(T->isIntegerType()); - return getValue(llvm::APSInt::getMaxValue(Ctx.getTypeSize(T), - T->isUnsignedIntegerType())); + assert(T->isIntegerType() || T->isPointerType()); + bool isUnsigned = T->isUnsignedIntegerType() || T->isPointerType(); + return getValue(llvm::APSInt::getMaxValue(Ctx.getTypeSize(T), isUnsigned)); } inline const llvm::APSInt& getMinValue(QualType T) { - assert(T->isIntegerType()); - return getValue(llvm::APSInt::getMinValue(Ctx.getTypeSize(T), - T->isUnsignedIntegerType())); + assert(T->isIntegerType() || T->isPointerType()); + bool isUnsigned = T->isUnsignedIntegerType() || T->isPointerType(); + return getValue(llvm::APSInt::getMinValue(Ctx.getTypeSize(T), isUnsigned)); } inline const llvm::APSInt& Add1(const llvm::APSInt& V) {