[cfe-commits] r47335 - /cfe/trunk/Analysis/GRExprEngine.cpp

Ted Kremenek kremenek at apple.com
Tue Feb 19 10:52:54 PST 2008


Author: kremenek
Date: Tue Feb 19 12:52:54 2008
New Revision: 47335

URL: http://llvm.org/viewvc/llvm-project?rev=47335&view=rev
Log:
Fixed transfer function for casts to always evaluate the effects of the
cast's subexpression even if the cast itself has no effect.

Modified:
    cfe/trunk/Analysis/GRExprEngine.cpp

Modified: cfe/trunk/Analysis/GRExprEngine.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/Analysis/GRExprEngine.cpp?rev=47335&r1=47334&r2=47335&view=diff

==============================================================================
--- cfe/trunk/Analysis/GRExprEngine.cpp (original)
+++ cfe/trunk/Analysis/GRExprEngine.cpp Tue Feb 19 12:52:54 2008
@@ -447,19 +447,22 @@
 
 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();





More information about the cfe-commits mailing list