Skip to content

Make stateless cfgt functions static #5055

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions jbmc/src/java_bytecode/java_local_variable_table.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,19 +85,19 @@ struct procedure_local_cfg_baset<
}
}

java_bytecode_convert_methodt::method_offsett
get_first_node(const method_with_amapt &args) const
static java_bytecode_convert_methodt::method_offsett
get_first_node(const method_with_amapt &args)
{
return args.second.begin()->first;
}

java_bytecode_convert_methodt::method_offsett
get_last_node(const method_with_amapt &args) const
static java_bytecode_convert_methodt::method_offsett
get_last_node(const method_with_amapt &args)
{
return (--args.second.end())->first;
}

bool nodes_empty(const method_with_amapt &args) const
static bool nodes_empty(const method_with_amapt &args)
{
return args.second.empty();
}
Expand Down
6 changes: 3 additions & 3 deletions src/analyses/cfg_dominators.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,13 @@ void cfg_dominators_templatet<P, T, post_dom>::fixedpoint(P &program)
{
std::list<T> worklist;

if(cfg.nodes_empty(program))
if(cfgt::nodes_empty(program))
return;

if(post_dom)
entry_node=cfg.get_last_node(program);
entry_node = cfgt::get_last_node(program);
else
entry_node=cfg.get_first_node(program);
entry_node = cfgt::get_first_node(program);
typename cfgt::nodet &n=cfg[cfg.entry_map[entry_node]];
n.dominators.insert(entry_node);

Expand Down
15 changes: 12 additions & 3 deletions src/goto-programs/cfg.h
Original file line number Diff line number Diff line change
Expand Up @@ -170,9 +170,18 @@ class cfg_baset:public grapht< cfg_base_nodet<T, I> >
compute_edges(goto_functions, goto_program);
}

I get_first_node(P &program) const { return program.instructions.begin(); }
I get_last_node(P &program) const { return --program.instructions.end(); }
bool nodes_empty(P &program) const { return program.instructions.empty(); }
static I get_first_node(P &program)
{
return program.instructions.begin();
}
static I get_last_node(P &program)
{
return --program.instructions.end();
}
static bool nodes_empty(P &program)
{
return program.instructions.empty();
}
};

template<class T,
Expand Down