aboutsummaryrefslogtreecommitdiff
path: root/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-17 21:39:33 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-17 21:39:33 +0000
commit7dd445ec20e704846cfbdb132e56539280d71311 (patch)
treeba32d283b3e96e358891fc14519365cf057ea1fe /lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
parent9fb9474c5b267400d4abfbff63c8b39f378235d4 (diff)
[analyzer] Use the new registration mechanism on the non-path-sensitive-checkers:
DeadStoresChecker ObjCMethSigsChecker ObjCUnusedIvarsChecker SizeofPointerChecker ObjCDeallocChecker SecuritySyntaxChecker git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@125779 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp')
-rw-r--r--lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp31
1 files changed, 25 insertions, 6 deletions
diff --git a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
index a6c0ea3154..3b39372725 100644
--- a/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
+++ b/lib/StaticAnalyzer/Checkers/DeadStoresChecker.cpp
@@ -12,6 +12,8 @@
//
//===----------------------------------------------------------------------===//
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/CheckerV2.h"
#include "clang/StaticAnalyzer/Checkers/LocalCheckers.h"
#include "clang/Analysis/Analyses/LiveVariables.h"
#include "clang/Analysis/Visitors/CFGRecStmtVisitor.h"
@@ -335,10 +337,27 @@ public:
} // end anonymous namespace
-void ento::CheckDeadStores(CFG &cfg, LiveVariables &L, ParentMap &pmap,
- BugReporter& BR) {
- FindEscaped FS(&cfg);
- FS.getCFG().VisitBlockStmts(FS);
- DeadStoreObs A(cfg, BR.getContext(), BR, pmap, FS.Escaped);
- L.runOnAllBlocks(cfg, &A);
+//===----------------------------------------------------------------------===//
+// DeadStoresChecker
+//===----------------------------------------------------------------------===//
+
+namespace {
+class DeadStoresChecker : public CheckerV2<check::ASTCodeBody> {
+public:
+ void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
+ BugReporter &BR) const {
+ if (LiveVariables *L = mgr.getLiveVariables(D)) {
+ CFG &cfg = *mgr.getCFG(D);
+ ParentMap &pmap = mgr.getParentMap(D);
+ FindEscaped FS(&cfg);
+ FS.getCFG().VisitBlockStmts(FS);
+ DeadStoreObs A(cfg, BR.getContext(), BR, pmap, FS.Escaped);
+ L->runOnAllBlocks(cfg, &A);
+ }
+ }
+};
+}
+
+void ento::registerDeadStoresChecker(CheckerManager &mgr) {
+ mgr.registerChecker<DeadStoresChecker>();
}