RegionStore/BasicStore: do not return UndefinedVal for accesses to concrete addresses...
[clang.git] / lib / Checker / SimpleConstraintManager.h
blob96811b3e36e68fcf6208d4558c4653fa9ee5a718
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/Checker/PathSensitive/ConstraintManager.h"
18 #include "clang/Checker/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