clang: lib/StaticAnalyzer/Core/ConstraintManager.cpp Source File (original) (raw)
1
2
3
4
5
6
7
8
9
10
11
12
19#include "llvm/ADT/ScopeExit.h"
20
21using namespace clang;
22using namespace ento;
23
25
29 State->getStateManager().getRegionManager().getSymbolicRegion(Sym);
31}
32
39 if (P.first && .second)
41 if (.first && P.second)
43 return {};
44}
45
46template
49 AssumeFunction &Assume) {
50 if (LLVM_UNLIKELY(State->isPosteriorlyOverconstrained()))
51 return {State, State};
52
53
54
55
56
57
60 return {State, State};
62 auto AssumeStackBuilder =
63 llvm::make_scope_exit([this]() { AssumeStack.pop(); });
64
66
67 if (!StTrue) {
69 if (LLVM_UNLIKELY(!StFalse)) {
70 ProgramStateRef StInfeasible = State->cloneAsPosteriorlyOverconstrained();
71 assert(StInfeasible->isPosteriorlyOverconstrained());
72
73
74
75
76
77
78
80 }
82 }
83
85 if (!StFalse) {
87 }
88
90}
91
94 auto AssumeFun = [&, Cond](bool Assumption) {
96 };
98}
99
102 const llvm::APSInt &From,
103 const llvm::APSInt &To) {
104 auto AssumeFun = [&](bool Assumption) {
106 };
108}
109
113 return Assumption ? R.first : R.second;
114}
115
118 const llvm::APSInt &From,
119 const llvm::APSInt &To, bool InBound) {
122 return InBound ? R.first : R.second;
123}
static DefinedSVal getLocFromSymbol(const ProgramStateRef &State, SymbolRef Sym)
C Language Family Type Representation.
A (possibly-)qualified type.
bool contains(const ProgramState *S) const
void push(const ProgramState *S)
virtual ProgramStateRef assumeInclusiveRangeInternal(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InBound)=0
ProgramStateRef assumeInclusiveRange(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To, bool InBound)
ProgramStatePair assumeDual(ProgramStateRef State, DefinedSVal Cond)
Returns a pair of states (StTrue, StFalse) where the given condition is assumed to be true or false,...
virtual ~ConstraintManager()
AssumeStackTy AssumeStack
ProgramStatePair assumeInclusiveRangeDual(ProgramStateRef State, NonLoc Value, const llvm::APSInt &From, const llvm::APSInt &To)
Returns a pair of states (StInRange, StOutOfRange) where the given value is assumed to be in the rang...
std::pair< ProgramStateRef, ProgramStateRef > ProgramStatePair
ProgramStateRef assume(ProgramStateRef state, DefinedSVal Cond, bool Assumption)
ProgramStatePair assumeDualImpl(ProgramStateRef &State, AssumeFunction &Assume)
virtual ProgramStateRef assumeInternal(ProgramStateRef state, DefinedSVal Cond, bool Assumption)=0
virtual ConditionTruthVal checkNull(ProgramStateRef State, SymbolRef Sym)
Returns whether or not a symbol is known to be null ("true"), known to be non-null ("false"),...
static bool isLocType(QualType T)
MemRegion - The root abstract class for all memory regions.
ProgramState - This class encapsulates:
virtual QualType getType() const =0
Represents symbolic expression that isn't a location.
The JSON file list parser is used to communicate input to InstallAPI.