cprover
Toggle main menu visibility
Loading...
Searching...
No Matches
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
59
std::set<irep_idt>
get_functions_reachable_within_n_steps
(
60
const
call_grapht::directed_grapht
&graph,
61
const
std::set<irep_idt> &start_functions,
62
std::size_t n);
63
71
std::set<irep_idt>
get_functions_reachable_within_n_steps
(
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
93
void
disconnect_unreachable_functions
(
94
call_grapht::directed_grapht
&graph,
95
const
irep_idt
&function);
96
97
#endif
call_graph.h
Function Call Graphs.
get_reachable_functions
std::set< irep_idt > get_reachable_functions(const call_grapht::directed_grapht &graph, const irep_idt &function)
Get functions reachable from a given function.
Definition
call_graph_helpers.cpp:62
get_functions_reachable_within_n_steps
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.
Definition
call_graph_helpers.cpp:74
disconnect_unreachable_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.
Definition
call_graph_helpers.cpp:100
get_callees
std::set< irep_idt > get_callees(const call_grapht::directed_grapht &graph, const irep_idt &function)
Get functions directly callable from a given function.
Definition
call_graph_helpers.cpp:31
get_reaching_functions
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.
Definition
call_graph_helpers.cpp:68
get_callers
std::set< irep_idt > get_callers(const call_grapht::directed_grapht &graph, const irep_idt &function)
Get functions that call a given function.
Definition
call_graph_helpers.cpp:37
get_shortest_function_path
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.
Definition
call_graph_helpers.cpp:107
call_grapht::directed_grapht
Directed graph representation of this call graph.
Definition
call_graph.h:140
irep_idt
dstringt irep_idt
Definition
verification_result.h:16
analyses
call_graph_helpers.h
Generated by
1.17.0