[analyzer] Refactoring: include/clang/Checker -> include/clang/GR
[clang.git] / include / clang / GR / PathSensitive / ConstraintManager.h
blobc845a4464562e3a828f32554079f823adc5ed57f
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 //===----------------------------------------------------------------------===//
9 //
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"
20 namespace llvm {
21 class APSInt;
24 namespace clang {
26 class GRState;
27 class GRStateManager;
28 class GRSubEngine;
29 class SVal;
31 class ConstraintManager {
32 public:
33 virtual ~ConstraintManager();
34 virtual const GRState *assume(const GRState *state, DefinedSVal Cond,
35 bool Assumption) = 0;
37 std::pair<const GRState*, const GRState*> assumeDual(const GRState *state,
38 DefinedSVal Cond) {
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
72 #endif