Skip to content

Commit d1eae28

Browse files
committed
remove goto_programt::instructiont::function member
1 parent f340f08 commit d1eae28

15 files changed

+9
-111
lines changed

src/cbmc/symex_bmc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ bool symex_bmct::get_unwind(
109109
const goto_symex_statet::call_stackt &context,
110110
unsigned unwind)
111111
{
112-
const irep_idt id=goto_programt::loop_id(*source.pc);
112+
const irep_idt id = goto_programt::loop_id(source.function, *source.pc);
113113

114114
tvt abort_unwind_decision;
115115
unsigned this_loop_limit=std::numeric_limits<unsigned>::max();

src/goto-instrument/branch.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,13 @@ void branch(
5353
goto_programt::targett t1=body.insert_after(i_it);
5454
t1->make_function_call(
5555
function_to_call(goto_model.symbol_table, id, "taken"));
56-
t1->function=f_it->first;
5756

5857
goto_programt::targett t2=body.insert_after(t1);
5958
t2->make_goto(i_it->get_target());
6059

6160
goto_programt::targett t3=body.insert_after(t2);
6261
t3->make_function_call(
6362
function_to_call(goto_model.symbol_table, id, "not-taken"));
64-
t3->function=f_it->first;
6563
i_it->targets.clear();
6664
i_it->targets.push_back(t3);
6765
}

src/goto-instrument/cover_instrument.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class cover_instrumenter_baset
7171
t->source_location.set(ID_coverage_criterion, coverage_criterion);
7272
t->source_location.set_property_class(property_class);
7373
t->source_location.set_function(function);
74-
t->function = function;
7574
}
7675

7776
bool is_non_cover_assertion(goto_programt::const_targett t) const

src/goto-instrument/cover_instrument_mcdc.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -668,7 +668,6 @@ void cover_mcdc_instrumentert::instrument(
668668
i_it->source_location.set(ID_coverage_criterion, coverage_criterion);
669669
i_it->source_location.set_property_class(property_class);
670670
i_it->source_location.set_function(function);
671-
i_it->function = function;
672671

673672
std::string comment_f = description + " `" + p_string + "' false";
674673
goto_program.insert_before_swap(i_it);
@@ -678,7 +677,6 @@ void cover_mcdc_instrumentert::instrument(
678677
i_it->source_location.set(ID_coverage_criterion, coverage_criterion);
679678
i_it->source_location.set_property_class(property_class);
680679
i_it->source_location.set_function(function);
681-
i_it->function = function;
682680
}
683681

684682
std::set<exprt> controlling;

src/goto-programs/generate_function_bodies.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,6 @@ class assume_false_generate_function_bodiest : public generate_function_bodiest
7171
// NOLINTNEXTLINE
7272
auto add_instruction = [&]() {
7373
auto instruction = function.body.add_instruction();
74-
instruction->function = function_name;
7574
instruction->source_location = function_symbol.location;
7675
return instruction;
7776
};
@@ -94,7 +93,6 @@ class assert_false_generate_function_bodiest : public generate_function_bodiest
9493
// NOLINTNEXTLINE
9594
auto add_instruction = [&]() {
9695
auto instruction = function.body.add_instruction();
97-
instruction->function = function_name;
9896
instruction->source_location = function_symbol.location;
9997
instruction->source_location.set_function(function_name);
10098
return instruction;
@@ -125,7 +123,6 @@ class assert_false_then_assume_false_generate_function_bodiest
125123
// NOLINTNEXTLINE
126124
auto add_instruction = [&]() {
127125
auto instruction = function.body.add_instruction();
128-
instruction->function = function_name;
129126
instruction->source_location = function_symbol.location;
130127
instruction->source_location.set_function(function_name);
131128
return instruction;
@@ -261,7 +258,6 @@ class havoc_generate_function_bodiest : public generate_function_bodiest,
261258
// NOLINTNEXTLINE
262259
auto add_instruction = [&]() {
263260
auto instruction = function.body.add_instruction();
264-
instruction->function = function_name;
265261
instruction->source_location = function_symbol.location;
266262
return instruction;
267263
};

src/goto-programs/goto_convert_functions.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -204,9 +204,6 @@ void goto_convert_functionst::convert_function(
204204
// add "end of function"
205205
f.body.destructive_append(tmp_end_function);
206206

207-
// do function tags (they are empty at this point)
208-
f.update_instructions_function(identifier);
209-
210207
f.body.update();
211208

212209
if(hide(f.body))

src/goto-programs/goto_function.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -71,14 +71,6 @@ class goto_functiont
7171
parameter_identifiers.clear();
7272
}
7373

74-
/// update the function member in each instruction
75-
/// \param function_id: the `function_id` used for assigning empty function
76-
/// members
77-
void update_instructions_function(const irep_idt &function_id)
78-
{
79-
body.update_instructions_function(function_id);
80-
}
81-
8274
void swap(goto_functiont &other)
8375
{
8476
body.swap(other.body);

src/goto-programs/goto_functions.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,23 +82,12 @@ class goto_functionst
8282
void compute_target_numbers();
8383
void compute_incoming_edges();
8484

85-
/// update the function member in each instruction by setting it to
86-
/// the goto function's identifier
87-
void update_instructions_function()
88-
{
89-
for(auto &func : function_map)
90-
{
91-
func.second.update_instructions_function(func.first);
92-
}
93-
}
94-
9585
void update()
9686
{
9787
compute_incoming_edges();
9888
compute_target_numbers();
9989
compute_location_numbers();
10090
compute_loop_numbers();
101-
update_instructions_function();
10291
}
10392

10493
/// Get the identifier of the entry point to a goto model

src/goto-programs/goto_inline.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -244,14 +244,12 @@ void goto_function_inline(
244244
const irep_idt function,
245245
const namespacet &ns,
246246
message_handlert &message_handler,
247-
bool adjust_function,
248247
bool caching)
249248
{
250249
goto_inlinet goto_inline(
251250
goto_functions,
252251
ns,
253252
message_handler,
254-
adjust_function,
255253
caching);
256254

257255
goto_functionst::function_mapt::iterator f_it=

src/goto-programs/goto_inline_class.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,6 @@ void goto_inlinet::parameter_assignments(
6666
decl->code=code_declt(symbol.symbol_expr());
6767
decl->code.add_source_location()=source_location;
6868
decl->source_location=source_location;
69-
decl->function=adjust_function?target->function:function_name;
7069
}
7170

7271
// this is the actual parameter
@@ -129,8 +128,6 @@ void goto_inlinet::parameter_assignments(
129128
dest.add_instruction(ASSIGN);
130129
dest.instructions.back().source_location=source_location;
131130
dest.instructions.back().code.swap(assignment);
132-
dest.instructions.back().function=
133-
adjust_function?target->function:function_name;
134131
}
135132

136133
if(it1!=arguments.end())
@@ -174,7 +171,6 @@ void goto_inlinet::parameter_destruction(
174171
dead->code=code_deadt(symbol.symbol_expr());
175172
dead->code.add_source_location()=source_location;
176173
dead->source_location=source_location;
177-
dead->function=adjust_function?target->function:function_name;
178174
}
179175
}
180176
}
@@ -281,10 +277,6 @@ void goto_inlinet::insert_function_body(
281277
"final instruction of a function must be an END_FUNCTION");
282278
end.type=LOCATION;
283279

284-
if(adjust_function)
285-
for(auto &instruction : body.instructions)
286-
instruction.function=target->function;
287-
288280
// make sure the inlined function does not introduce hiding
289281
if(goto_function.is_hidden())
290282
{

0 commit comments

Comments
 (0)