Added version of CheckDeadStores that accepts a client-provided LiveVariables object.
Modified the DeadStores logic in AnalysisConsumer.cpp to use the LiveVariables object created by the AnalysisManager.


git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@53043 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/Driver/AnalysisConsumer.cpp b/Driver/AnalysisConsumer.cpp
index f8d9a25..1e33ae1 100644
--- a/Driver/AnalysisConsumer.cpp
+++ b/Driver/AnalysisConsumer.cpp
@@ -264,7 +264,8 @@
 //===----------------------------------------------------------------------===//
 
 static void ActionDeadStores(AnalysisManager& mgr) {
-  CheckDeadStores(*mgr.getCFG(), mgr.getContext(), *mgr.getParentMap(),
+  CheckDeadStores(*mgr.getCFG(), mgr.getContext(),
+                  *mgr.getLiveVariables(), *mgr.getParentMap(),
                   mgr.getDiagnostic());
 }
 
diff --git a/include/clang/Analysis/LocalCheckers.h b/include/clang/Analysis/LocalCheckers.h
index 2369196..2028393 100644
--- a/include/clang/Analysis/LocalCheckers.h
+++ b/include/clang/Analysis/LocalCheckers.h
@@ -26,10 +26,14 @@
 class BugType;
 class LangOptions;
 class ParentMap;
+class LiveVariables;
   
 void CheckDeadStores(CFG& cfg, ASTContext &Ctx, ParentMap& Parents,
                      Diagnostic &Diags); 
   
+  void CheckDeadStores(CFG& cfg, ASTContext &Ctx, LiveVariables& L,
+                       ParentMap& Parents, Diagnostic &Diags); 
+  
 void CheckUninitializedValues(CFG& cfg, ASTContext& Ctx, Diagnostic& Diags,
                               bool FullUninitTaint=false);
   
diff --git a/lib/Analysis/DeadStores.cpp b/lib/Analysis/DeadStores.cpp
index 208e66f..265679f 100644
--- a/lib/Analysis/DeadStores.cpp
+++ b/lib/Analysis/DeadStores.cpp
@@ -151,6 +151,12 @@
                             ParentMap& Parents, Diagnostic &Diags) {  
   LiveVariables L(cfg);
   L.runOnCFG(cfg);
+  CheckDeadStores(cfg, Ctx, L, Parents, Diags);
+}
+
+void clang::CheckDeadStores(CFG& cfg, ASTContext &Ctx, LiveVariables& L,
+                            ParentMap& Parents, Diagnostic &Diags) {  
+
   DeadStoreObs A(Ctx, Diags, Diags.getClient(), Parents);
   L.runOnAllBlocks(cfg, &A);
 }