[analyzer] Remove recursive visitation in ExprEngine::VisitMemberExpr because it isn't needed anymore.

llvm-svn: 136513
This commit is contained in:
Ted Kremenek 2011-07-29 21:18:19 +00:00
parent db835cc213
commit 22a1e65532
1 changed files with 23 additions and 29 deletions

View File

@ -1350,20 +1350,15 @@ void ExprEngine::VisitLvalArraySubscriptExpr(const ArraySubscriptExpr* A,
} }
/// VisitMemberExpr - Transfer function for member expressions. /// VisitMemberExpr - Transfer function for member expressions.
void ExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode* Pred, void ExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode *Pred,
ExplodedNodeSet& Dst) { ExplodedNodeSet& Dst) {
Expr *baseExpr = M->getBase()->IgnoreParens();
ExplodedNodeSet dstBase;
Visit(baseExpr, Pred, dstBase);
FieldDecl *field = dyn_cast<FieldDecl>(M->getMemberDecl()); FieldDecl *field = dyn_cast<FieldDecl>(M->getMemberDecl());
if (!field) // FIXME: skipping member expressions for non-fields if (!field) // FIXME: skipping member expressions for non-fields
return; return;
for (ExplodedNodeSet::iterator I = dstBase.begin(), E = dstBase.end(); Expr *baseExpr = M->getBase()->IgnoreParens();
I != E; ++I) { const GRState* state = GetState(Pred);
const GRState* state = GetState(*I);
SVal baseExprVal = state->getSVal(baseExpr); SVal baseExprVal = state->getSVal(baseExpr);
if (isa<nonloc::LazyCompoundVal>(baseExprVal) || if (isa<nonloc::LazyCompoundVal>(baseExprVal) ||
isa<nonloc::CompoundVal>(baseExprVal) || isa<nonloc::CompoundVal>(baseExprVal) ||
@ -1371,8 +1366,8 @@ void ExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode* Pred,
// temporary struct object, see test/Analysis/fields.c: // temporary struct object, see test/Analysis/fields.c:
// (p = getit()).x // (p = getit()).x
isa<nonloc::SymbolVal>(baseExprVal)) { isa<nonloc::SymbolVal>(baseExprVal)) {
MakeNode(Dst, M, *I, state->BindExpr(M, UnknownVal())); MakeNode(Dst, M, Pred, state->BindExpr(M, UnknownVal()));
continue; return;
} }
// FIXME: Should we insert some assumption logic in here to determine // FIXME: Should we insert some assumption logic in here to determine
@ -1382,10 +1377,9 @@ void ExprEngine::VisitMemberExpr(const MemberExpr* M, ExplodedNode* Pred,
// For all other cases, compute an lvalue. // For all other cases, compute an lvalue.
SVal L = state->getLValue(field, baseExprVal); SVal L = state->getLValue(field, baseExprVal);
if (M->isLValue()) if (M->isLValue())
MakeNode(Dst, M, *I, state->BindExpr(M, L), ProgramPoint::PostLValueKind); MakeNode(Dst, M, Pred, state->BindExpr(M, L), ProgramPoint::PostLValueKind);
else else
evalLoad(Dst, M, *I, state, L); evalLoad(Dst, M, Pred, state, L);
}
} }
/// evalBind - Handle the semantics of binding a value to a specific location. /// evalBind - Handle the semantics of binding a value to a specific location.