CBMC
call_graph_helpers.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Function Call Graph Helpers
4 
5 Author: Chris Smowton, chris.smowton@diffblue.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_ANALYSES_CALL_GRAPH_HELPERS_H
13 #define CPROVER_ANALYSES_CALL_GRAPH_HELPERS_H
14 
15 #include "call_graph.h"
16 
17 // These are convenience functions for working with the directed graph
18 // representation of a call graph, obtained via
19 // `call_grapht::get_directed_graph`. Usually function names must be mapped
20 // to and from node indices, as in `graph.get_node_index("f")`, or
21 // `graph[node_index].function`; these helpers include the translation for
22 // convenience.
23 
28 std::set<irep_idt> get_callees(
29  const call_grapht::directed_grapht &graph, const irep_idt &function);
30 
35 std::set<irep_idt> get_callers(
36  const call_grapht::directed_grapht &graph, const irep_idt &function);
37 
42 std::set<irep_idt> get_reachable_functions(
43  const call_grapht::directed_grapht &graph, const irep_idt &function);
44 
49 std::set<irep_idt> get_reaching_functions(
50  const call_grapht::directed_grapht &graph, const irep_idt &function);
51 
60  const call_grapht::directed_grapht &graph,
61  const std::set<irep_idt> &start_functions,
62  std::size_t n);
63 
72  const call_grapht::directed_grapht &graph,
73  const irep_idt &start_function,
74  std::size_t n);
75 
81 std::list<irep_idt> get_shortest_function_path(
82  const call_grapht::directed_grapht &graph,
83  const irep_idt &src,
84  const irep_idt &dest);
85 
95  const irep_idt &function);
96 
97 #endif
Function Call Graphs.
std::set< irep_idt > get_reaching_functions(const call_grapht::directed_grapht &graph, const irep_idt &function)
Get functions that can reach a given function.
std::set< irep_idt > get_reachable_functions(const call_grapht::directed_grapht &graph, const irep_idt &function)
Get functions reachable from a given function.
std::set< irep_idt > get_callees(const call_grapht::directed_grapht &graph, const irep_idt &function)
Get functions directly callable from a given function.
std::list< irep_idt > get_shortest_function_path(const call_grapht::directed_grapht &graph, const irep_idt &src, const irep_idt &dest)
Get list of functions on the shortest path between two functions.
void disconnect_unreachable_functions(call_grapht::directed_grapht &graph, const irep_idt &function)
Disconnects all functions in the call graph that are unreachable from a given start function.
std::set< irep_idt > get_functions_reachable_within_n_steps(const call_grapht::directed_grapht &graph, const std::set< irep_idt > &start_functions, std::size_t n)
Get either callers or callees reachable from a given list of functions within N steps.
std::set< irep_idt > get_callers(const call_grapht::directed_grapht &graph, const irep_idt &function)
Get functions that call a given function.
Directed graph representation of this call graph.
Definition: call_graph.h:140
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38