blob: 5d5a5133694657061157e8ad742e410dc3ebec94 [file] [log] [blame]
Ted Kremenek45021952009-02-14 17:08:39 +00001//== 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
20namespace clang {
21
22class SimpleConstraintManager : public ConstraintManager {
23protected:
24 GRStateManager& StateMgr;
25public:
26 SimpleConstraintManager(GRStateManager& statemgr)
27 : StateMgr(statemgr) {}
28 virtual ~SimpleConstraintManager();
29 virtual const GRState* Assume(const GRState* St, SVal Cond, bool Assumption,
30 bool& isFeasible);
31
32 const GRState* Assume(const GRState* St, Loc Cond, bool Assumption,
33 bool& isFeasible);
34
35 const GRState* AssumeAux(const GRState* St, Loc Cond,bool Assumption,
36 bool& isFeasible);
37
38 const GRState* Assume(const GRState* St, NonLoc Cond, bool Assumption,
39 bool& isFeasible);
40
41 const GRState* AssumeAux(const GRState* St, NonLoc Cond, bool Assumption,
42 bool& isFeasible);
43
44 const GRState* AssumeSymInt(const GRState* St, bool Assumption,
45 const SymIntConstraint& C, bool& isFeasible);
46
47 virtual const GRState* AssumeSymNE(const GRState* St, SymbolRef sym,
48 const llvm::APSInt& V,
49 bool& isFeasible) = 0;
50
51 virtual const GRState* AssumeSymEQ(const GRState* St, SymbolRef sym,
52 const llvm::APSInt& V,
53 bool& isFeasible) = 0;
54
55 virtual const GRState* AssumeSymLT(const GRState* St, SymbolRef sym,
56 const llvm::APSInt& V,
57 bool& isFeasible) = 0;
58
59 virtual const GRState* AssumeSymGT(const GRState* St, SymbolRef sym,
60 const llvm::APSInt& V,
61 bool& isFeasible) = 0;
62
63 virtual const GRState* AssumeSymLE(const GRState* St, SymbolRef sym,
64 const llvm::APSInt& V,
65 bool& isFeasible) = 0;
66
67 virtual const GRState* AssumeSymGE(const GRState* St, SymbolRef sym,
68 const llvm::APSInt& V,
69 bool& isFeasible) = 0;
70
71 const GRState* AssumeInBound(const GRState* St, SVal Idx, SVal UpperBound,
72 bool Assumption, bool& isFeasible);
73
74private:
75 BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); }
76};
77
78} // end clang namespace
79
80#endif // ndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
81//== SimpleConstraintManager.h ----------------------------------*- C++ -*--==//
82//
83// The LLVM Compiler Infrastructure
84//
85// This file is distributed under the University of Illinois Open Source
86// License. See LICENSE.TXT for details.
87//
88//===----------------------------------------------------------------------===//
89//
90// Code shared between BasicConstraintManager and RangeConstraintManager.
91//
92//===----------------------------------------------------------------------===//
93
94#ifndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
95#define LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
96
97#include "clang/Analysis/PathSensitive/ConstraintManager.h"
98#include "clang/Analysis/PathSensitive/GRState.h"
99
100namespace clang {
101
102class SimpleConstraintManager : public ConstraintManager {
103protected:
104 GRStateManager& StateMgr;
105public:
106 SimpleConstraintManager(GRStateManager& statemgr)
107 : StateMgr(statemgr) {}
108 virtual ~SimpleConstraintManager();
109 virtual const GRState* Assume(const GRState* St, SVal Cond, bool Assumption,
110 bool& isFeasible);
111
112 const GRState* Assume(const GRState* St, Loc Cond, bool Assumption,
113 bool& isFeasible);
114
115 const GRState* AssumeAux(const GRState* St, Loc Cond,bool Assumption,
116 bool& isFeasible);
117
118 const GRState* Assume(const GRState* St, NonLoc Cond, bool Assumption,
119 bool& isFeasible);
120
121 const GRState* AssumeAux(const GRState* St, NonLoc Cond, bool Assumption,
122 bool& isFeasible);
123
124 const GRState* AssumeSymInt(const GRState* St, bool Assumption,
125 const SymIntConstraint& C, bool& isFeasible);
126
127 virtual const GRState* AssumeSymNE(const GRState* St, SymbolRef sym,
128 const llvm::APSInt& V,
129 bool& isFeasible) = 0;
130
131 virtual const GRState* AssumeSymEQ(const GRState* St, SymbolRef sym,
132 const llvm::APSInt& V,
133 bool& isFeasible) = 0;
134
135 virtual const GRState* AssumeSymLT(const GRState* St, SymbolRef sym,
136 const llvm::APSInt& V,
137 bool& isFeasible) = 0;
138
139 virtual const GRState* AssumeSymGT(const GRState* St, SymbolRef sym,
140 const llvm::APSInt& V,
141 bool& isFeasible) = 0;
142
143 virtual const GRState* AssumeSymLE(const GRState* St, SymbolRef sym,
144 const llvm::APSInt& V,
145 bool& isFeasible) = 0;
146
147 virtual const GRState* AssumeSymGE(const GRState* St, SymbolRef sym,
148 const llvm::APSInt& V,
149 bool& isFeasible) = 0;
150
151 const GRState* AssumeInBound(const GRState* St, SVal Idx, SVal UpperBound,
152 bool Assumption, bool& isFeasible);
153
154private:
155 BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); }
156};
157
158} // end clang namespace
159
160#endif // ndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H