12 #ifndef CPROVER_ANALYSES_CALL_GRAPH_H
13 #define CPROVER_ANALYSES_CALL_GRAPH_H
17 #include <unordered_set>
84 void output(std::ostream &out)
const;
88 typedef std::unordered_set<irep_idt, irep_id_hash>
nodest;
92 typedef std::multimap<irep_idt, irep_idt>
edgest;
95 typedef std::pair<irep_idt, irep_idt>
edget;
101 typedef std::set<locationt, goto_programt::target_less_than>
locationst;
Directed graph representation of this call graph.
std::optional< node_indext > get_node_index(const irep_idt &function) const
Find the graph node by function name.
std::unordered_map< irep_idt, node_indext > nodes_by_name
Maps function names onto node indices.
const nodes_by_namet & get_nodes_by_name() const
Get the node name -> node index map.
std::unordered_map< irep_idt, node_indext > nodes_by_namet
Type of the node name -> node index map.
A call graph (https://en.wikipedia.org/wiki/Call_graph) for a GOTO model or GOTO functions collection...
void add(const irep_idt &caller, const irep_idt &callee)
Add edge.
std::map< edget, locationst > callsitest
Type mapping from call-graph edges onto the set of call instructions that make that call.
std::pair< irep_idt, irep_idt > edget
Type of a call graph edge in edgest
edgest edges
Call graph, including duplicate key-value pairs when there are parallel edges (see grapht documentati...
call_grapht get_inverted() const
Returns an inverted copy of this call graph.
void output_dot(std::ostream &out) const
std::string format_callsites(const edget &edge) const
Prints callsites responsible for a graph edge as comma-separated location numbers,...
std::multimap< irep_idt, irep_idt > edgest
Type of the edges in the call graph.
directed_grapht get_directed_graph() const
Returns a grapht representation of this call graph, suitable for use with generic grapht algorithms.
call_grapht(bool collect_callsites=false)
Create empty call graph.
std::set< locationt, goto_programt::target_less_than > locationst
Type of a set of callsites.
void output(std::ostream &out) const
static call_grapht create_from_root_function(const goto_functionst &functions, const irep_idt &root, bool collect_callsites)
callsitest callsites
Map from call-graph edges to a set of callsites that make the given call.
static call_grapht create_from_root_function(const goto_modelt &model, const irep_idt &root, bool collect_callsites)
void output_xml(std::ostream &out) const
std::unordered_set< irep_idt, irep_id_hash > nodest
Type of the nodes in the call graph.
goto_programt::const_targett locationt
Type of a callsite stored in member callsites
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
A collection of goto functions.
A generic container class for the GOTO intermediate representation of one function.
instructionst::const_iterator const_targett
This class represents a node in a directed graph.
A generic directed graph with a parametric node type.
A Template Class for Graphs.
Edge of the directed graph representation of this call graph.
locationst callsites
Callsites responsible for this graph edge.
Node of the directed graph representation of this call graph.