1 //== SimpleConstraintManager.h ----------------------------------*- 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 // Code shared between BasicConstraintManager and RangeConstraintManager.
12 //===----------------------------------------------------------------------===//
14 #ifndef LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
15 #define LLVM_CLANG_ANALYSIS_SIMPLE_CONSTRAINT_MANAGER_H
17 #include "clang/Checker/PathSensitive/ConstraintManager.h"
18 #include "clang/Checker/PathSensitive/GRState.h"
22 class SimpleConstraintManager : public ConstraintManager {
25 SimpleConstraintManager(GRSubEngine &subengine) : SU(subengine) {}
26 virtual ~SimpleConstraintManager();
28 //===------------------------------------------------------------------===//
29 // Common implementation for the interface provided by ConstraintManager.
30 //===------------------------------------------------------------------===//
32 bool canReasonAbout(SVal X) const;
34 const GRState *Assume(const GRState *state, DefinedSVal Cond,
37 const GRState *Assume(const GRState *state, Loc Cond, bool Assumption);
39 const GRState *Assume(const GRState *state, NonLoc Cond, bool Assumption);
41 const GRState *AssumeSymInt(const GRState *state, bool Assumption,
42 const SymIntExpr *SE);
44 const GRState *AssumeInBound(const GRState *state, DefinedSVal Idx,
45 DefinedSVal UpperBound,
50 //===------------------------------------------------------------------===//
51 // Interface that subclasses must implement.
52 //===------------------------------------------------------------------===//
54 virtual const GRState *AssumeSymNE(const GRState *state, SymbolRef sym,
55 const llvm::APSInt& V) = 0;
57 virtual const GRState *AssumeSymEQ(const GRState *state, SymbolRef sym,
58 const llvm::APSInt& V) = 0;
60 virtual const GRState *AssumeSymLT(const GRState *state, SymbolRef sym,
61 const llvm::APSInt& V) = 0;
63 virtual const GRState *AssumeSymGT(const GRState *state, SymbolRef sym,
64 const llvm::APSInt& V) = 0;
66 virtual const GRState *AssumeSymLE(const GRState *state, SymbolRef sym,
67 const llvm::APSInt& V) = 0;
69 virtual const GRState *AssumeSymGE(const GRState *state, SymbolRef sym,
70 const llvm::APSInt& V) = 0;
72 //===------------------------------------------------------------------===//
73 // Internal implementation.
74 //===------------------------------------------------------------------===//
76 const GRState *AssumeAux(const GRState *state, Loc Cond,bool Assumption);
78 const GRState *AssumeAux(const GRState *state, NonLoc Cond, bool Assumption);
81 } // end clang namespace