Skip to content

Commit b52531c

Browse files
authored
Merge pull request #5055 from smowton/smowton/cleanup/dominator-static-functions
Make stateless cfgt functions static
2 parents cbec723 + c1b0f0f commit b52531c

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

jbmc/src/java_bytecode/java_local_variable_table.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,19 +85,19 @@ struct procedure_local_cfg_baset<
8585
}
8686
}
8787

88-
java_bytecode_convert_methodt::method_offsett
89-
get_first_node(const method_with_amapt &args) const
88+
static java_bytecode_convert_methodt::method_offsett
89+
get_first_node(const method_with_amapt &args)
9090
{
9191
return args.second.begin()->first;
9292
}
9393

94-
java_bytecode_convert_methodt::method_offsett
95-
get_last_node(const method_with_amapt &args) const
94+
static java_bytecode_convert_methodt::method_offsett
95+
get_last_node(const method_with_amapt &args)
9696
{
9797
return (--args.second.end())->first;
9898
}
9999

100-
bool nodes_empty(const method_with_amapt &args) const
100+
static bool nodes_empty(const method_with_amapt &args)
101101
{
102102
return args.second.empty();
103103
}

src/analyses/cfg_dominators.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -78,13 +78,13 @@ void cfg_dominators_templatet<P, T, post_dom>::fixedpoint(P &program)
7878
{
7979
std::list<T> worklist;
8080

81-
if(cfg.nodes_empty(program))
81+
if(cfgt::nodes_empty(program))
8282
return;
8383

8484
if(post_dom)
85-
entry_node=cfg.get_last_node(program);
85+
entry_node = cfgt::get_last_node(program);
8686
else
87-
entry_node=cfg.get_first_node(program);
87+
entry_node = cfgt::get_first_node(program);
8888
typename cfgt::nodet &n=cfg[cfg.entry_map[entry_node]];
8989
n.dominators.insert(entry_node);
9090

src/goto-programs/cfg.h

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -170,9 +170,18 @@ class cfg_baset:public grapht< cfg_base_nodet<T, I> >
170170
compute_edges(goto_functions, goto_program);
171171
}
172172

173-
I get_first_node(P &program) const { return program.instructions.begin(); }
174-
I get_last_node(P &program) const { return --program.instructions.end(); }
175-
bool nodes_empty(P &program) const { return program.instructions.empty(); }
173+
static I get_first_node(P &program)
174+
{
175+
return program.instructions.begin();
176+
}
177+
static I get_last_node(P &program)
178+
{
179+
return --program.instructions.end();
180+
}
181+
static bool nodes_empty(P &program)
182+
{
183+
return program.instructions.empty();
184+
}
176185
};
177186

178187
template<class T,

0 commit comments

Comments
 (0)