blob: 02292a1cbc4057ee3447af777207ed0f1571e670 [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
Ted Kremenek669c0e12009-02-15 18:24:51 +000080#endif