#include <exploded-graph.h>
Public Types | |
typedef hash_map< const call_string *, per_call_string_data * > | call_string_data_map_t |
typedef eg_traits::node_t | node_t |
typedef eg_traits::edge_t | edge_t |
typedef eg_traits::dump_args_t | dump_args_t |
typedef eg_traits::cluster_t | cluster_t |
Data Fields | |
auto_delete_vec< node_t > | m_nodes |
auto_delete_vec< edge_t > | m_edges |
Private Types | |
typedef hash_map< const point_and_state *, exploded_node *, eg_hash_map_traits > | map_t |
typedef hash_map< const program_point *, per_program_point_data *, eg_point_hash_map_traits > | point_map_t |
typedef hash_map< function *, per_function_data * > | per_function_data_t |
typedef ordered_hash_map< function *, stats * > | function_stat_map_t |
Private Member Functions | |
void | print_bar_charts (pretty_printer *pp) const |
DISABLE_COPY_AND_ASSIGN (exploded_graph) | |
An exploded_graph is a directed graph of unique <point, state> pairs. It also has a worklist of nodes that are waiting for their successors to be added to the graph.
typedef hash_map<const call_string *, per_call_string_data *> ana::exploded_graph::call_string_data_map_t |
|
inherited |
|
inherited |
|
inherited |
|
private |
|
private |
|
inherited |
|
private |
|
private |
ana::exploded_graph::exploded_graph | ( | const supergraph & | sg, |
logger * | logger, | ||
const extrinsic_state & | ext_state, | ||
const state_purge_map * | purge_map, | ||
const analysis_plan & | plan, | ||
int | verbosity ) |
Referenced by DISABLE_COPY_AND_ASSIGN().
ana::exploded_graph::~exploded_graph | ( | ) |
exploded_edge * ana::exploded_graph::add_edge | ( | exploded_node * | src, |
exploded_node * | dest, | ||
const superedge * | sedge, | ||
bool | could_do_work, | ||
std::unique_ptr< custom_edge_info > | custom = NULL ) |
References ana::custom, and NULL.
Add EDGE to this digraph, and to the preds/succs of its endpoints. Take ownership of EDGE.
exploded_node * ana::exploded_graph::add_function_entry | ( | const function & | fun | ) |
Add NODE to this DIGRAPH, taking ownership.
void ana::exploded_graph::build_initial_worklist | ( | ) |
void exploded_graph::detect_infinite_loops | ( | ) |
Implementation of -Wanalyzer-infinite-loop.
References hash_set< KeyId, Lazy, Traits >::add(), ana::diagnostic_manager::add_diagnostic(), hash_set< KeyId, Lazy, Traits >::contains(), hash_set< KeyId, Lazy, Traits >::elements(), gcc_assert, get_diagnostic_manager(), get_logger(), ana::logger::log(), LOG_FUNC, digraph< eg_traits >::m_nodes, starts_infinite_loop_p(), and UNKNOWN_LOCATION.
void exploded_graph::detect_infinite_recursion | ( | exploded_node * | enode | ) |
Implementation of -Wanalyzer-infinite-recursion. Called when adding ENODE to the graph, after adding its first in-edge. For function entrypoints, see if recursion has occurred, and, if so, check if the state of memory changed between the recursion levels, which would suggest some kind of decreasing variant that leads to termination. For recursive calls where the state of memory is effectively unchanged between recursion levels, warn with -Wanalyzer-infinite-recursion.
References ana::diagnostic_manager::add_diagnostic(), ana::call_string::count_occurrences_of_function(), function::decl, find_previous_entry_to(), gcc_assert, ana::program_point::get_call_string(), get_diagnostic_manager(), ana::exploded_node::get_function(), get_logger(), ana::exploded_node::get_point(), ana::exploded_node::get_supernode(), ana::call_string::get_top_of_stack(), is_entrypoint_p(), ana::logger::log(), ana::call_string::element_t::m_caller, ana::exploded_node::m_index, ana::supernode::m_returning_call, and sufficiently_different_p().
|
private |
References exploded_graph().
|
inlineinherited |
Write .dot information for this graph to a file at PATH, passing ARGS to the nodes and edges. If ROOT_CLUSTER is non-NULL, use it to organize the nodes into clusters.
References path.
|
inlineinherited |
Write .dot information for this graph to FP, passing ARGS to the nodes and edges. If ROOT_CLUSTER is non-NULL, use it to organize the nodes into clusters.
|
inlineinherited |
Write .dot information for this graph to PP, passing ARGS to the nodes and edges. If ROOT_CLUSTER is non-NULL, use it to organize the nodes into clusters.
void ana::exploded_graph::dump_exploded_nodes | ( | ) | const |
void ana::exploded_graph::dump_states_for_supernode | ( | FILE * | , |
const supernode * | snode ) const |
void ana::exploded_graph::dump_stats | ( | FILE * | ) | const |
exploded_node * exploded_graph::find_previous_entry_to | ( | function * | top_of_stack_fun, |
exploded_node * | enode ) const |
Walk backwards through the eg, looking for the first enode we find that's also the entrypoint of the same function.
References ana::exploded_node::get_function(), is_entrypoint_p(), ana::worklist::length(), dnode< GraphTraits >::m_preds, NULL, and visited.
Referenced by detect_infinite_recursion().
|
inline |
References m_plan.
|
inline |
References m_diagnostic_manager.
Referenced by detect_infinite_loops(), and detect_infinite_recursion().
|
inline |
References m_diagnostic_manager.
|
inline |
References m_ext_state.
|
inline |
References m_ext_state.
|
inline |
References m_global_stats.
|
inline |
References m_logger.
Referenced by detect_infinite_loops(), and detect_infinite_recursion().
exploded_node * ana::exploded_graph::get_node_by_index | ( | int | idx | ) | const |
exploded_node * ana::exploded_graph::get_or_create_node | ( | const program_point & | point, |
const program_state & | state, | ||
exploded_node * | enode_for_diag, | ||
bool | add_to_worklist = true ) |
References add_to_worklist().
per_call_string_data * ana::exploded_graph::get_or_create_per_call_string_data | ( | const call_string & | ) |
per_function_data * ana::exploded_graph::get_or_create_per_function_data | ( | function * | ) |
per_program_point_data * ana::exploded_graph::get_or_create_per_program_point_data | ( | const program_point & | ) |
|
inline |
References m_origin.
|
inline |
References m_per_call_string_data.
per_function_data * ana::exploded_graph::get_per_function_data | ( | function * | ) | const |
per_program_point_data * ana::exploded_graph::get_per_program_point_data | ( | const program_point & | ) | const |
|
inline |
References m_purge_map.
|
inline |
References m_worklist.
|
inline |
References m_sg.
Referenced by starts_infinite_loop_p().
void ana::exploded_graph::log_stats | ( | ) | const |
bool ana::exploded_graph::maybe_create_dynamic_call | ( | const gcall & | call, |
tree | fn_decl, | ||
exploded_node * | node, | ||
program_state | next_state, | ||
program_point & | next_point, | ||
uncertainty_t * | uncertainty, | ||
logger * | logger ) |
bool ana::exploded_graph::maybe_process_run_of_before_supernode_enodes | ( | exploded_node * | node | ) |
void ana::exploded_graph::on_escaped_function | ( | tree | fndecl | ) |
|
private |
void ana::exploded_graph::process_node | ( | exploded_node * | node | ) |
void ana::exploded_graph::process_worklist | ( | ) |
void ana::exploded_graph::save_diagnostic | ( | const state_machine & | sm, |
const exploded_node * | enode, | ||
const supernode * | node, | ||
const gimple * | stmt, | ||
stmt_finder * | finder, | ||
tree | var, | ||
state_machine::state_t | state, | ||
pending_diagnostic * | d ) |
References ana::stmt.
std::unique_ptr< json::object > ana::exploded_graph::to_json | ( | ) | const |
void ana::exploded_graph::unwind_from_exception | ( | exploded_node & | enode, |
const gimple * | stmt, | ||
region_model_context * | ctxt ) |
References ana::stmt.
|
private |
Referenced by get_diagnostic_manager(), and get_diagnostic_manager().
|
inherited |
|
private |
Referenced by get_engine(), and get_ext_state().
|
private |
|
private |
Referenced by get_global_stats().
|
private |
Referenced by get_logger().
|
inherited |
Referenced by ana::exploded_graph::detect_infinite_loops().
|
private |
Referenced by get_origin().
|
private |
Referenced by get_per_call_string_data().
|
private |
|
private |
|
private |
|
private |
|
private |
Referenced by get_analysis_plan().
|
private |
|
private |
Referenced by get_purge_map().
|
private |
Referenced by get_supergraph().
|
private |
Referenced by get_scc_id().