23 std::set<irep_idt> result;
25 const auto &neighbours = forwards ? fnode.
out : fnode.in;
26 for(
const auto &succ_edge : neighbours)
27 result.insert(graph[succ_edge.first].function);
54 std::vector<call_grapht::directed_grapht::node_indext> connected_nodes =
56 std::set<irep_idt> result;
57 for(
const auto i : connected_nodes)
58 result.insert(graph[i].
function);
76 const std::set<irep_idt> &start_functions,
79 std::vector<std::size_t> start_indices;
80 std::set<irep_idt> result;
82 for(
const auto &func : start_functions)
86 result.insert(graph[index].
function);
96 std::set<irep_idt> start_functions({start_function});
112 std::list<irep_idt> result;
113 std::list<std::size_t> path;
118 for(
const auto &n : path)
119 result.push_back(graph[n].
function);
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.
static std::set< irep_idt > get_neighbours(const call_grapht::directed_grapht &graph, const irep_idt &function, bool forwards)
Get either callers or callees of 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.
static std::set< irep_idt > get_connected_functions(const call_grapht::directed_grapht &graph, const irep_idt &function, bool forwards)
Get either reachable functions or functions that can reach a given function.
Function Call Graph Helpers.
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.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
std::vector< node_indext > get_reachable(node_indext src, bool forwards) const
Run depth-first search on the graph, starting from a single source node.
std::vector< typename N::node_indext > depth_limited_search(typename N::node_indext src, std::size_t limit) const
Run recursive depth-limited search on the graph, starting from multiple source nodes,...
void shortest_path(node_indext src, node_indext dest, patht &path) const
void disconnect_unreachable(node_indext src)
Removes any edges between nodes in a graph that are unreachable from a given start node.
const edgest & out(node_indext n) const