Remove lval::FieldOffset, lval::ArrayOffset. These will be replaced with regions.
Remove GRExprEngine::getLVal and RValues::MakeVal.
Enhance StoreManager "GetLValue" methods to dispatch for specific kinds of lvalue queries, as opposed to interogating the expression tree (GRExprEngine already does this).
Added FIXMEs. In particular, we no longer "assume" that a base pointer in a field/array access is null (this logic was removed). Perhaps we should do this when fetching the lvalue for fields and array elements?
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@57657 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp
index f974dfc..2bc46d5 100644
--- a/lib/Analysis/GRExprEngine.cpp
+++ b/lib/Analysis/GRExprEngine.cpp
@@ -817,7 +817,8 @@
return;
}
- RVal V = GetLValue(St, Ex);
+ RVal V = StateMgr.GetLValue(St, VD);
+
if (asLValue)
MakeNode(Dst, Ex, Pred, SetRVal(St, Ex, V));
else
@@ -850,22 +851,16 @@
Expr* Base = A->getBase()->IgnoreParens();
Expr* Idx = A->getIdx()->IgnoreParens();
-
NodeSet Tmp;
-
- // Get Base's rvalue, which should be an LocVal.
- Visit(Base, Pred, Tmp);
+ Visit(Base, Pred, Tmp); // Get Base's rvalue, which should be an LocVal.
- for (NodeSet::iterator I1=Tmp.begin(), E1=Tmp.end(); I1!=E1; ++I1) {
-
- // Evaluate the index.
+ for (NodeSet::iterator I1=Tmp.begin(), E1=Tmp.end(); I1!=E1; ++I1) {
NodeSet Tmp2;
- Visit(Idx, *I1, Tmp2);
+ Visit(Idx, *I1, Tmp2); // Evaluate the index.
for (NodeSet::iterator I2=Tmp2.begin(), E2=Tmp2.end(); I2!=E2; ++I2) {
-
const GRState* St = GetState(*I2);
- RVal V = GetLValue(St, A);
+ RVal V = StateMgr.GetLValue(St, GetRVal(St, Base), GetRVal(St, Idx));
if (asLValue)
MakeNode(Dst, A, *I2, SetRVal(St, A, V));
@@ -880,15 +875,16 @@
NodeSet& Dst, bool asLValue) {
Expr* Base = M->getBase()->IgnoreParens();
-
NodeSet Tmp;
-
- // Get Base expr's rvalue.
Visit(Base, Pred, Tmp);
for (NodeSet::iterator I = Tmp.begin(), E = Tmp.end(); I != E; ++I) {
const GRState* St = GetState(*I);
- RVal L = GetLValue(St, M);
+ // FIXME: Should we insert some assumption logic in here to determine
+ // if "Base" is a valid piece of memory? Before we put this assumption
+ // later when using FieldOffset lvals (which we no longer have).
+ RVal L = StateMgr.GetLValue(St, M->getMemberDecl(), GetRVal(St, Base));
+
if (asLValue)
MakeNode(Dst, M, *I, SetRVal(St, M, L));
else