summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTed Kremenek <kremenek@apple.com>2008-02-19 18:52:54 +0000
committerTed Kremenek <kremenek@apple.com>2008-02-19 18:52:54 +0000
commit9fd2531b5ecb5a2e84ef3501d9412d32e10e1177 (patch)
tree43ac6ef56332028bcba1fc430ac92ef7ee619ee6
parent90c2df5bd0fe375eac0f1fc671ef2bc5a6063bab (diff)
downloadbcm5719-llvm-9fd2531b5ecb5a2e84ef3501d9412d32e10e1177.tar.gz
bcm5719-llvm-9fd2531b5ecb5a2e84ef3501d9412d32e10e1177.zip
Fixed transfer function for casts to always evaluate the effects of the
cast's subexpression even if the cast itself has no effect. llvm-svn: 47335
-rw-r--r--clang/Analysis/GRExprEngine.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/clang/Analysis/GRExprEngine.cpp b/clang/Analysis/GRExprEngine.cpp
index 6d45beab327..d1a0d4c59b0 100644
--- a/clang/Analysis/GRExprEngine.cpp
+++ b/clang/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();
OpenPOWER on IntegriCloud