diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-10-17 00:51:01 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-10-17 00:51:01 +0000 |
commit | d9bc33efa195114d6f2a365c26e5b8dba4e1cc38 (patch) | |
tree | 3a505a4969fd630cb2034fa5b64e6e0e362de680 /lib/Analysis/GRExprEngine.cpp | |
parent | 97ed4f68f5dba3e21e7a490ef0f9ffd3bfead7f8 (diff) |
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
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 26 |
1 files changed, 11 insertions, 15 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index f974dfc2c4..2bc46d5990 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -817,7 +817,8 @@ void GRExprEngine::VisitDeclRefExpr(DeclRefExpr* Ex, NodeTy* Pred, NodeSet& Dst, 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 @@ void GRExprEngine::VisitArraySubscriptExpr(ArraySubscriptExpr* A, NodeTy* Pred, 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 @@ void GRExprEngine::VisitMemberExpr(MemberExpr* M, NodeTy* Pred, 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 |