diff options
Diffstat (limited to 'lib/Analysis/SimpleConstraintManager.h')
-rw-r--r-- | lib/Analysis/SimpleConstraintManager.h | 86 |
1 files changed, 41 insertions, 45 deletions
diff --git a/lib/Analysis/SimpleConstraintManager.h b/lib/Analysis/SimpleConstraintManager.h index fb41e2f..1e1a10d 100644 --- a/lib/Analysis/SimpleConstraintManager.h +++ b/lib/Analysis/SimpleConstraintManager.h @@ -20,63 +20,59 @@ 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* St, SVal Cond, bool Assumption, - bool& isFeasible); - - const GRState* Assume(const GRState* St, Loc Cond, bool Assumption, - bool& isFeasible); + //===------------------------------------------------------------------===// + // Common implementation for the interface provided by ConstraintManager. + //===------------------------------------------------------------------===// - const GRState* AssumeAux(const GRState* St, Loc Cond,bool Assumption, - bool& isFeasible); - - const GRState* Assume(const GRState* St, NonLoc Cond, bool Assumption, - bool& isFeasible); - - const GRState* AssumeAux(const GRState* St, NonLoc Cond, bool Assumption, - bool& isFeasible); + bool canReasonAbout(SVal X) const; - const GRState* AssumeSymInt(const GRState* St, bool Assumption, - const SymIntExpr *SE, bool& isFeasible); + const GRState *Assume(const GRState *state, SVal Cond, bool Assumption); - virtual const GRState* AssumeSymNE(const GRState* St, SymbolRef sym, - const llvm::APSInt& V, - bool& isFeasible) = 0; + const GRState *Assume(const GRState *state, Loc Cond, bool Assumption); - virtual const GRState* AssumeSymEQ(const GRState* St, SymbolRef sym, - const llvm::APSInt& V, - bool& isFeasible) = 0; + const GRState *Assume(const GRState *state, NonLoc Cond, bool Assumption); - virtual const GRState* AssumeSymLT(const GRState* St, SymbolRef sym, - const llvm::APSInt& V, - bool& isFeasible) = 0; + const GRState *AssumeSymInt(const GRState *state, bool Assumption, + const SymIntExpr *SE); + + const GRState *AssumeInBound(const GRState *state, SVal Idx, SVal UpperBound, + bool Assumption); + +protected: + + //===------------------------------------------------------------------===// + // Interface that subclasses must implement. + //===------------------------------------------------------------------===// + + virtual const GRState *AssumeSymNE(const GRState *state, SymbolRef sym, + const llvm::APSInt& V) = 0; - virtual const GRState* AssumeSymGT(const GRState* St, SymbolRef sym, - const llvm::APSInt& V, - bool& isFeasible) = 0; + virtual const GRState *AssumeSymEQ(const GRState *state, SymbolRef sym, + const llvm::APSInt& V) = 0; - virtual const GRState* AssumeSymLE(const GRState* St, SymbolRef sym, - const llvm::APSInt& V, - bool& isFeasible) = 0; + virtual const GRState *AssumeSymLT(const GRState *state, SymbolRef sym, + const llvm::APSInt& V) = 0; - virtual const GRState* AssumeSymGE(const GRState* St, SymbolRef sym, - const llvm::APSInt& V, - bool& isFeasible) = 0; + virtual const GRState *AssumeSymGT(const GRState *state, SymbolRef sym, + const llvm::APSInt& V) = 0; - const GRState* AssumeInBound(const GRState* St, SVal Idx, SVal UpperBound, - bool Assumption, bool& isFeasible); + virtual const GRState *AssumeSymLE(const GRState *state, SymbolRef sym, + const llvm::APSInt& V) = 0; -private: - BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); } - SymbolManager& getSymbolManager() const { return StateMgr.getSymbolManager(); } + virtual const GRState *AssumeSymGE(const GRState *state, SymbolRef sym, + const llvm::APSInt& V) = 0; + + //===------------------------------------------------------------------===// + // Internal implementation. + //===------------------------------------------------------------------===// + + const GRState *AssumeAux(const GRState *state, Loc Cond,bool Assumption); + + const GRState *AssumeAux(const GRState *state, NonLoc Cond, bool Assumption); }; } // end clang namespace |