Skip to content

Commit 5df3fca

Browse files
Clean up get_function_id hacks
1 parent 552b100 commit 5df3fca

File tree

4 files changed

+6
-16
lines changed

4 files changed

+6
-16
lines changed

src/analyses/dependence_graph.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ void dep_graph_domaint::control_dependencies(
7676
from->is_assume())
7777
control_deps.insert(from);
7878

79-
const irep_idt id=goto_programt::get_function_id(from);
79+
const irep_idt id=from->function;
8080
const cfg_post_dominatorst &pd=dep_graph.cfg_post_dominators().at(id);
8181

8282
// check all candidates for M

src/goto-instrument/full_slicer.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ void full_slicert::add_jumps(
150150
continue;
151151
}
152152

153-
const irep_idt id=goto_programt::get_function_id(j.PC);
153+
const irep_idt id=j.PC->function;
154154
const cfg_post_dominatorst &pd=post_dominators.at(id);
155155

156156
cfg_post_dominatorst::cfgt::entry_mapt::const_iterator e=
@@ -184,7 +184,7 @@ void full_slicert::add_jumps(
184184

185185
if(cfg[entry->second].node_required)
186186
{
187-
const irep_idt id2=goto_programt::get_function_id(*d_it);
187+
const irep_idt id2=(*d_it)->function;
188188
INVARIANT(id==id2,
189189
"goto/jump expected to be within a single function");
190190

src/goto-programs/goto_program_template.h

+2-11
Original file line numberDiff line numberDiff line change
@@ -386,21 +386,12 @@ class goto_program_templatet
386386
return t;
387387
}
388388

389-
static const irep_idt get_function_id(
390-
const_targett l)
391-
{
392-
while(!l->is_end_function())
393-
++l;
394-
395-
return l->function;
396-
}
397-
398389
static const irep_idt get_function_id(
399390
const goto_program_templatet<codeT, guardT> &p)
400391
{
401-
assert(!p.empty());
392+
PRECONDITION(!p.empty());
402393

403-
return get_function_id(--p.instructions.end());
394+
return p.instructions.back().function;
404395
}
405396

406397
template <typename Target>

src/goto-programs/remove_returns.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -244,8 +244,7 @@ void remove_returnst::operator()(
244244
if(goto_function.body.empty())
245245
return;
246246

247-
replace_returns(
248-
goto_programt::get_function_id(goto_function.body), goto_function);
247+
replace_returns(model_function.get_function_id(), goto_function);
249248
do_function_calls(function_is_stub, goto_function.body);
250249
}
251250

0 commit comments

Comments
 (0)