Ted Kremenek | 4502195 | 2009-02-14 17:08:39 +0000 | [diff] [blame] | 1 | //== SimpleConstraintManager.h ----------------------------------*- C++ -*--==// |
| 2 | // |
| 3 | // The LLVM Compiler Infrastructure |
| 4 | // |
| 5 | // This file is distributed under the University of Illinois Open Source |
| 6 | // License. See LICENSE.TXT for details. |
| 7 | // |
| 8 | //===----------------------------------------------------------------------===// |
| 9 | // |
| 10 | // Code shared between BasicConstraintManager and RangeConstraintManager. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
| 14 | #ifndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H |
| 15 | #define LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H |
| 16 | |
| 17 | #include "clang/Analysis/PathSensitive/ConstraintManager.h" |
| 18 | #include "clang/Analysis/PathSensitive/GRState.h" |
| 19 | |
| 20 | namespace clang { |
| 21 | |
| 22 | class SimpleConstraintManager : public ConstraintManager { |
| 23 | protected: |
| 24 | GRStateManager& StateMgr; |
| 25 | public: |
| 26 | SimpleConstraintManager(GRStateManager& statemgr) |
| 27 | : StateMgr(statemgr) {} |
| 28 | virtual ~SimpleConstraintManager(); |
Ted Kremenek | 66b5271 | 2009-03-11 02:22:59 +0000 | [diff] [blame] | 29 | |
| 30 | bool canReasonAbout(SVal X) const; |
| 31 | |
Ted Kremenek | 4502195 | 2009-02-14 17:08:39 +0000 | [diff] [blame] | 32 | virtual const GRState* Assume(const GRState* St, SVal Cond, bool Assumption, |
| 33 | bool& isFeasible); |
| 34 | |
| 35 | const GRState* Assume(const GRState* St, Loc Cond, bool Assumption, |
| 36 | bool& isFeasible); |
| 37 | |
| 38 | const GRState* AssumeAux(const GRState* St, Loc Cond,bool Assumption, |
| 39 | bool& isFeasible); |
| 40 | |
| 41 | const GRState* Assume(const GRState* St, NonLoc Cond, bool Assumption, |
| 42 | bool& isFeasible); |
| 43 | |
| 44 | const GRState* AssumeAux(const GRState* St, NonLoc Cond, bool Assumption, |
| 45 | bool& isFeasible); |
| 46 | |
| 47 | const GRState* AssumeSymInt(const GRState* St, bool Assumption, |
Ted Kremenek | e0e4ebf | 2009-03-26 03:35:11 +0000 | [diff] [blame] | 48 | const SymIntExpr *SE, bool& isFeasible); |
Ted Kremenek | 4502195 | 2009-02-14 17:08:39 +0000 | [diff] [blame] | 49 | |
| 50 | virtual const GRState* AssumeSymNE(const GRState* St, SymbolRef sym, |
| 51 | const llvm::APSInt& V, |
| 52 | bool& isFeasible) = 0; |
| 53 | |
| 54 | virtual const GRState* AssumeSymEQ(const GRState* St, SymbolRef sym, |
| 55 | const llvm::APSInt& V, |
| 56 | bool& isFeasible) = 0; |
| 57 | |
| 58 | virtual const GRState* AssumeSymLT(const GRState* St, SymbolRef sym, |
| 59 | const llvm::APSInt& V, |
| 60 | bool& isFeasible) = 0; |
| 61 | |
| 62 | virtual const GRState* AssumeSymGT(const GRState* St, SymbolRef sym, |
| 63 | const llvm::APSInt& V, |
| 64 | bool& isFeasible) = 0; |
| 65 | |
| 66 | virtual const GRState* AssumeSymLE(const GRState* St, SymbolRef sym, |
| 67 | const llvm::APSInt& V, |
| 68 | bool& isFeasible) = 0; |
| 69 | |
| 70 | virtual const GRState* AssumeSymGE(const GRState* St, SymbolRef sym, |
| 71 | const llvm::APSInt& V, |
| 72 | bool& isFeasible) = 0; |
| 73 | |
| 74 | const GRState* AssumeInBound(const GRState* St, SVal Idx, SVal UpperBound, |
| 75 | bool Assumption, bool& isFeasible); |
| 76 | |
| 77 | private: |
| 78 | BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); } |
Zhongxing Xu | a129eb9 | 2009-03-25 05:58:37 +0000 | [diff] [blame] | 79 | SymbolManager& getSymbolManager() const { return StateMgr.getSymbolManager(); } |
Ted Kremenek | 4502195 | 2009-02-14 17:08:39 +0000 | [diff] [blame] | 80 | }; |
| 81 | |
| 82 | } // end clang namespace |
| 83 | |
Ted Kremenek | 669c0e1 | 2009-02-15 18:24:51 +0000 | [diff] [blame] | 84 | #endif |