diff options
author | Ted Kremenek <kremenek@apple.com> | 2008-02-19 18:52:54 +0000 |
---|---|---|
committer | Ted Kremenek <kremenek@apple.com> | 2008-02-19 18:52:54 +0000 |
commit | 5d3003a9d10cc6da4ef716c350bf53c187774c93 (patch) | |
tree | adc4284bfc4cfafdb3d8a143a4e654e00eacfce5 | |
parent | 402563b86a2de8a2cb82e2de3c895a3dd8924ca0 (diff) |
Fixed transfer function for casts to always evaluate the effects of the
cast's subexpression even if the cast itself has no effect.
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@47335 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r-- | Analysis/GRExprEngine.cpp | 13 |
1 files changed, 8 insertions, 5 deletions
diff --git a/Analysis/GRExprEngine.cpp b/Analysis/GRExprEngine.cpp index 6d45beab32..d1a0d4c59b 100644 --- a/Analysis/GRExprEngine.cpp +++ b/Analysis/GRExprEngine.cpp @@ -447,19 +447,22 @@ void GRExprEngine::VisitCall(CallExpr* CE, NodeTy* Pred, void GRExprEngine::VisitCast(Expr* CastE, Expr* E, NodeTy* Pred, NodeSet& Dst) { - QualType T = CastE->getType(); + NodeSet S1; + Visit(E, Pred, S1); + QualType T = CastE->getType(); + // Check for redundant casts or casting to "void" if (T->isVoidType() || E->getType() == T || (T->isPointerType() && E->getType()->isFunctionType())) { - Dst.Add(Pred); + + for (NodeSet::iterator I1=S1.begin(), E1=S1.end(); I1 != E1; ++I1) + Dst.Add(*I1); + return; } - NodeSet S1; - Visit(E, Pred, S1); - for (NodeSet::iterator I1=S1.begin(), E1=S1.end(); I1 != E1; ++I1) { NodeTy* N = *I1; StateTy St = N->getState(); |