From 665e1835dcad2d944f5d0b1bba221be1aa56c612 Mon Sep 17 00:00:00 2001 From: Chris Smowton Date: Tue, 21 Aug 2018 14:22:27 +0100 Subject: [PATCH] Add call-graph overview --- src/analyses/README.md | 6 +++++- src/analyses/call_graph.h | 17 +++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-) diff --git a/src/analyses/README.md b/src/analyses/README.md index f3ecd34a976..223af5b930f 100644 --- a/src/analyses/README.md +++ b/src/analyses/README.md @@ -24,7 +24,11 @@ To be documented. \subsection analyses-call-graph Call graph and associated helpers (call_grapht) -To be documented. +A [https://en.wikipedia.org/wiki/Call_graph](call graph) for a GOTO model or +GOTO functions collection. \ref call_grapht implements a basic call graph, but +can also export the graph in \ref grapht format, which permits more advanced +graph algorithms to be applied; see \ref call_graph_helpers.h for functions +that work with the \ref grapht representation. \subsection analyses-dominator Dominator analysis (cfg_dominators_templatet) diff --git a/src/analyses/call_graph.h b/src/analyses/call_graph.h index 0712c687d34..50d2e3b769f 100644 --- a/src/analyses/call_graph.h +++ b/src/analyses/call_graph.h @@ -18,6 +18,23 @@ Author: Daniel Kroening, kroening@kroening.com #include #include +/// A call graph (https://en.wikipedia.org/wiki/Call_graph) for a GOTO model +/// or GOTO functions collection. +/// +/// The public constructors build a complete call graph, while +/// \ref call_grapht::create_from_root_function can be used to create a partial +/// call graph rooted at a particular function. +/// +/// The graph is stored as a `std::multimap`, and this class only provides basic +/// tools to construct and query graphs, but it can be exported to a \ref grapht +/// and thus processed using the full graph algorithms library using the +/// \ref get_directed_graph method. See also \ref call_graph_helpers.h for +/// helper methods that work with such grapht-derived call graphs. +/// +/// The graph may optionally collect (and export) the callsite associated with +/// each edge; pass the `collect_callsites` parameter to a constructor if you +/// want this functionality, and query the \ref call_grapht::callsites +/// collection. class call_grapht { public: