aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-04-16 18:21:25 +0000
committerTed Kremenek <kremenek@apple.com>2008-04-16 18:21:25 +0000
commite38718e3251d9f2489f38a5467fdab06f53e8e77 (patch)
treefc75f31d2e5ebd3221284ea508a9adbd28198121
parent5cd24389afe21db6f246c20a1f49461fca0b31cb (diff)
Take first step to migrating handling of "stores" to values from GRExprEngine
to the plug-in GRTransferFuncs object. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@49801 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--include/clang/Analysis/PathSensitive/GRExprEngine.h7
-rw-r--r--lib/Analysis/GRExprEngine.cpp11
2 files changed, 15 insertions, 3 deletions
diff --git a/include/clang/Analysis/PathSensitive/GRExprEngine.h b/include/clang/Analysis/PathSensitive/GRExprEngine.h
index 5548a5bf29..0d8dfb3202 100644
--- a/include/clang/Analysis/PathSensitive/GRExprEngine.h
+++ b/include/clang/Analysis/PathSensitive/GRExprEngine.h
@@ -602,6 +602,13 @@ protected:
TF->EvalObjCMessageExpr(Dst, *this, *Builder, ME, Pred);
}
+ void EvalStore(NodeSet& Dst, Expr* E, NodeTy* Pred, ValueState* St,
+ LVal TargetLV, RVal Val) {
+
+ assert (Builder && "GRStmtNodeBuilder must be defined.");
+ MakeNode(Dst, E, Pred, SetRVal(St, TargetLV, Val));
+ }
+
ValueState* MarkBranch(ValueState* St, Stmt* Terminator, bool branchTaken);
};
} // end clang namespace
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index dfe319f0c9..9c6a37dbad 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -1637,8 +1637,11 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
// Simulate the effects of a "store": bind the value of the RHS
// to the L-Value represented by the LHS.
- St = SetRVal(SetRVal(St, B, RightV), cast<LVal>(LeftV), RightV);
- break;
+ EvalStore(Dst, B, N2, SetRVal(St, B, RightV),
+ cast<LVal>(LeftV), RightV);
+
+// St = SetRVal(SetRVal(St, B, RightV), cast<LVal>(LeftV), RightV);
+ continue;
}
// Compound assignment operators.
@@ -1784,7 +1787,9 @@ void GRExprEngine::VisitBinaryOperator(BinaryOperator* B,
continue;
}
- St = SetRVal(SetRVal(St, B, Result), LeftLV, Result);
+ // St = SetRVal(SetRVal(St, B, Result), LeftLV, Result);
+ EvalStore(Dst, B, N2, SetRVal(St, B, Result), LeftLV, Result);
+ continue;
}
}