Fixed LiveVariables to no longer track the liveness of function pointers
that refer to direct function calls.

Modified interface of LiveVariables to only track liveness of VarDecls.
This cleans up a bunch of edge cases, and removed the bug just mentioned.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@41797 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Analysis/DeadStores.cpp b/Analysis/DeadStores.cpp
index 4073ecc..e0922ee 100644
--- a/Analysis/DeadStores.cpp
+++ b/Analysis/DeadStores.cpp
@@ -36,29 +36,28 @@
         return;
       
       // Is this an assignment to a variable?
-      if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(B->getLHS())) {
+      if (DeclRefExpr* DR = dyn_cast<DeclRefExpr>(B->getLHS()))
         // Is the variable live?
-        if (!L.isLive(Live,DR->getDecl())) {
+        if (!L.isLive(Live,cast<VarDecl>(DR->getDecl()))) {
           SourceRange R = B->getRHS()->getSourceRange();
           PP.getDiagnostics().Report(DR->getSourceRange().Begin(),
                                      diag::warn_dead_store, 0, 0,
                                      &R,1);
                                                                         
         }
-      }
     }
     else if(DeclStmt* DS = dyn_cast<DeclStmt>(S)) {
       // Iterate through the decls.  Warn if any of them (which have
       // initializers) are not live.
-      for (Decl* D = DS->getDecl() ; D != NULL ; D = D->getNextDeclarator())
-        if (VarDecl* V = dyn_cast<VarDecl>(D))
-          if (Expr* E = V->getInit())
-            if (!L.isLive(Live,D)) {
-              SourceRange R = E->getSourceRange();
-              PP.getDiagnostics().Report(D->getLocation(),
-                                         diag::warn_dead_store, 0, 0,
-                                         &R,1);
-            }
+      for (VarDecl* V = cast<VarDecl>(DS->getDecl()); V != NULL ; 
+                    V = cast<VarDecl>(V->getNextDeclarator()))
+        if (Expr* E = V->getInit())
+          if (!L.isLive(Live,V)) {
+            SourceRange R = E->getSourceRange();
+            PP.getDiagnostics().Report(V->getLocation(),
+                                       diag::warn_dead_store, 0, 0,
+                                       &R,1);
+          }
     }
   }
 };