From: Ted Kremenek Date: Thu, 18 Jun 2009 23:20:05 +0000 (+0000) Subject: Remove GRStateManager& field from SimpleConstraintManager. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f1b8227d758721075e3a84a85e66cb7173334b13;p=clang Remove GRStateManager& field from SimpleConstraintManager. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@73735 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/lib/Analysis/BasicConstraintManager.cpp b/lib/Analysis/BasicConstraintManager.cpp index 7bd22fd313..ffa8a8625b 100644 --- a/lib/Analysis/BasicConstraintManager.cpp +++ b/lib/Analysis/BasicConstraintManager.cpp @@ -51,7 +51,7 @@ class VISIBILITY_HIDDEN BasicConstraintManager GRState::IntSetTy::Factory ISetFactory; public: BasicConstraintManager(GRStateManager& statemgr) - : SimpleConstraintManager(statemgr), ISetFactory(statemgr.getAllocator()) {} + : ISetFactory(statemgr.getAllocator()) {} const GRState* AssumeSymNE(const GRState* state, SymbolRef sym, const llvm::APSInt& V); diff --git a/lib/Analysis/RangeConstraintManager.cpp b/lib/Analysis/RangeConstraintManager.cpp index 3b4d0c4122..73c68bcaea 100644 --- a/lib/Analysis/RangeConstraintManager.cpp +++ b/lib/Analysis/RangeConstraintManager.cpp @@ -235,8 +235,7 @@ namespace { class VISIBILITY_HIDDEN RangeConstraintManager : public SimpleConstraintManager{ RangeSet GetRange(const GRState *state, SymbolRef sym); public: - RangeConstraintManager(GRStateManager& statemgr) - : SimpleConstraintManager(statemgr) {} + RangeConstraintManager() {} const GRState* AssumeSymNE(const GRState* St, SymbolRef sym, const llvm::APSInt& V); @@ -275,9 +274,8 @@ private: } // end anonymous namespace -ConstraintManager* clang::CreateRangeConstraintManager(GRStateManager& StateMgr) -{ - return new RangeConstraintManager(StateMgr); +ConstraintManager* clang::CreateRangeConstraintManager(GRStateManager&) { + return new RangeConstraintManager(); } const llvm::APSInt* RangeConstraintManager::getSymVal(const GRState* St, diff --git a/lib/Analysis/SimpleConstraintManager.cpp b/lib/Analysis/SimpleConstraintManager.cpp index 6e858891fa..82801eb05d 100644 --- a/lib/Analysis/SimpleConstraintManager.cpp +++ b/lib/Analysis/SimpleConstraintManager.cpp @@ -234,7 +234,7 @@ const GRState *SimpleConstraintManager::AssumeInBound(const GRState *state, if (!(isa(Idx) && isa(UpperBound))) return state; - const llvm::APSInt& Zero = getBasicVals().getZeroWithPtrWidth(false); + const llvm::APSInt& Zero = state->getBasicVals().getZeroWithPtrWidth(false); llvm::APSInt IdxV = cast(Idx).getValue(); // IdxV might be too narrow. if (IdxV.getBitWidth() < Zero.getBitWidth()) diff --git a/lib/Analysis/SimpleConstraintManager.h b/lib/Analysis/SimpleConstraintManager.h index bd18b6af93..1e1a10da03 100644 --- a/lib/Analysis/SimpleConstraintManager.h +++ b/lib/Analysis/SimpleConstraintManager.h @@ -20,22 +20,18 @@ namespace clang { class SimpleConstraintManager : public ConstraintManager { -protected: - GRStateManager& StateMgr; public: - SimpleConstraintManager(GRStateManager& statemgr) - : StateMgr(statemgr) {} - virtual ~SimpleConstraintManager(); - - bool canReasonAbout(SVal X) const; + SimpleConstraintManager() {} + virtual ~SimpleConstraintManager(); - virtual const GRState *Assume(const GRState *state, SVal Cond, - bool Assumption); - //===------------------------------------------------------------------===// // Common implementation for the interface provided by ConstraintManager. //===------------------------------------------------------------------===// - + + bool canReasonAbout(SVal X) const; + + const GRState *Assume(const GRState *state, SVal Cond, bool Assumption); + const GRState *Assume(const GRState *state, Loc Cond, bool Assumption); const GRState *Assume(const GRState *state, NonLoc Cond, bool Assumption); @@ -77,14 +73,6 @@ protected: const GRState *AssumeAux(const GRState *state, Loc Cond,bool Assumption); const GRState *AssumeAux(const GRState *state, NonLoc Cond, bool Assumption); - - //===------------------------------------------------------------------===// - // FIXME: These can probably be removed now. - //===------------------------------------------------------------------===// - -private: - BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); } - SymbolManager& getSymbolManager() const { return StateMgr.getSymbolManager(); } }; } // end clang namespace