|
Hi Anna, Here is the patch with the checker documented in docs/analyzer. Le 21/06/2013 08:06, Anna Zaks a
écrit :
It depends whether the calls are inlined in the EG during the analysis, that is if the caller and callee belong to the same translation unit or not. I hope the explanation I give in DebugChecks.rst is clear enough.What happens when multiple functions are analyzed? Do we open multiple documents? Done.Also, we might want to warn that the graph for a non-trivial function would be very large (possibly even in checker description). Otherwise, looks good. Thanks, Regards -- Béatrice Creusillet SILKAN - www.silkan.com |
Index: lib/StaticAnalyzer/Checkers/Checkers.td
===================================================================
--- lib/StaticAnalyzer/Checkers/Checkers.td (revision 184403)
+++ lib/StaticAnalyzer/Checkers/Checkers.td (working copy)
@@ -538,4 +538,8 @@
HelpText<"Check the analyzer's understanding of expressions">,
DescFile<"ExprInspectionChecker.cpp">;
+def ExplodedGraphViewer : Checker<"ViewExplodedGraph">,
+ HelpText<"View Exploded Graphs using GraphViz">,
+ DescFile<"DebugCheckers.cpp">;
+
} // end "debug"
Index: lib/StaticAnalyzer/Checkers/DebugCheckers.cpp
===================================================================
--- lib/StaticAnalyzer/Checkers/DebugCheckers.cpp (revision 184403)
+++ lib/StaticAnalyzer/Checkers/DebugCheckers.cpp (working copy)
@@ -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 @@
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>();
+}
Index: docs/analyzer/DebugChecks.rst
===================================================================
--- docs/analyzer/DebugChecks.rst (revision 184403)
+++ docs/analyzer/DebugChecks.rst (working copy)
@@ -30,6 +30,13 @@
- debug.DumpLiveVars: Show the results of live variable analysis for each
top-level function being analyzed.
+- debug.ViewExplodedGraph: Show the Exploded Graph generated for the
+ different translations units in the input application. When there
+ are several functions, it displays one graph per function, except
+ when a function and its callees belong to the same translation unit:
+ in this case, the calls are (virtually) inlined to form a single
+ graph. Beware that these graphs may grow very large, even for small
+ functions.
Path Tracking
=============
_______________________________________________ cfe-commits mailing list [email protected] http://lists.cs.uiuc.edu/mailman/listinfo/cfe-commits
