diff options
-rw-r--r-- | include/clang/Analysis/PathSensitive/ConstraintManager.h | 2 | ||||
-rw-r--r-- | include/clang/Analysis/PathSensitive/GRState.h | 12 | ||||
-rw-r--r-- | lib/Analysis/BasicConstraintManager.cpp | 2 | ||||
-rw-r--r-- | lib/Analysis/CFRefCount.cpp | 7 |
4 files changed, 10 insertions, 13 deletions
diff --git a/include/clang/Analysis/PathSensitive/ConstraintManager.h b/include/clang/Analysis/PathSensitive/ConstraintManager.h index 4cded5ce69..6b69a1020c 100644 --- a/include/clang/Analysis/PathSensitive/ConstraintManager.h +++ b/include/clang/Analysis/PathSensitive/ConstraintManager.h @@ -38,8 +38,6 @@ public: 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, diff --git a/include/clang/Analysis/PathSensitive/GRState.h b/include/clang/Analysis/PathSensitive/GRState.h index 45ad702346..b227f91a78 100644 --- a/include/clang/Analysis/PathSensitive/GRState.h +++ b/include/clang/Analysis/PathSensitive/GRState.h @@ -603,10 +603,6 @@ public: 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 @@ public: 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 @@ public: 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", diff --git a/lib/Analysis/BasicConstraintManager.cpp b/lib/Analysis/BasicConstraintManager.cpp index 7496c5f5aa..f14ada7aed 100644 --- a/lib/Analysis/BasicConstraintManager.cpp +++ b/lib/Analysis/BasicConstraintManager.cpp @@ -72,7 +72,7 @@ public: 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); diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp index 2d5cb5f5b8..6f1b1036b3 100644 --- a/lib/Analysis/CFRefCount.cpp +++ b/lib/Analysis/CFRefCount.cpp @@ -1678,8 +1678,11 @@ void CFRefCount::EvalSummary(ExplodedNodeSet<GRState>& Dst, #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; } |