Zhongxing Xu | 8647924 | 2008-08-29 15:09:12 +0000 | [diff] [blame] | 1 | //== ConstraintManager.h - Constraints on symbolic values.-------*- 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 | // This file defined the interface to manage constraints on symbolic values. |
| 11 | // |
| 12 | //===----------------------------------------------------------------------===// |
| 13 | |
Zhongxing Xu | c6b27d0 | 2008-08-29 14:52:36 +0000 | [diff] [blame] | 14 | #ifndef LLVM_CLANG_ANALYSIS_CONSTRAINT_MANAGER_H |
| 15 | #define LLVM_CLANG_ANALYSIS_CONSTRAINT_MANAGER_H |
| 16 | |
| 17 | // FIXME: Typedef LiveSymbolsTy/DeadSymbolsTy at a more appropriate place. |
| 18 | #include "clang/Analysis/PathSensitive/Store.h" |
| 19 | |
| 20 | namespace llvm { |
| 21 | class APSInt; |
| 22 | } |
Zhongxing Xu | c669497 | 2008-08-27 14:03:33 +0000 | [diff] [blame] | 23 | |
| 24 | namespace clang { |
| 25 | |
| 26 | class GRState; |
| 27 | class GRStateManager; |
Zhongxing Xu | 097fc98 | 2008-10-17 05:57:07 +0000 | [diff] [blame] | 28 | class SVal; |
Zhongxing Xu | c6b27d0 | 2008-08-29 14:52:36 +0000 | [diff] [blame] | 29 | class SymbolID; |
Zhongxing Xu | c669497 | 2008-08-27 14:03:33 +0000 | [diff] [blame] | 30 | |
| 31 | class ConstraintManager { |
| 32 | public: |
Ted Kremenek | 8904fbe | 2008-08-27 23:13:01 +0000 | [diff] [blame] | 33 | virtual ~ConstraintManager(); |
Zhongxing Xu | 097fc98 | 2008-10-17 05:57:07 +0000 | [diff] [blame] | 34 | virtual const GRState* Assume(const GRState* St, SVal Cond, |
| 35 | bool Assumption, bool& isFeasible) = 0; |
Zhongxing Xu | c6b27d0 | 2008-08-29 14:52:36 +0000 | [diff] [blame] | 36 | |
Zhongxing Xu | d52b8cf | 2008-11-22 13:21:46 +0000 | [diff] [blame] | 37 | virtual const GRState* AssumeInBound(const GRState* St, SVal Idx, |
| 38 | SVal UpperBound, bool Assumption, |
| 39 | bool& isFeasible) = 0; |
| 40 | |
Zhongxing Xu | c6b27d0 | 2008-08-29 14:52:36 +0000 | [diff] [blame] | 41 | virtual const GRState* AddNE(const GRState* St, SymbolID sym, |
| 42 | const llvm::APSInt& V) = 0; |
| 43 | virtual const llvm::APSInt* getSymVal(const GRState* St, SymbolID sym) = 0; |
| 44 | |
| 45 | virtual bool isEqual(const GRState* St, SymbolID sym, |
| 46 | const llvm::APSInt& V) const = 0; |
| 47 | |
| 48 | virtual const GRState* RemoveDeadBindings(const GRState* St, |
| 49 | StoreManager::LiveSymbolsTy& LSymbols, |
| 50 | StoreManager::DeadSymbolsTy& DSymbols) = 0; |
| 51 | |
| 52 | virtual void print(const GRState* St, std::ostream& Out, |
| 53 | const char* nl, const char *sep) = 0; |
Zhongxing Xu | 8067064 | 2008-11-28 03:07:05 +0000 | [diff] [blame] | 54 | |
| 55 | virtual void EndPath(const GRState* St) {} |
Zhongxing Xu | c669497 | 2008-08-27 14:03:33 +0000 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr); |
| 59 | |
| 60 | } // end clang namespace |
| 61 | |
| 62 | #endif |