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

Ted Kremenek kremenek at apple.com
Fri Nov 14 13:07:16 PST 2008


Author: kremenek
Date: Fri Nov 14 15:07:14 2008
New Revision: 59316

URL: http://llvm.org/viewvc/llvm-project?rev=59316&view=rev
Log:
Minor tweaks to liveness analysis:
- Block-expression for 'ObjCForCollectionStmt' is not alive before it occurs
- Recursively visit 'element' expression for ObjCForCollectionStmt to get liveness for referenced block-level expressions and variables.

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=59316&r1=59315&r2=59316&view=diff

==============================================================================
--- cfe/trunk/lib/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/lib/Analysis/LiveVariables.cpp Fri Nov 14 15:07:14 2008
@@ -179,6 +179,9 @@
 void
 TransferFuncs::BlockStmt_VisitObjCForCollectionStmt(ObjCForCollectionStmt* S) {
   
+  // This is a block-level expression.  Its value is 'dead' before this point.
+  LiveState(S, AD) = Dead;
+
   // This represents a 'use' of the collection.
   Visit(S->getCollection());
   
@@ -193,6 +196,10 @@
     Expr* ElemExpr = cast<Expr>(Element)->IgnoreParens();    
     if ((DR = dyn_cast<DeclRefExpr>(ElemExpr)))
       VD = cast<VarDecl>(DR->getDecl());
+    else {
+      Visit(ElemExpr);
+      return;
+    }
   }
 
   if (VD) {





More information about the cfe-commits mailing list