diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-11-15 00:20:05 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-11-15 00:20:05 +0000 |
commit | e04a5cb9afb5faa205c0bfa93103d6df691e05b2 (patch) | |
tree | 0b182e270a0ad97935003506036a4bd9593e7c5d /lib/Analysis/GRExprEngine.cpp | |
parent | 96cbfd45c92a79f3318921f479ea8d08d0debd4e (diff) |
Implement FIXME in GRExprEngine::VisitUnaryOperator() to handle implicit conversions caused by the '!' operator. This required adding some logic to GRSimpleVals to reason about nonloc::LocAsInteger SVals. This code appears to work fine, but it should eventually be cleaned up.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@59335 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Analysis/GRExprEngine.cpp')
-rw-r--r-- | lib/Analysis/GRExprEngine.cpp | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/lib/Analysis/GRExprEngine.cpp b/lib/Analysis/GRExprEngine.cpp index 6b53f1ec2d..137a31ed9c 100644 --- a/lib/Analysis/GRExprEngine.cpp +++ b/lib/Analysis/GRExprEngine.cpp @@ -2044,10 +2044,16 @@ void GRExprEngine::VisitUnaryOperator(UnaryOperator* U, NodeTy* Pred, // Get the value of the subexpression. SVal V = GetSVal(St, Ex); - // Perform promotions. - // FIXME: This is the right thing to do, but it currently breaks - // a bunch of tests. - // V = EvalCast(V, U->getType()); + if (V.isUnknownOrUndef()) { + MakeNode(Dst, U, *I, BindExpr(St, U, V)); + continue; + } + + QualType DstT = getContext().getCanonicalType(U->getType()); + QualType SrcT = getContext().getCanonicalType(Ex->getType()); + + if (DstT != SrcT) // Perform promotions. + V = EvalCast(V, DstT); if (V.isUnknownOrUndef()) { MakeNode(Dst, U, *I, BindExpr(St, U, V)); @@ -2551,7 +2557,7 @@ void GRExprEngine::EvalBinOp(GRStateSet& OStates, const GRState* St, NonLoc L, NonLoc R) { GRStateSet::AutoPopulate AP(OStates, St); - if (R.isValid()) getTF().EvalBinOpNN(OStates, StateMgr, St, Ex, Op, L, R); + if (R.isValid()) getTF().EvalBinOpNN(OStates, *this, St, Ex, Op, L, R); } //===----------------------------------------------------------------------===// |