diff options
author | Anna Zaks <ganna@apple.com> | 2013-06-24 18:12:12 +0000 |
---|---|---|
committer | Anna Zaks <ganna@apple.com> | 2013-06-24 18:12:12 +0000 |
commit | 9f7ba9bd52823eb0fdb64767f2d09fb6b96b8179 (patch) | |
tree | 31632986d83561fa0e9bf8f6359e91335049c6e7 /lib/StaticAnalyzer/Checkers/DebugCheckers.cpp | |
parent | de2b523b9a2a32ff27e0689413c078c2cf87e666 (diff) | |
download | clang-9f7ba9bd52823eb0fdb64767f2d09fb6b96b8179.tar.gz |
[analyzer] Add a debug checker that prints Exploded Graph
Add a debug checker that is useful to understand how the ExplodedGraph is
built; it can be triggered using the following command:
clang -cc1 -analyze -analyzer-checker=debug.ViewExplodedGraph my_program.c
A patch by BĂ©atrice Creusillet!
git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@184768 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/StaticAnalyzer/Checkers/DebugCheckers.cpp')
-rw-r--r-- | lib/StaticAnalyzer/Checkers/DebugCheckers.cpp | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp index fe12866e51..c374d0da0e 100644 --- a/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp +++ b/lib/StaticAnalyzer/Checkers/DebugCheckers.cpp @@ -17,6 +17,8 @@ #include "clang/Analysis/CallGraph.h" #include "clang/StaticAnalyzer/Core/Checker.h" #include "clang/StaticAnalyzer/Core/PathSensitive/AnalysisManager.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/ExplodedGraph.h" +#include "clang/StaticAnalyzer/Core/PathSensitive/ExprEngine.h" #include "llvm/Support/Process.h" using namespace clang; @@ -179,3 +181,22 @@ public: void ento::registerConfigDumper(CheckerManager &mgr) { mgr.registerChecker<ConfigDumper>(); } + +//===----------------------------------------------------------------------===// +// ExplodedGraph Viewer +//===----------------------------------------------------------------------===// + +namespace { +class ExplodedGraphViewer : public Checker< check::EndAnalysis > { +public: + ExplodedGraphViewer() {} + void checkEndAnalysis(ExplodedGraph &G, BugReporter &B,ExprEngine &Eng) const { + Eng.ViewGraph(0); + } +}; + +} + +void ento::registerExplodedGraphViewer(CheckerManager &mgr) { + mgr.registerChecker<ExplodedGraphViewer>(); +} |