[analyzer] Refactoring: include/clang/Checker -> include/clang/GR
[clang.git] / lib / Checker / SimpleConstraintManager.h
blob45742ebd7d0e7d9ff60879e2272c978af826af1c
1 //== SimpleConstraintManager.h ----------------------------------*- 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 // 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/GR/PathSensitive/ConstraintManager.h"
18 #include "clang/GR/PathSensitive/GRState.h"
20 namespace clang {
22 class SimpleConstraintManager : public ConstraintManager {
23 GRSubEngine &SU;
24 public:
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,
35 bool Assumption);
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 *assumeSymRel(const GRState *state,
42 const SymExpr *LHS,
43 BinaryOperator::Opcode op,
44 const llvm::APSInt& Int);
46 protected:
48 //===------------------------------------------------------------------===//
49 // Interface that subclasses must implement.
50 //===------------------------------------------------------------------===//
52 // Each of these is of the form "$sym+Adj <> V", where "<>" is the comparison
53 // operation for the method being invoked.
54 virtual const GRState *assumeSymNE(const GRState *state, SymbolRef sym,
55 const llvm::APSInt& V,
56 const llvm::APSInt& Adjustment) = 0;
58 virtual const GRState *assumeSymEQ(const GRState *state, SymbolRef sym,
59 const llvm::APSInt& V,
60 const llvm::APSInt& Adjustment) = 0;
62 virtual const GRState *assumeSymLT(const GRState *state, SymbolRef sym,
63 const llvm::APSInt& V,
64 const llvm::APSInt& Adjustment) = 0;
66 virtual const GRState *assumeSymGT(const GRState *state, SymbolRef sym,
67 const llvm::APSInt& V,
68 const llvm::APSInt& Adjustment) = 0;
70 virtual const GRState *assumeSymLE(const GRState *state, SymbolRef sym,
71 const llvm::APSInt& V,
72 const llvm::APSInt& Adjustment) = 0;
74 virtual const GRState *assumeSymGE(const GRState *state, SymbolRef sym,
75 const llvm::APSInt& V,
76 const llvm::APSInt& Adjustment) = 0;
78 //===------------------------------------------------------------------===//
79 // Internal implementation.
80 //===------------------------------------------------------------------===//
82 const GRState *assumeAux(const GRState *state, Loc Cond,bool Assumption);
84 const GRState *assumeAux(const GRState *state, NonLoc Cond, bool Assumption);
87 } // end clang namespace
89 #endif