clang  3.9.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  NonLoc Value,
43  const llvm::APSInt &From,
44  const llvm::APSInt &To,
45  bool InRange) override;
46 
48  const SymExpr *LHS,
50  const llvm::APSInt& Int);
51 
53  SymbolRef Sym,
54  const llvm::APSInt &From,
55  const llvm::APSInt &To,
56  bool InRange);
57 
58 
59 protected:
60 
61  //===------------------------------------------------------------------===//
62  // Interface that subclasses must implement.
63  //===------------------------------------------------------------------===//
64 
65  // Each of these is of the form "$sym+Adj <> V", where "<>" is the comparison
66  // operation for the method being invoked.
68  const llvm::APSInt& V,
69  const llvm::APSInt& Adjustment) = 0;
70 
72  const llvm::APSInt& V,
73  const llvm::APSInt& Adjustment) = 0;
74 
76  const llvm::APSInt& V,
77  const llvm::APSInt& Adjustment) = 0;
78 
80  const llvm::APSInt& V,
81  const llvm::APSInt& Adjustment) = 0;
82 
84  const llvm::APSInt& V,
85  const llvm::APSInt& Adjustment) = 0;
86 
88  const llvm::APSInt& V,
89  const llvm::APSInt& Adjustment) = 0;
90 
91 
93  ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From,
94  const llvm::APSInt &To, const llvm::APSInt &Adjustment) = 0;
95 
97  ProgramStateRef state, SymbolRef Sym, const llvm::APSInt &From,
98  const llvm::APSInt &To, const llvm::APSInt &Adjustment) = 0;
99  //===------------------------------------------------------------------===//
100  // Internal implementation.
101  //===------------------------------------------------------------------===//
102 
105 
106  bool canReasonAbout(SVal X) const override;
107 
109  NonLoc Cond,
110  bool Assumption);
111 
113  SymbolRef Sym,
114  bool Assumption);
115 };
116 
117 } // end GR namespace
118 
119 } // end clang namespace
120 
121 #endif
SymbolManager & getSymbolManager()
Definition: SValBuilder.h:142
virtual ProgramStateRef assumeSymNE(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef assumeSymbolOutOfInclusiveRange(ProgramStateRef state, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0
Symbolic value.
Definition: SymExpr.h:29
virtual ProgramStateRef assumeSymGT(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
LineState State
i32 captured_struct **param SharedsTy A type which contains references the shared variables *param Shareds Context with the list of shared variables from the p *TaskFunction *param Data Additional data for task generation like final * state
BinaryOperatorKind
ProgramStateRef assumeWithinInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override
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 assumeSymbolWithinInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, 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 assumeSymWithinInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange)
SVal - This represents a symbolic expression, which can be either an L-value or an R-value...
Definition: SVals.h:46
ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, bool Assumption) override
ProgramStateRef assumeAuxForSymbol(ProgramStateRef State, SymbolRef Sym, bool Assumption)
BasicValueFactory & getBasicValueFactory()
Definition: SValBuilder.h:139
X
Add a minimal nested name specifier fixit hint to allow lookup of a tag name from an outer enclosing ...
Definition: SemaDecl.cpp:12171
bool canReasonAbout(SVal X) const override
canReasonAbout - Not all ConstraintManagers can accurately reason about all SVal values.
virtual ProgramStateRef assumeSymLT(ProgramStateRef state, SymbolRef sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
BasicValueFactory & getBasicVals() const