analyzer infrastructure: make a bunch of changes to symbolic expressions that
Zhongxing and I discussed by email.
Main changes:
- Removed SymIntConstraintVal and SymIntConstraint
- Added SymExpr as a parent class to SymbolData, SymSymExpr, SymIntExpr
- Added nonloc::SymExprVal to wrap SymExpr
- SymbolRef is now just a typedef of 'const SymbolData*'
- Bunch of minor code cleanups in how some methods were invoked (no functionality change)
This changes are part of a long-term plan to have full symbolic expression
trees. This will be useful for lazily evaluating complicated expressions.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@67731 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/CFRefCount.cpp b/lib/Analysis/CFRefCount.cpp
index be1d794..6e43ec5 100644
--- a/lib/Analysis/CFRefCount.cpp
+++ b/lib/Analysis/CFRefCount.cpp
@@ -1591,8 +1591,8 @@
static void PrintPool(std::ostream &Out, SymbolRef Sym, const GRState *state) {
Out << ' ';
- if (Sym.isValid())
- Out << Sym;
+ if (Sym)
+ Out << Sym->getSymbolID();
else
Out << "<pool>";
Out << ":{";
@@ -1705,7 +1705,7 @@
SVal V = state.GetSValAsScalarOrLoc(*I);
SymbolRef Sym = V.getAsLocSymbol();
- if (Sym.isValid())
+ if (Sym)
if (RefBindings::data_type* T = state.get<RefBindings>(Sym)) {
state = Update(state, Sym, *T, GetArgE(Summ, idx), hasErr);
if (hasErr) {
@@ -1746,7 +1746,7 @@
SymbolRef Sym = state.GetSValAsScalarOrLoc(R).getAsLocSymbol();
// Remove any existing reference-count binding.
- if (Sym.isValid()) state = state.remove<RefBindings>(Sym);
+ if (Sym) state = state.remove<RefBindings>(Sym);
if (R->isBoundable(Ctx)) {
// Set the value of the variable to be a conjured symbol.
@@ -1833,7 +1833,7 @@
// Evaluate the effect on the message receiver.
if (!ErrorExpr && Receiver) {
SymbolRef Sym = state.GetSValAsScalarOrLoc(Receiver).getAsLocSymbol();
- if (Sym.isValid()) {
+ if (Sym) {
if (const RefVal* T = state.get<RefBindings>(Sym)) {
state = Update(state, Sym, *T, GetReceiverE(Summ), hasErr);
if (hasErr) {
@@ -1977,7 +1977,7 @@
SVal V = Eng.getStateManager().GetSValAsScalarOrLoc(St, Receiver);
SymbolRef Sym = V.getAsLocSymbol();
- if (Sym.isValid()) {
+ if (Sym) {
if (const RefVal* T = St->get<RefBindings>(Sym)) {
QualType Ty = T->getType();
@@ -2127,7 +2127,7 @@
GRStateRef state(Builder.GetState(Pred), Eng.getStateManager());
SymbolRef Sym = state.GetSValAsScalarOrLoc(RetE).getAsLocSymbol();
- if (!Sym.isValid())
+ if (!Sym)
return;
// Get the reference count binding (if any).
@@ -2824,9 +2824,9 @@
bool HandleBinding(StoreManager& SMgr, Store store, const MemRegion* R,
SVal val) {
- SymbolRef SymV = val.getAsSymbol();
-
- if (!SymV.isValid() || SymV != Sym)
+
+ SymbolRef SymV = val.getAsSymbol();
+ if (!SymV || SymV != Sym)
return true;
if (Binding) {