clang  6.0.0svn
RangedConstraintManager.h
Go to the documentation of this file.
1 //== RangedConstraintManager.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 // Ranged constraint manager, built on SimpleConstraintManager.
11 //
12 //===----------------------------------------------------------------------===//
13 
14 #ifndef LLVM_CLANG_LIB_STATICANALYZER_CORE_RANGEDCONSTRAINTMANAGER_H
15 #define LLVM_CLANG_LIB_STATICANALYZER_CORE_RANGEDCONSTRAINTMANAGER_H
16 
19 
20 namespace clang {
21 
22 namespace ento {
23 
25 public:
27  : SimpleConstraintManager(SE, SB) {}
28 
29  ~RangedConstraintManager() override;
30 
31  //===------------------------------------------------------------------===//
32  // Implementation for interface from SimpleConstraintManager.
33  //===------------------------------------------------------------------===//
34 
36  bool Assumption) override;
37 
39  const llvm::APSInt &From,
40  const llvm::APSInt &To,
41  bool InRange) override;
42 
44  bool Assumption) override;
45 
46 protected:
47  /// Assume a constraint between a symbolic expression and a concrete integer.
50  const llvm::APSInt &Int);
51 
52  //===------------------------------------------------------------------===//
53  // Interface that subclasses must implement.
54  //===------------------------------------------------------------------===//
55 
56  // Each of these is of the form "$Sym+Adj <> V", where "<>" is the comparison
57  // operation for the method being invoked.
58 
60  const llvm::APSInt &V,
61  const llvm::APSInt &Adjustment) = 0;
62 
64  const llvm::APSInt &V,
65  const llvm::APSInt &Adjustment) = 0;
66 
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  ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From,
85  const llvm::APSInt &To, const llvm::APSInt &Adjustment) = 0;
86 
88  ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From,
89  const llvm::APSInt &To, const llvm::APSInt &Adjustment) = 0;
90 
91  //===------------------------------------------------------------------===//
92  // Internal implementation.
93  //===------------------------------------------------------------------===//
94 private:
95  static void computeAdjustment(SymbolRef &Sym, llvm::APSInt &Adjustment);
96 };
97 
98 } // end GR namespace
99 
100 } // end clang namespace
101 
102 #endif
ProgramStateRef assumeSym(ProgramStateRef State, SymbolRef Sym, bool Assumption) override
Given a symbolic expression that can be reasoned about, assume that it is true/false and generate the...
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
Symbolic value.
Definition: SymExpr.h:29
virtual ProgramStateRef assumeSymLT(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
LineState State
BinaryOperatorKind
ProgramStateRef assumeSymUnsupported(ProgramStateRef State, SymbolRef Sym, bool Assumption) override
Given a symbolic expression that cannot be reasoned about, assume that it is zero/nonzero and add it ...
virtual ProgramStateRef assumeSymRel(ProgramStateRef State, SymbolRef Sym, BinaryOperator::Opcode op, const llvm::APSInt &Int)
Assume a constraint between a symbolic expression and a concrete integer.
virtual ProgramStateRef assumeSymOutsideInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0
Dataflow Directional Tag Classes.
virtual ProgramStateRef assumeSymGT(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
virtual ProgramStateRef assumeSymNE(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0
ProgramStateRef assumeSymInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, bool InRange) override
Given a symbolic expression within the range [From, To], assume that it is true/false and generate th...
virtual ProgramStateRef assumeSymWithinInclusiveRange(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &From, const llvm::APSInt &To, const llvm::APSInt &Adjustment)=0
RangedConstraintManager(SubEngine *SE, SValBuilder &SB)
virtual ProgramStateRef assumeSymGE(ProgramStateRef State, SymbolRef Sym, const llvm::APSInt &V, const llvm::APSInt &Adjustment)=0