Deleted Added
full compact
ConstraintManager.h (226633) ConstraintManager.h (234353)
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//===----------------------------------------------------------------------===//

--- 8 unchanged lines hidden (view full) ---

17#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
18#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
19
20namespace llvm {
21class APSInt;
22}
23
24namespace clang {
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//===----------------------------------------------------------------------===//

--- 8 unchanged lines hidden (view full) ---

17#include "clang/StaticAnalyzer/Core/PathSensitive/SymbolManager.h"
18#include "clang/StaticAnalyzer/Core/PathSensitive/SVals.h"
19
20namespace llvm {
21class APSInt;
22}
23
24namespace clang {
25
26namespace ento {
27
25namespace ento {
26
28class ProgramState;
29class ProgramStateManager;
30class SubEngine;
31
32class ConstraintManager {
33public:
34 virtual ~ConstraintManager();
27class SubEngine;
28
29class ConstraintManager {
30public:
31 virtual ~ConstraintManager();
35 virtual const ProgramState *assume(const ProgramState *state,
32 virtual ProgramStateRef assume(ProgramStateRef state,
36 DefinedSVal Cond,
37 bool Assumption) = 0;
38
33 DefinedSVal Cond,
34 bool Assumption) = 0;
35
39 std::pair<const ProgramState*, const ProgramState*>
40 assumeDual(const ProgramState *state, DefinedSVal Cond)
36 std::pair<ProgramStateRef, ProgramStateRef >
37 assumeDual(ProgramStateRef state, DefinedSVal Cond)
41 {
38 {
42 return std::make_pair(assume(state, Cond, true),
43 assume(state, Cond, false));
39 std::pair<ProgramStateRef, ProgramStateRef > res =
40 std::make_pair(assume(state, Cond, true), assume(state, Cond, false));
41
42 assert(!(!res.first && !res.second) && "System is over constrained.");
43 return res;
44 }
45
44 }
45
46 virtual const llvm::APSInt* getSymVal(const ProgramState *state,
46 virtual const llvm::APSInt* getSymVal(ProgramStateRef state,
47 SymbolRef sym) const = 0;
48
47 SymbolRef sym) const = 0;
48
49 virtual bool isEqual(const ProgramState *state,
49 virtual bool isEqual(ProgramStateRef state,
50 SymbolRef sym,
51 const llvm::APSInt& V) const = 0;
52
50 SymbolRef sym,
51 const llvm::APSInt& V) const = 0;
52
53 virtual const ProgramState *removeDeadBindings(const ProgramState *state,
53 virtual ProgramStateRef removeDeadBindings(ProgramStateRef state,
54 SymbolReaper& SymReaper) = 0;
55
54 SymbolReaper& SymReaper) = 0;
55
56 virtual void print(const ProgramState *state,
56 virtual void print(ProgramStateRef state,
57 raw_ostream &Out,
58 const char* nl,
59 const char *sep) = 0;
60
57 raw_ostream &Out,
58 const char* nl,
59 const char *sep) = 0;
60
61 virtual void EndPath(const ProgramState *state) {}
61 virtual void EndPath(ProgramStateRef state) {}
62
62
63protected:
63 /// canReasonAbout - Not all ConstraintManagers can accurately reason about
64 /// all SVal values. This method returns true if the ConstraintManager can
65 /// reasonably handle a given SVal value. This is typically queried by
66 /// ExprEngine to determine if the value should be replaced with a
67 /// conjured symbolic value in order to recover some precision.
68 virtual bool canReasonAbout(SVal X) const = 0;
69};
70
71ConstraintManager* CreateBasicConstraintManager(ProgramStateManager& statemgr,
72 SubEngine &subengine);
73ConstraintManager* CreateRangeConstraintManager(ProgramStateManager& statemgr,
74 SubEngine &subengine);
75
76} // end GR namespace
77
78} // end clang namespace
79
80#endif
64 /// canReasonAbout - Not all ConstraintManagers can accurately reason about
65 /// all SVal values. This method returns true if the ConstraintManager can
66 /// reasonably handle a given SVal value. This is typically queried by
67 /// ExprEngine to determine if the value should be replaced with a
68 /// conjured symbolic value in order to recover some precision.
69 virtual bool canReasonAbout(SVal X) const = 0;
70};
71
72ConstraintManager* CreateBasicConstraintManager(ProgramStateManager& statemgr,
73 SubEngine &subengine);
74ConstraintManager* CreateRangeConstraintManager(ProgramStateManager& statemgr,
75 SubEngine &subengine);
76
77} // end GR namespace
78
79} // end clang namespace
80
81#endif