]> granicus.if.org Git - clang/commitdiff
Makes most methods in SVals.h conform to the naming guide. Reviewed
authorZhanyong Wan <wan@google.com>
Wed, 16 Feb 2011 21:13:32 +0000 (21:13 +0000)
committerZhanyong Wan <wan@google.com>
Wed, 16 Feb 2011 21:13:32 +0000 (21:13 +0000)
by kremenek.

git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125687 91177308-0d34-0410-b5e6-96231b3b80d8

18 files changed:
include/clang/StaticAnalyzer/Core/PathSensitive/BasicValueFactory.h
include/clang/StaticAnalyzer/Core/PathSensitive/GRState.h
include/clang/StaticAnalyzer/Core/PathSensitive/SValBuilder.h
include/clang/StaticAnalyzer/Core/PathSensitive/SVals.h
lib/StaticAnalyzer/Checkers/BasicObjCFoundationChecks.cpp
lib/StaticAnalyzer/Checkers/ExprEngine.cpp
lib/StaticAnalyzer/Core/BasicStore.cpp
lib/StaticAnalyzer/Core/BasicValueFactory.cpp
lib/StaticAnalyzer/Core/BugReporter.cpp
lib/StaticAnalyzer/Core/CFRefCount.cpp
lib/StaticAnalyzer/Core/GRState.cpp
lib/StaticAnalyzer/Core/ObjCMessage.cpp
lib/StaticAnalyzer/Core/RegionStore.cpp
lib/StaticAnalyzer/Core/SValBuilder.cpp
lib/StaticAnalyzer/Core/SVals.cpp
lib/StaticAnalyzer/Core/SimpleConstraintManager.cpp
lib/StaticAnalyzer/Core/SimpleSValBuilder.cpp
lib/StaticAnalyzer/Core/SymbolManager.cpp

index 25605ab775b65fcfc14fd4abfc98bdbc3888297c..02517e38b477ff459552d53b80ef91a4e2b52bce 100644 (file)
@@ -104,9 +104,9 @@ public:
   }
   
   const llvm::APSInt &Convert(QualType T, const llvm::APSInt &From) {
-    assert(T->isIntegerType() || Loc::IsLocType(T));
+    assert(T->isIntegerType() || Loc::isLocType(T));
     unsigned bitwidth = Ctx.getTypeSize(T);
-    bool isUnsigned = T->isUnsignedIntegerType() || Loc::IsLocType(T);
+    bool isUnsigned = T->isUnsignedIntegerType() || Loc::isLocType(T);
     
     if (isUnsigned == From.isUnsigned() && bitwidth == From.getBitWidth())
       return From;
@@ -128,14 +128,14 @@ public:
   }
 
   inline const llvm::APSInt& getMaxValue(QualType T) {
-    assert(T->isIntegerType() || Loc::IsLocType(T));
-    bool isUnsigned = T->isUnsignedIntegerType() || Loc::IsLocType(T);
+    assert(T->isIntegerType() || Loc::isLocType(T));
+    bool isUnsigned = T->isUnsignedIntegerType() || Loc::isLocType(T);
     return getValue(llvm::APSInt::getMaxValue(Ctx.getTypeSize(T), isUnsigned));
   }
 
   inline const llvm::APSInt& getMinValue(QualType T) {
-    assert(T->isIntegerType() || Loc::IsLocType(T));
-    bool isUnsigned = T->isUnsignedIntegerType() || Loc::IsLocType(T);
+    assert(T->isIntegerType() || Loc::isLocType(T));
+    bool isUnsigned = T->isUnsignedIntegerType() || Loc::isLocType(T);
     return getValue(llvm::APSInt::getMinValue(Ctx.getTypeSize(T), isUnsigned));
   }
 
