diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-04-29 22:17:41 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-04-29 22:17:41 +0000 |
commit | 0d2ccffa83b60d6745d1390127373a394321e28a (patch) | |
tree | 6073c0e9876629c9365cb37a67f2c03b0937a458 /clang/lib/Analysis/GRExprEngine.cpp | |
parent | 663f5fccd4332b14c853f8b5d7cd16c60623a012 (diff) | |
download | bcm5719-llvm-0d2ccffa83b60d6745d1390127373a394321e28a.tar.gz bcm5719-llvm-0d2ccffa83b60d6745d1390127373a394321e28a.zip |
Added lval::FieldOffset, which represents symbolic lvalues for field offsets from other Lvalues.
This removes the failure in null-deref-ps.c (test suite).
llvm-svn: 50449
Diffstat (limited to 'clang/lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | clang/lib/Analysis/GRExprEngine.cpp | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/clang/lib/Analysis/GRExprEngine.cpp b/clang/lib/Analysis/GRExprEngine.cpp index 2353058e76b..a4f1a0512d5 100644 --- a/clang/lib/Analysis/GRExprEngine.cpp +++ b/clang/lib/Analysis/GRExprEngine.cpp @@ -856,16 +856,12 @@ void GRExprEngine::VisitMemberExpr(MemberExpr* M, NodeTy* Pred, // This is a redunant copy; we do this as a placeholder for future logic. for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) { ValueState* St = GetState(*I); - RVal V = GetRVal(St, Base); + RVal BaseV = GetRVal(St, Base); - // TODO: Compute the LVal for the field. This will enable field - // sensitivity for the analysis. - - if (!(V.isUndef() || V.isUnknown() || isa<lval::ConcreteInt>(V))) - V = UnknownVal(); - - MakeNode(Dst, M, *I, SetRVal(St, M, V)); + RVal V = lval::FieldOffset::Make(BasicVals, GetRVal(St, Base), + M->getMemberDecl()); + MakeNode(Dst, M, *I, SetRVal(St, M, V)); } return; @@ -879,13 +875,8 @@ void GRExprEngine::VisitMemberExpr(MemberExpr* M, NodeTy* Pred, for (NodeSet::iterator I=Tmp.begin(), E=Tmp.end(); I!=E; ++I) { ValueState* St = GetState(*I); - RVal V = GetRVal(St, Base); - - // TODO: Compute the LVal for the field. This will enable field - // sensitivity for the analysis. - - if (!(V.isUndef() || V.isUnknown() || isa<lval::ConcreteInt>(V))) - V = UnknownVal(); + RVal V = lval::FieldOffset::Make(BasicVals, GetRVal(St, Base), + M->getMemberDecl()); EvalLoad(Dst, M, *I, St, V, true); } @@ -2034,7 +2025,11 @@ ValueState* GRExprEngine::AssumeAux(ValueState* St, LVal Cond, case lval::StringLiteralValKind: isFeasible = Assumption; return St; - + + case lval::FieldOffsetKind: + return AssumeAux(St, cast<lval::FieldOffset>(Cond).getBase(), + Assumption, isFeasible); + case lval::ConcreteIntKind: { bool b = cast<lval::ConcreteInt>(Cond).getValue() != 0; isFeasible = b ? Assumption : !Assumption; |