[cfe-commits] r63249 - in /cfe/trunk: include/clang/Analysis/PathSensitive/ConstraintManager.h include/clang/Analysis/PathSensitive/GRState.h lib/Analysis/BasicConstraintManager.cpp lib/Analysis/CFRefCount.cpp

Ted Kremenek kremenek at apple.com
Wed Jan 28 14:27:59 PST 2009


Author: kremenek
Date: Wed Jan 28 16:27:59 2009
New Revision: 63249

URL: http://llvm.org/viewvc/llvm-project?rev=63249&view=rev
Log:
Remove method 'AddNE' from the public interface of ConstraintManager.

Modified:
    cfe/trunk/include/clang/Analysis/PathSensitive/ConstraintManager.h
    cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
    cfe/trunk/lib/Analysis/BasicConstraintManager.cpp
    cfe/trunk/lib/Analysis/CFRefCount.cpp

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/ConstraintManager.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/ConstraintManager.h?rev=63249&r1=63248&r2=63249&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/ConstraintManager.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/ConstraintManager.h Wed Jan 28 16:27:59 2009
@@ -38,8 +38,6 @@
                                        SVal UpperBound, bool Assumption,
                                        bool& isFeasible) = 0;
 
-  virtual const GRState* AddNE(const GRState* St, SymbolRef sym, 
-                               const llvm::APSInt& V) = 0;
   virtual const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) = 0;
 
   virtual bool isEqual(const GRState* St, SymbolRef sym, 

Modified: cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h?rev=63249&r1=63248&r2=63249&view=diff

==============================================================================
--- cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h (original)
+++ cfe/trunk/include/clang/Analysis/PathSensitive/GRState.h Wed Jan 28 16:27:59 2009
@@ -603,10 +603,6 @@
                                         isFeasible);
   }
 
-  const GRState* AddNE(const GRState* St, SymbolRef sym, const llvm::APSInt& V) {
-    return ConstraintMgr->AddNE(St, sym, V);
-  }
-
   const llvm::APSInt* getSymVal(const GRState* St, SymbolRef sym) {
     return ConstraintMgr->getSymVal(St, sym);
   }
@@ -671,10 +667,6 @@
     return GRStateRef(Mgr->Unbind(St, LV), *Mgr);
   }
   
-  GRStateRef AddNE(SymbolRef sym, const llvm::APSInt& V) {
-    return GRStateRef(Mgr->AddNE(St, sym, V), *Mgr);
-  }
-  
   // Trait based GDM dispatch.
   template<typename T>
   typename GRStateTrait<T>::data_type get() const {
@@ -735,6 +727,10 @@
   SVal GetLValue(const VarDecl* VD) {
     return Mgr->GetLValue(St, VD);
   }
+    
+  GRStateRef Assume(SVal Cond, bool Assumption, bool& isFeasible) {
+    return GRStateRef(Mgr->Assume(St, Cond, Assumption, isFeasible), *Mgr);  
+  }
   
   // Pretty-printing.
   void print(std::ostream& Out, const char* nl = "\n",

Modified: cfe/trunk/lib/Analysis/BasicConstraintManager.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/BasicConstraintManager.cpp?rev=63249&r1=63248&r2=63249&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/BasicConstraintManager.cpp (original)
+++ cfe/trunk/lib/Analysis/BasicConstraintManager.cpp Wed Jan 28 16:27:59 2009
@@ -72,7 +72,7 @@
                               const SymIntConstraint& C, bool& isFeasible);
 
   const GRState* AssumeSymNE(const GRState* St, SymbolRef sym,
-                                const llvm::APSInt& V, bool& isFeasible);
+                             const llvm::APSInt& V, bool& isFeasible);
 
   const GRState* AssumeSymEQ(const GRState* St, SymbolRef sym,
                                 const llvm::APSInt& V, bool& isFeasible);

Modified: cfe/trunk/lib/Analysis/CFRefCount.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/CFRefCount.cpp?rev=63249&r1=63248&r2=63249&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/CFRefCount.cpp (original)
+++ cfe/trunk/lib/Analysis/CFRefCount.cpp Wed Jan 28 16:27:59 2009
@@ -1678,8 +1678,11 @@
 #endif 
 
       // FIXME: Add a flag to the checker where allocations are allowed to fail.      
-      if (RE.getKind() == RetEffect::OwnedAllocatedSymbol)
-        state = state.AddNE(Sym, Eng.getBasicVals().getZeroWithPtrWidth());
+      if (RE.getKind() == RetEffect::OwnedAllocatedSymbol) {
+        bool isFeasible;
+        state = state.Assume(loc::SymbolVal(Sym), true, isFeasible);
+        assert(isFeasible && "Cannot assume fresh symbol is non-null.");        
+      }
       
       break;
     }





More information about the cfe-commits mailing list