index f1f814a6cb5f42f84e65476def52d52d5de240e0..80a89e0b787430990961a9f14754d23e05350a37 100644 (file)
@@ -705,7 +705,7 @@ inline SVal GRState::getSVal(const Stmt* Ex) const {
 inline SVal GRState::getSValAsScalarOrLoc(const Stmt *S) const {
   if (const Expr *Ex = dyn_cast<Expr>(S)) {
     QualType T = Ex->getType();
-    if (Loc::IsLocType(T) || T->isIntegerType())
+    if (Loc::isLocType(T) || T->isIntegerType())
       return getSVal(S);
   }
 
index 7ccaed78c66a004a8d1d5b127968b4d5b576808e..9c187117425b2ffb19534accd085a18f5c209735 100644 (file)
@@ -190,7 +190,7 @@ public:
   }
 
   DefinedSVal makeIntVal(uint64_t X, QualType T) {
-    if (Loc::IsLocType(T))
+    if (Loc::isLocType(T))
       return loc::ConcreteInt(BasicVals.getValue(X, T));
 
     return nonloc::ConcreteInt(BasicVals.getValue(X, T));
index 5b8228d8e04bef151436a7d9abab45e583bff848..1d1cd0b8f91db7a891fddec10fbc5b6dc2e367e2 100644 (file)
@@ -63,7 +63,6 @@ protected:
   ///  The higher bits are an unsigned "kind" value.
   unsigned Kind;
 
-protected:
   explicit SVal(const void* d, bool isLoc, unsigned ValKind)
   : Data(d), Kind((isLoc ? LocKind : NonLocKind) | (ValKind << BaseBits)) {}
 
@@ -81,6 +80,8 @@ public:
   inline BaseKind getBaseKind() const { return (BaseKind) (Kind & BaseMask); }
   inline unsigned getSubKind() const { return (Kind & ~BaseMask) >> BaseBits; }
 
+  // This method is required for using SVal in a FoldingSetNode.  It
+  // extracts a unique signature for this SVal object.
   inline void Profile(llvm::FoldingSetNodeID& ID) const {
     ID.AddInteger((unsigned) getRawKind());
     ID.AddPointer(Data);
@@ -262,7 +263,7 @@ public:
     return V->getBaseKind() == LocKind;
   }
 
-  static inline bool IsLocType(QualType T) {
+  static inline bool isLocType(QualType T) {
     return T->isAnyPointerType() || T->isBlockPointerType() || 
            T->isReferenceType();
   }
@@ -456,7 +457,7 @@ public:
     return static_cast<const MemRegion*>(Data);
   }
 
-  const MemRegion* StripCasts() const;
+  const MemRegion* stripCasts() const;
 
   template <typename REGION>
   const REGION* getRegionAs() const {
index 66cd359785e4b7e6c1fa787205fce7dcda507abb..a1037b9713a861335908a13a74e01fe560b4c3e2 100644 (file)
@@ -291,7 +291,7 @@ void CFNumberCreateChecker::PreVisitCallExpr(CheckerContext &C,
   if (!LV)
     return;
 
-  const TypedRegion* R = dyn_cast<TypedRegion>(LV->StripCasts());
+  const TypedRegion* R = dyn_cast<TypedRegion>(LV->stripCasts());
   if (!R)
     return;
 
index bde7c4395a7e67debaf278a833720bd8b2aa78c0..99e120d303a55441fb2e5dcfa1bc8cd5c88818ed 100644 (file)
@@ -2280,7 +2280,7 @@ void ExprEngine::VisitObjCForCollectionStmtAux(const ObjCForCollectionStmt* S,
         //  container.  We will do this with dispatch logic to the store.
         //  For now, just 'conjure' up a symbolic value.
         QualType T = R->getValueType();
-        assert(Loc::IsLocType(T));
+        assert(Loc::isLocType(T));
         unsigned Count = Builder->getCurrentBlockCount();
         SymbolRef Sym = SymMgr.getConjuredSymbol(elem, T, Count);
         SVal V = svalBuilder.makeLoc(Sym);
@@ -2798,7 +2798,7 @@ void ExprEngine::VisitInitListExpr(const InitListExpr* E, ExplodedNode* Pred,
     return;
   }
 
-  if (Loc::IsLocType(T) || T->isIntegerType()) {
+  if (Loc::isLocType(T) || T->isIntegerType()) {
     assert (E->getNumInits() == 1);
     ExplodedNodeSet Tmp;
     const Expr* Init = E->getInit(0);
@@ -3103,7 +3103,7 @@ void ExprEngine::VisitUnaryOperator(const UnaryOperator* U,
         // If the value is a location, ++/-- should always preserve
         // non-nullness.  Check if the original value was non-null, and if so
         // propagate that constraint.
-        if (Loc::IsLocType(U->getType())) {
+        if (Loc::isLocType(U->getType())) {
           DefinedOrUnknownSVal Constraint =
             svalBuilder.evalEQ(state, V2,svalBuilder.makeZeroVal(U->getType()));
 
index 105b5052422335ee0238c7f14c43e1334cf1d695..987e790585f4b13aea257a9e8729c40b20d29c8c 100644 (file)
@@ -252,7 +252,7 @@ Store BasicStoreManager::Bind(Store store, Loc loc, SVal V) {
     // a pointer.  We may wish to flag a type error here if the types
     // are incompatible.  This may also cause lots of breakage
     // elsewhere. Food for thought.
-    if (TyR->isBoundable() && Loc::IsLocType(TyR->getValueType()))
+    if (TyR->isBoundable() && Loc::isLocType(TyR->getValueType()))
       V = X->getLoc();
   }
 
@@ -464,7 +464,7 @@ Store BasicStoreManager::BindDeclInternal(Store store, const VarRegion* VR,
       //     unsigned) zero;
       if (!InitVal) {
         QualType T = VD->getType();
-        if (Loc::IsLocType(T))
+        if (Loc::isLocType(T))
           store = Bind(store, loc::MemRegionVal(VR),
                        loc::ConcreteInt(BasicVals.getValue(0, T)));
         else if (T->isIntegerType() && T->isScalarType())
index 7eb2fe4dc55d47dee01e5306cca31a6fb16817c4..6315d83d894dde8e2278ebb0ad99effc3e4b836d 100644 (file)
@@ -99,7 +99,7 @@ const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, unsigned BitWidth,
 const llvm::APSInt& BasicValueFactory::getValue(uint64_t X, QualType T) {
 
   unsigned bits = Ctx.getTypeSize(T);
-  llvm::APSInt V(bits, T->isUnsignedIntegerType() || Loc::IsLocType(T));
+  llvm::APSInt V(bits, T->isUnsignedIntegerType() || Loc::isLocType(T));
   V = X;
   return getValue(V);
 }
@@ -286,5 +286,3 @@ BasicValueFactory::getPersistentSValPair(const SVal& V1, const SVal& V2) {
 const SVal* BasicValueFactory::getPersistentSVal(SVal X) {
   return &getPersistentSValWithData(X, 0).first;
 }
-
-
index 431c5d75060163c9ae3218fec477c5c4028c9ed0..d945639ee46ba8b2e86497bc36e1b87402d8fcd5 100644 (file)
@@ -446,7 +446,7 @@ public:
     // Create the diagnostic.
     FullSourceLoc L(S->getLocStart(), BR.getSourceManager());
 
-    if (Loc::IsLocType(VD->getType())) {
+    if (Loc::isLocType(VD->getType())) {
       std::string msg = "'" + std::string(VD->getNameAsString()) +
       "' now aliases '" + MostRecent->getNameAsString() + "'";
 
index 92bd4116a7412c4f78f17c391f5750c5efc5ad4d..b3721d7659fecf65d21549dc9f43ab7de1abe218 100644 (file)
@@ -2679,7 +2679,7 @@ void CFRefCount::evalSummary(ExplodedNodeSet& Dst,
       // that are returned by value.
 
       QualType T = callOrMsg.getResultType(Eng.getContext());
-      if (Loc::IsLocType(T) || (T->isIntegerType() && T->isScalarType())) {
+      if (Loc::isLocType(T) || (T->isIntegerType() && T->isScalarType())) {
         unsigned Count = Builder.getCurrentBlockCount();
         SValBuilder &svalBuilder = Eng.getSValBuilder();
         SVal X = svalBuilder.getConjuredSymbolVal(NULL, Ex, T, Count);
index 80f2ae082bec176186e95dbd658721294443caeb..80c8bbf195a42f1c89634d2f2aa441e404a4c502 100644 (file)
@@ -165,7 +165,7 @@ SVal GRState::getSValAsScalarOrLoc(const MemRegion *R) const {
 
   if (const TypedRegion *TR = dyn_cast<TypedRegion>(R)) {
     QualType T = TR->getValueType();
-    if (Loc::IsLocType(T) || T->isIntegerType())
+    if (Loc::isLocType(T) || T->isIntegerType())
       return getSVal(R);
   }
 
index a27a5b6be8dd9eef7acc1ac3c4add96ef40edb1e..2e370d62e44063d88cdf6affd8feb84a1fca1ff9 100644 (file)
@@ -93,7 +93,7 @@ SVal CallOrObjCMessage::getArgSValAsScalarOrLoc(unsigned i) const {
   assert(i < getNumArgs());
   if (CallE) return State->getSValAsScalarOrLoc(CallE->getArg(i));
   QualType argT = Msg.getArgType(i);
-  if (Loc::IsLocType(argT) || argT->isIntegerType())
+  if (Loc::isLocType(argT) || argT->isIntegerType())
     return Msg.getArgSVal(i, State);
   return UnknownVal();
 }
index a6a55933ad5daafadf48a7dc63c58dd62e4fe871..dc31715ccb61ef7ec365fc6035fa9d2ba219e281 100644 (file)
@@ -1333,7 +1333,7 @@ Store RegionStoreManager::setImplicitDefaultValue(Store store,
   RegionBindings B = GetRegionBindings(store);
   SVal V;
 
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     V = svalBuilder.makeNull();
   else if (T->isIntegerType())
     V = svalBuilder.makeZeroVal(T);
index b2ffcbda712dd86e11f630fe9b7f2806060d4126..796613383bd3b91dabce585c8c2a017cc41b65eb 100644 (file)
@@ -26,7 +26,7 @@ using namespace ento;
 //===----------------------------------------------------------------------===//
 
 DefinedOrUnknownSVal SValBuilder::makeZeroVal(QualType T) {
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     return makeNull();
 
   if (T->isIntegerType())
@@ -43,14 +43,14 @@ NonLoc SValBuilder::makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
   // The Environment ensures we always get a persistent APSInt in
   // BasicValueFactory, so we don't need to get the APSInt from
   // BasicValueFactory again.
-  assert(!Loc::IsLocType(T));
+  assert(!Loc::isLocType(T));
   return nonloc::SymExprVal(SymMgr.getSymIntExpr(lhs, op, v, T));
 }
 
 NonLoc SValBuilder::makeNonLoc(const SymExpr *lhs, BinaryOperator::Opcode op,
                                 const SymExpr *rhs, QualType T) {
   assert(SymMgr.getType(lhs) == SymMgr.getType(rhs));
-  assert(!Loc::IsLocType(T));
+  assert(!Loc::isLocType(T));
   return nonloc::SymExprVal(SymMgr.getSymSymExpr(lhs, op, rhs, T));
 }
 
@@ -78,7 +78,7 @@ SValBuilder::getRegionValueSymbolVal(const TypedRegion* R) {
 
   SymbolRef sym = SymMgr.getRegionValueSymbol(R);
 
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
 
   return nonloc::SymbolVal(sym);
@@ -94,7 +94,7 @@ DefinedOrUnknownSVal SValBuilder::getConjuredSymbolVal(const void *SymbolTag,
 
   SymbolRef sym = SymMgr.getConjuredSymbol(E, Count, SymbolTag);
 
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
 
   return nonloc::SymbolVal(sym);
@@ -110,7 +110,7 @@ DefinedOrUnknownSVal SValBuilder::getConjuredSymbolVal(const void *SymbolTag,
 
   SymbolRef sym = SymMgr.getConjuredSymbol(E, T, Count, SymbolTag);
 
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
 
   return nonloc::SymbolVal(sym);
@@ -124,7 +124,7 @@ DefinedSVal SValBuilder::getMetadataSymbolVal(const void *SymbolTag,
 
   SymbolRef sym = SymMgr.getMetadataSymbol(MR, E, T, Count, SymbolTag);
 
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
 
   return nonloc::SymbolVal(sym);
@@ -140,7 +140,7 @@ SValBuilder::getDerivedRegionValueSymbolVal(SymbolRef parentSymbol,
 
   SymbolRef sym = SymMgr.getDerivedSymbol(parentSymbol, R);
 
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     return loc::MemRegionVal(MemMgr.getSymbolicRegion(sym));
 
   return nonloc::SymbolVal(sym);
@@ -216,11 +216,11 @@ SVal SValBuilder::evalCast(SVal val, QualType castTy, QualType originalTy) {
     return evalCastNL(cast<NonLoc>(val), castTy);
 
   // Check for casts from pointers to integers.
-  if (castTy->isIntegerType() && Loc::IsLocType(originalTy))
+  if (castTy->isIntegerType() && Loc::isLocType(originalTy))
     return evalCastL(cast<Loc>(val), castTy);
 
   // Check for casts from integers to pointers.
-  if (Loc::IsLocType(castTy) && originalTy->isIntegerType()) {
+  if (Loc::isLocType(castTy) && originalTy->isIntegerType()) {
     if (nonloc::LocAsInteger *LV = dyn_cast<nonloc::LocAsInteger>(&val)) {
       if (const MemRegion *R = LV->getLoc().getAsRegion()) {
         StoreManager &storeMgr = StateMgr.getStoreManager();
@@ -234,7 +234,7 @@ SVal SValBuilder::evalCast(SVal val, QualType castTy, QualType originalTy) {
 
   // Just pass through function and block pointers.
   if (originalTy->isBlockPointerType() || originalTy->isFunctionPointerType()) {
-    assert(Loc::IsLocType(castTy));
+    assert(Loc::isLocType(castTy));
     return val;
   }
 
@@ -264,7 +264,7 @@ SVal SValBuilder::evalCast(SVal val, QualType castTy, QualType originalTy) {
     // FIXME: We should handle the case where we strip off view layers to get
     //  to a desugared type.
 
-    if (!Loc::IsLocType(castTy)) {
+    if (!Loc::isLocType(castTy)) {
       // FIXME: There can be gross cases where one casts the result of a function
       // (that returns a pointer) to some other value that happens to fit
       // within that pointer value.  We currently have no good way to
@@ -291,7 +291,7 @@ SVal SValBuilder::evalCast(SVal val, QualType castTy, QualType originalTy) {
     //    return bar(x)+1; // no-warning
     //  }
 
-    assert(Loc::IsLocType(originalTy) || originalTy->isFunctionType() ||
+    assert(Loc::isLocType(originalTy) || originalTy->isFunctionType() ||
            originalTy->isBlockPointerType());
 
     StoreManager &storeMgr = StateMgr.getStoreManager();
index cc7231bc2cd8e5bb7db61108c1d92d69fcc635d9..cc866d0127d86c1b9293aba9926f0fe2ab254d60 100644 (file)
@@ -68,7 +68,7 @@ SymbolRef SVal::getAsLocSymbol() const {
     return X->getLoc().getAsLocSymbol();
 
   if (const loc::MemRegionVal *X = dyn_cast<loc::MemRegionVal>(this)) {
-    const MemRegion *R = X->StripCasts();
+    const MemRegion *R = X->stripCasts();
     if (const SymbolicRegion *SymR = dyn_cast<SymbolicRegion>(R))
       return SymR->getSymbol();
   }
@@ -128,7 +128,7 @@ const MemRegion *SVal::getAsRegion() const {
   return 0;
 }
 
-const MemRegion *loc::MemRegionVal::StripCasts() const {
+const MemRegion *loc::MemRegionVal::stripCasts() const {
   const MemRegion *R = getRegion();
   return R ?  R->StripCasts() : NULL;
 }
index cca32e7b8683da6d4624a9176c4ff50ac6342cc6..e0b61ab58009beaef14d8dcb170c914573f710cd 100644 (file)
@@ -261,9 +261,9 @@ const GRState *SimpleConstraintManager::assumeSymRel(const GRState *state,
   ASTContext &Ctx = StateMgr.getContext();
 
   QualType T = Sym->getType(Ctx);
-  assert(T->isIntegerType() || Loc::IsLocType(T));
+  assert(T->isIntegerType() || Loc::isLocType(T));
   unsigned bitwidth = Ctx.getTypeSize(T);
-  bool isSymUnsigned = T->isUnsignedIntegerType() || Loc::IsLocType(T);
+  bool isSymUnsigned = T->isUnsignedIntegerType() || Loc::isLocType(T);
 
   // Convert the adjustment.
   Adjustment.setIsUnsigned(isSymUnsigned);
index 2642f58cd6cfe4700b8d63df077e2157cb7892bd..9a46bd6d69a06925b931b3a0deda5226a488eb78 100644 (file)
@@ -59,7 +59,7 @@ SValBuilder *ento::createSimpleSValBuilder(llvm::BumpPtrAllocator &alloc,
 
 SVal SimpleSValBuilder::evalCastNL(NonLoc val, QualType castTy) {
 
-  bool isLocType = Loc::IsLocType(castTy);
+  bool isLocType = Loc::isLocType(castTy);
 
   if (nonloc::LocAsInteger *LI = dyn_cast<nonloc::LocAsInteger>(&val)) {
     if (isLocType)
@@ -97,7 +97,7 @@ SVal SimpleSValBuilder::evalCastNL(NonLoc val, QualType castTy) {
     return UnknownVal();
 
   llvm::APSInt i = cast<nonloc::ConcreteInt>(val).getValue();
-  i.setIsUnsigned(castTy->isUnsignedIntegerType() || Loc::IsLocType(castTy));
+  i.setIsUnsigned(castTy->isUnsignedIntegerType() || Loc::isLocType(castTy));
   i = i.extOrTrunc(Context.getTypeSize(castTy));
 
   if (isLocType)
@@ -114,7 +114,7 @@ SVal SimpleSValBuilder::evalCastL(Loc val, QualType castTy) {
   //   can be introduced by the frontend for corner cases, e.g
   //   casting from va_list* to __builtin_va_list&.
   //
-  if (Loc::IsLocType(castTy) || castTy->isReferenceType())
+  if (Loc::isLocType(castTy) || castTy->isReferenceType())
     return val;
 
   // FIXME: Handle transparent unions where a value can be "transparently"
@@ -129,7 +129,7 @@ SVal SimpleSValBuilder::evalCastL(Loc val, QualType castTy) {
       return makeLocAsInteger(val, BitWidth);
 
     llvm::APSInt i = cast<loc::ConcreteInt>(val).getValue();
-    i.setIsUnsigned(castTy->isUnsignedIntegerType() || Loc::IsLocType(castTy));
+    i.setIsUnsigned(castTy->isUnsignedIntegerType() || Loc::isLocType(castTy));
     i = i.extOrTrunc(BitWidth);
     return makeIntVal(i);
   }
index f4ed8064029acb0b90e000b7a0c44486fd1a4c95..c1ca1cfcdc07cb50e29c05a00c2924738d14b7e9 100644 (file)
@@ -235,7 +235,7 @@ SymbolManager::~SymbolManager() {}
 bool SymbolManager::canSymbolicate(QualType T) {
   T = T.getCanonicalType();
 
-  if (Loc::IsLocType(T))
+  if (Loc::isLocType(T))
     return true;
 
   if (T->isIntegerType())