summaryrefslogtreecommitdiffstats
path: root/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
diff options
context:
space:
mode:
authorArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-17 21:39:39 +0000
committerArgyrios Kyrtzidis <akyrtzi@gmail.com>2011-02-17 21:39:39 +0000
commit57d736fd46d54ef60c459678ede378e91e0c1d31 (patch)
tree221bff02091e8646e08b7789a672e2d29158996e /clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
parentaf45aca670d8605c459e23699da9441c57e0b680 (diff)
downloadbcm5719-llvm-57d736fd46d54ef60c459678ede378e91e0c1d31.tar.gz
bcm5719-llvm-57d736fd46d54ef60c459678ede378e91e0c1d31.zip
[analyzer] Use the new registration mechanism for the debugging info "checks".
The relative checker package is 'debug': '-dump-live-variables' is replaced by '-analyzer-checker=debug.DumpLiveVars' '-cfg-view' is replaced by '-analyzer-checker=debug.ViewCFG' '-cfg-dump' is replaced by '-analyzer-checker=debug.DumpCFG' llvm-svn: 125780
Diffstat (limited to 'clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp')
-rw-r--r--clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp80
1 files changed, 80 insertions, 0 deletions
diff --git a/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp b/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
new file mode 100644
index 00000000000..091d99b1352
--- /dev/null
+++ b/clang/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
@@ -0,0 +1,80 @@
+//==- DebugCheckers.cpp - Debugging Checkers ---------------------*- C++ -*-==//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+//
+// This file defines a checkers that display debugging information.
+//
+//===----------------------------------------------------------------------===//
+
+#include "ClangSACheckers.h"
+#include "clang/StaticAnalyzer/Core/CheckerV2.h"
+#include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h"
+#include "clang/Analysis/Analyses/LiveVariables.h"
+
+using namespace clang;
+using namespace ento;
+
+//===----------------------------------------------------------------------===//
+// LiveVariablesDumper
+//===----------------------------------------------------------------------===//
+
+namespace {
+class LiveVariablesDumper : public CheckerV2<check::ASTCodeBody> {
+public:
+ void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
+ BugReporter &BR) const {
+ if (LiveVariables* L = mgr.getLiveVariables(D)) {
+ L->dumpBlockLiveness(mgr.getSourceManager());
+ }
+ }
+};
+}
+
+void ento::registerLiveVariablesDumper(CheckerManager &mgr) {
+ mgr.registerChecker<LiveVariablesDumper>();
+}
+
+//===----------------------------------------------------------------------===//
+// CFGViewer
+//===----------------------------------------------------------------------===//
+
+namespace {
+class CFGViewer : public CheckerV2<check::ASTCodeBody> {
+public:
+ void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
+ BugReporter &BR) const {
+ if (CFG *cfg = mgr.getCFG(D)) {
+ cfg->viewCFG(mgr.getLangOptions());
+ }
+ }
+};
+}
+
+void ento::registerCFGViewer(CheckerManager &mgr) {
+ mgr.registerChecker<CFGViewer>();
+}
+
+//===----------------------------------------------------------------------===//
+// CFGDumper
+//===----------------------------------------------------------------------===//
+
+namespace {
+class CFGDumper : public CheckerV2<check::ASTCodeBody> {
+public:
+ void checkASTCodeBody(const Decl *D, AnalysisManager& mgr,
+ BugReporter &BR) const {
+ if (CFG *cfg = mgr.getCFG(D)) {
+ cfg->dump(mgr.getLangOptions());
+ }
+ }
+};
+}
+
+void ento::registerCFGDumper(CheckerManager &mgr) {
+ mgr.registerChecker<CFGDumper>();
+}
OpenPOWER on IntegriCloud