clang  3.7.0
SimpleConstraintManager.h
Go to the documentation of this file.
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.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CORE_SIMPLECONSTRAINTMANAGER_H
15 #define LLVM_CLANG_LIB_STATICANALYZER_CORE_SIMPLECONSTRAINTMANAGER_H
16 
19 
20 namespace clang {
21 
22 namespace ento {
23 
25  SubEngine *SU;
26  SValBuilder &SVB;
27 public:
29  : SU(subengine), SVB(SB) {}
30  ~SimpleConstraintManager() override;
31 
32  //===------------------------------------------------------------------===//
33  // Common implementation for the interface provided by ConstraintManager.
34  //===------------------------------------------------------------------===//
35 
37  bool Assumption) override;
38 
39  ProgramStateRef assume(ProgramStateRef state, NonLoc Cond, bool Assumption);
40 
42  const SymExpr *LHS,
44  const llvm::APSInt& Int);
45 
46 protected:
47 
48  //===------------------------------------------------------------------===//
49  // Interface that subclasses must implement.
50  //===------------------------------------------------------------------===//
51 
52  // Each of these is of the form "$sym+Adj <> V", where "<>" is the comparison
53  // operation for the method being invoked.
55  const llvm::APSInt& V,
56  const llvm::APSInt& Adjustment) = 0;
57 
59  const llvm::APSInt& V,
60  const llvm::APSInt& Adjustment) = 0;
61 
63  const llvm::APSInt& V,
64  const llvm::APSInt& Adjustment) = 0;
65 
67  const llvm::APSInt& V,
68  const llvm::APSInt& Adjustment) = 0;
69 
71  const llvm::APSInt& V,
72  const llvm::APSInt& Adjustment) = 0;
73 
75  const llvm::APSInt& V,
76  const llvm::APSInt& Adjustment) = 0;
77 
78  //===------------------------------------------------------------------===//
79  // Internal implementation.
80  //===------------------------------------------------------------------===//
81 
83  SymbolManager &getSymbolManager() const { return SVB.getSymbolManager(); }
84 
85  bool canReasonAbout(SVal X) const override;
86 
88  NonLoc Cond,
89  bool Assumption);
90 
92  SymbolRef Sym,
93  bool Assumption);
94 };
95 
96 } // end GR namespace
97 
98 } // end clang namespace
99 
100 #endif
SymbolManager & getSymbolManager()
Definition: SValBuilder.h:137
virtual ProgramStateRef assumeSymNE(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
Symbolic value. These values used to capture symbolic execution of the program.
Definition: SymbolManager.h:42
virtual ProgramStateRef assumeSymGT(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
LineState State
BinaryOperatorKind
SimpleConstraintManager(SubEngine *subengine, SValBuilder &SB)
virtual ProgramStateRef assumeSymGE(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef assumeSymEQ(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef assumeSymLE(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
ProgramStateRef assumeSymRel(ProgramStateRef state, const SymExpr *LHS, BinaryOperator::Opcode op, const llvm::APSInt &Int)
ProgramStateRef assumeAux(ProgramStateRef state, NonLoc Cond, bool Assumption)
ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, bool Assumption) override
ProgramStateRef assumeAuxForSymbol(ProgramStateRef State, SymbolRef Sym, bool Assumption)
BasicValueFactory & getBasicValueFactory()
Definition: SValBuilder.h:134
X
Definition: SemaDecl.cpp:11429
virtual ProgramStateRef assumeSymLT(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
BasicValueFactory & getBasicVals() const