blob: fb41e2f1dab24fed520dd77cddb695acfdf59028 [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();
Ted Kremenek66b52712009-03-11 02:22:59 +000029
30 bool canReasonAbout(SVal X) const;
31
Ted Kremenek45021952009-02-14 17:08:39 +000032 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 Kremeneke0e4ebf2009-03-26 03:35:11 +000048 const SymIntExpr *SE, bool& isFeasible);
Ted Kremenek45021952009-02-14 17:08:39 +000049
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
77private:
78 BasicValueFactory& getBasicVals() { return StateMgr.getBasicVals(); }
Zhongxing Xua129eb92009-03-25 05:58:37 +000079 SymbolManager& getSymbolManager() const { return StateMgr.getSymbolManager(); }
Ted Kremenek45021952009-02-14 17:08:39 +000080};
81
82} // end clang namespace
83
Ted Kremenek669c0e12009-02-15 18:24:51 +000084#endif