1 //== ConstraintManager.h - Constraints on symbolic values.-------*- C++ -*--==//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 // This file defined the interface to manage constraints on symbolic values.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_GR_CONSTRAINT_MANAGER_H
15 #define LLVM_CLANG_GR_CONSTRAINT_MANAGER_H
17 // FIXME: Typedef LiveSymbolsTy/DeadSymbolsTy at a more appropriate place.
18 #include "clang/StaticAnalyzer/Core/PathSensitive/Store.h"
33 class ConstraintManager {
35 virtual ~ConstraintManager();
36 virtual const GRState *assume(const GRState *state, DefinedSVal Cond,
39 std::pair<const GRState*, const GRState*> assumeDual(const GRState *state,
41 return std::make_pair(assume(state, Cond, true),
42 assume(state, Cond, false));
45 virtual const llvm::APSInt* getSymVal(const GRState *state,
46 SymbolRef sym) const = 0;
48 virtual bool isEqual(const GRState *state, SymbolRef sym,
49 const llvm::APSInt& V) const = 0;
51 virtual const GRState *removeDeadBindings(const GRState *state,
52 SymbolReaper& SymReaper) = 0;
54 virtual void print(const GRState *state, llvm::raw_ostream& Out,
55 const char* nl, const char *sep) = 0;
57 virtual void EndPath(const GRState *state) {}
59 /// canReasonAbout - Not all ConstraintManagers can accurately reason about
60 /// all SVal values. This method returns true if the ConstraintManager can
61 /// reasonably handle a given SVal value. This is typically queried by
62 /// ExprEngine to determine if the value should be replaced with a
63 /// conjured symbolic value in order to recover some precision.
64 virtual bool canReasonAbout(SVal X) const = 0;
67 ConstraintManager* CreateBasicConstraintManager(GRStateManager& statemgr,
68 SubEngine &subengine);
69 ConstraintManager* CreateRangeConstraintManager(GRStateManager& statemgr,
70 SubEngine &subengine);
74 } // end clang namespace