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_ANALYSIS_CONSTRAINT_MANAGER_H
15 #define LLVM_CLANG_ANALYSIS_CONSTRAINT_MANAGER_H
17 // FIXME: Typedef LiveSymbolsTy/DeadSymbolsTy at a more appropriate place.
18 #include "clang/GR/PathSensitive/Store.h"
31 class ConstraintManager
{
33 virtual ~ConstraintManager();
34 virtual const GRState
*assume(const GRState
*state
, DefinedSVal Cond
,
37 std::pair
<const GRState
*, const GRState
*> assumeDual(const GRState
*state
,
39 return std::make_pair(assume(state
, Cond
, true),
40 assume(state
, Cond
, false));
43 virtual const llvm::APSInt
* getSymVal(const GRState
*state
,
44 SymbolRef sym
) const = 0;
46 virtual bool isEqual(const GRState
*state
, SymbolRef sym
,
47 const llvm::APSInt
& V
) const = 0;
49 virtual const GRState
*RemoveDeadBindings(const GRState
*state
,
50 SymbolReaper
& SymReaper
) = 0;
52 virtual void print(const GRState
*state
, llvm::raw_ostream
& Out
,
53 const char* nl
, const char *sep
) = 0;
55 virtual void EndPath(const GRState
*state
) {}
57 /// canReasonAbout - Not all ConstraintManagers can accurately reason about
58 /// all SVal values. This method returns true if the ConstraintManager can
59 /// reasonably handle a given SVal value. This is typically queried by
60 /// GRExprEngine to determine if the value should be replaced with a
61 /// conjured symbolic value in order to recover some precision.
62 virtual bool canReasonAbout(SVal X
) const = 0;
65 ConstraintManager
* CreateBasicConstraintManager(GRStateManager
& statemgr
,
66 GRSubEngine
&subengine
);
67 ConstraintManager
* CreateRangeConstraintManager(GRStateManager
& statemgr
,
68 GRSubEngine
&subengine
);
70 } // end clang namespace