From: Ted Kremenek Date: Wed, 2 Jul 2008 18:39:20 +0000 (+0000) Subject: Added version of CheckDeadStores that accepts a client-provided LiveVariables object. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=17fdf955237aa626acbfd6070633318380c2340f;p=clang 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 f8d9a250ba..1e33ae168a 100644 --- a/Driver/AnalysisConsumer.cpp +++ b/Driver/AnalysisConsumer.cpp @@ -264,7 +264,8 @@ void AnalysisConsumer::HandleCode(Decl* D, Stmt* Body, Actions actions) { //===----------------------------------------------------------------------===// 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 2369196b0b..2028393879 100644 --- a/include/clang/Analysis/LocalCheckers.h +++ b/include/clang/Analysis/LocalCheckers.h @@ -26,10 +26,14 @@ class GRTransferFuncs; 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 208e66f3e9..265679ff7e 100644 --- a/lib/Analysis/DeadStores.cpp +++ b/lib/Analysis/DeadStores.cpp @@ -151,6 +151,12 @@ void clang::CheckDeadStores(CFG& cfg, ASTContext &Ctx, 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); }