[analyzer] Move the files in lib/StaticAnalyzer to lib/StaticAnalyzer/Core.
[clang.git] / lib / StaticAnalyzer / Core / SimpleConstraintManager.h
blob75f67f7f17e5185df9be766716f1b7e1d7b72653
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_GR_SIMPLE_CONSTRAINT_MANAGER_H
15 #define LLVM_CLANG_GR_SIMPLE_CONSTRAINT_MANAGER_H
17 #include "clang/StaticAnalyzer/PathSensitive/ConstraintManager.h"
18 #include "clang/StaticAnalyzer/PathSensitive/GRState.h"
20 namespace clang {
22 namespace ento {
24 class SimpleConstraintManager : public ConstraintManager {
25 SubEngine &SU;
26 public:
27 SimpleConstraintManager(SubEngine &subengine) : SU(subengine) {}
28 virtual ~SimpleConstraintManager();
30 //===------------------------------------------------------------------===//
31 // Common implementation for the interface provided by ConstraintManager.
32 //===------------------------------------------------------------------===//
34 bool canReasonAbout(SVal X) const;
36 const GRState *assume(const GRState *state, DefinedSVal Cond,
37 bool Assumption);
39 const GRState *assume(const GRState *state, Loc Cond, bool Assumption);
41 const GRState *assume(const GRState *state, NonLoc Cond, bool Assumption);
43 const GRState *assumeSymRel(const GRState *state,
44 const SymExpr *LHS,
45 BinaryOperator::Opcode op,
46 const llvm::APSInt& Int);
48 protected:
50 //===------------------------------------------------------------------===//
51 // Interface that subclasses must implement.
52 //===------------------------------------------------------------------===//
54 // Each of these is of the form "$sym+Adj <> V", where "<>" is the comparison
55 // operation for the method being invoked.
56 virtual const GRState *assumeSymNE(const GRState *state, SymbolRef sym,
57 const llvm::APSInt& V,
58 const llvm::APSInt& Adjustment) = 0;
60 virtual const GRState *assumeSymEQ(const GRState *state, SymbolRef sym,
61 const llvm::APSInt& V,
62 const llvm::APSInt& Adjustment) = 0;
64 virtual const GRState *assumeSymLT(const GRState *state, SymbolRef sym,
65 const llvm::APSInt& V,
66 const llvm::APSInt& Adjustment) = 0;
68 virtual const GRState *assumeSymGT(const GRState *state, SymbolRef sym,
69 const llvm::APSInt& V,
70 const llvm::APSInt& Adjustment) = 0;
72 virtual const GRState *assumeSymLE(const GRState *state, SymbolRef sym,
73 const llvm::APSInt& V,
74 const llvm::APSInt& Adjustment) = 0;
76 virtual const GRState *assumeSymGE(const GRState *state, SymbolRef sym,
77 const llvm::APSInt& V,
78 const llvm::APSInt& Adjustment) = 0;
80 //===------------------------------------------------------------------===//
81 // Internal implementation.
82 //===------------------------------------------------------------------===//
84 const GRState *assumeAux(const GRState *state, Loc Cond,bool Assumption);
86 const GRState *assumeAux(const GRState *state, NonLoc Cond, bool Assumption);
89 } // end GR namespace
91 } // end clang namespace
93 #endif