blob: 54cdecbf212fdbb426238033d3667394cc9801f8 [file] [log] [blame]
Zhongxing Xu86479242008-08-29 15:09:12 +00001//== 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 Xuc6b27d02008-08-29 14:52:36 +000014#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
20namespace llvm {
21class APSInt;
22}
Zhongxing Xuc6694972008-08-27 14:03:33 +000023
24namespace clang {
25
26class GRState;
27class GRStateManager;
Zhongxing Xu097fc982008-10-17 05:57:07 +000028class SVal;
Zhongxing Xuc6b27d02008-08-29 14:52:36 +000029class SymbolID;
Zhongxing Xuc6694972008-08-27 14:03:33 +000030
31class ConstraintManager {
32public:
Ted Kremenek8904fbe2008-08-27 23:13:01 +000033 virtual ~ConstraintManager();
Zhongxing Xu097fc982008-10-17 05:57:07 +000034 virtual const GRState* Assume(const GRState* St, SVal Cond,
35 bool Assumption, bool& isFeasible) = 0;
Zhongxing Xuc6b27d02008-08-29 14:52:36 +000036
Zhongxing Xud52b8cf2008-11-22 13:21:46 +000037 virtual const GRState* AssumeInBound(const GRState* St, SVal Idx,
38 SVal UpperBound, bool Assumption,
39 bool& isFeasible) = 0;
40
Zhongxing Xuc6b27d02008-08-29 14:52:36 +000041 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 Xu80670642008-11-28 03:07:05 +000054
55 virtual void EndPath(const GRState* St) {}
Zhongxing Xuc6694972008-08-27 14:03:33 +000056};
57
58ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr);
59
60} // end clang namespace
61
62#endif