[cfe-commits] r59290 - /cfe/trunk/lib/Analysis/LiveVariables.cpp

Ted Kremenek kremenek at apple.com
Thu Nov 13 17:58:12 PST 2008


Author: kremenek
Date: Thu Nov 13 19:58:12 2008
New Revision: 59290

URL: http://llvm.org/viewvc/llvm-project?rev=59290&view=rev
Log:
Handle the case where 'element' in ObjCforCollectionstmt is not a DeclStmt or DeclRefExpr.

Modified:
    cfe/trunk/lib/Analysis/LiveVariables.cpp

Modified: cfe/trunk/lib/Analysis/LiveVariables.cpp
URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/lib/Analysis/LiveVariables.cpp?rev=59290&r1=59289&r2=59290&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Thu Nov 13 19:58:12 2008
@@ -184,18 +184,21 @@
   
   // This represents a 'kill' for the variable.
   Stmt* Element = S->getElement();
-  DeclRefExpr *DR = 0;
+  DeclRefExpr* DR = 0;
   VarDecl* VD = 0;
   
   if (DeclStmt* DS = dyn_cast<DeclStmt>(Element))
     VD = cast<VarDecl>(DS->getSolitaryDecl());
   else {
-    DR = cast<DeclRefExpr>(Element);
-    VD = cast<VarDecl>(DR->getDecl());
+    Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();    
+    if ((DR = dyn_cast<DeclRefExpr>(ElemExpr)))
+      VD = cast<VarDecl>(DR->getDecl());
   }
 
-  LiveState(VD, AD) = Dead;
-  if (AD.Observer && DR) { AD.Observer->ObserverKill(DR); }
+  if (VD) {
+    LiveState(VD, AD) = Dead;
+    if (AD.Observer && DR) { AD.Observer->ObserverKill(DR); }
+  }
 }
 
   





More information about the cfe-commits mailing list