[cfe-commits] r47572 - /cfe/trunk/Analysis/LiveVariables.cpp

Ted Kremenek kremenek at apple.com
Mon Feb 25 14:28:54 PST 2008


Author: kremenek
Date: Mon Feb 25 16:28:54 2008
New Revision: 47572

URL: http://llvm.org/viewvc/llvm-project?rev=47572&view=rev
Log:
Minor bug fix in LiveVariables: don't "kill" decls referenced by a DeclStmt
that aren't VarDecls.

Modified:
    cfe/trunk/Analysis/LiveVariables.cpp

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

==============================================================================
--- cfe/trunk/Analysis/LiveVariables.cpp (original)
+++ cfe/trunk/Analysis/LiveVariables.cpp Mon Feb 25 16:28:54 2008
@@ -156,13 +156,13 @@
 void TransferFuncs::VisitDeclStmt(DeclStmt* DS) {
   // Declarations effectively "kill" a variable since they cannot
   // possibly be live before they are declared.
-  for (ScopedDecl* D = DS->getDecl(); D != NULL; D = D->getNextDeclarator()) {
-    LiveState(D,AD) = Dead;
-
-    if (VarDecl* VD = dyn_cast<VarDecl>(D))
+  for (ScopedDecl* D = DS->getDecl(); D != NULL; D = D->getNextDeclarator())
+    if (VarDecl* VD = dyn_cast<VarDecl>(D)) {
+      LiveState(D,AD) = Dead;
+      
       if (Expr* Init = VD->getInit())
         Visit(Init);
-  }
+    }
 }
   
 } // end anonymous namespace





More information about the cfe-commits mailing list