[cfe-commits] r64677 - /cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h

Ted Kremenek kremenek at apple.com
Mon Feb 16 14:00:30 PST 2009


Author: kremenek
Date: Mon Feb 16 16:00:30 2009
New Revision: 64677

URL: http://llvm.org/viewvc/llvm-project?rev=64677&view=rev
Log:
BasicValueFactory: Add getMaxValue and getMinValue variants that take QualTypes.

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=64677&r1=64676&r2=64677&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/BasicValueFactory.h Mon Feb 16 16:00:30 2009
@@ -80,7 +80,27 @@
     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 @@
   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);
 





More information about the cfe-commits mailing list