Skip to content

Commit 16c6c32

Browse files
author
Daniel Kroening
committed
remove goto_programt::instructiont::function member
1 parent d697124 commit 16c6c32

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+17
-204
lines changed

jbmc/src/java_bytecode/remove_exceptions.cpp

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,6 @@ void remove_exceptionst::instrument_exception_handler(
237237
t_null->code=code_assignt(
238238
thrown_global_symbol,
239239
null_voidptr);
240-
t_null->function=instr_it->function;
241240

242241
// add the assignment exc = @inflight_exception (before the null assignment)
243242
goto_programt::targett t_exc=goto_program.insert_after(instr_it);
@@ -246,7 +245,6 @@ void remove_exceptionst::instrument_exception_handler(
246245
t_exc->code=code_assignt(
247246
thrown_exception_local,
248247
typecast_exprt(thrown_global_symbol, thrown_exception_local.type()));
249-
t_exc->function=instr_it->function;
250248
}
251249
instr_it->make_skip();
252250
}
@@ -351,7 +349,6 @@ void remove_exceptionst::add_exception_dispatch_sequence(
351349
goto_programt::targett t_exc=goto_program.insert_after(instr_it);
352350
t_exc->make_goto(new_state_pc);
353351
t_exc->source_location=instr_it->source_location;
354-
t_exc->function=instr_it->function;
355352

356353
// use instanceof to check that this is the correct handler
357354
symbol_typet type(stack_catch[i][j].first);
@@ -376,7 +373,6 @@ void remove_exceptionst::add_exception_dispatch_sequence(
376373

377374
default_dispatch->make_goto(default_target);
378375
default_dispatch->source_location=instr_it->source_location;
379-
default_dispatch->function=instr_it->function;
380376

381377
// add dead instructions
382378
for(const auto &local : locals)
@@ -385,7 +381,6 @@ void remove_exceptionst::add_exception_dispatch_sequence(
385381
t_dead->make_dead();
386382
t_dead->code=code_deadt(local);
387383
t_dead->source_location=instr_it->source_location;
388-
t_dead->function=instr_it->function;
389384
}
390385
}
391386

@@ -467,7 +462,6 @@ bool remove_exceptionst::instrument_function_call(
467462
goto_programt::targett t_null=goto_program.insert_after(instr_it);
468463
t_null->make_goto(next_it);
469464
t_null->source_location=instr_it->source_location;
470-
t_null->function=instr_it->function;
471465
t_null->guard=no_exception_currently_in_flight;
472466
}
473467

src/analyses/flow_insensitive_analysis.cpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -212,12 +212,10 @@ bool flow_insensitive_analysis_baset::do_function_call(
212212
goto_programt::targett r=temp.add_instruction();
213213
r->make_return();
214214
r->code=code_returnt(rhs);
215-
r->function=f_it->first;
216215
r->location_number=0;
217216

218217
goto_programt::targett t=temp.add_instruction(END_FUNCTION);
219218
t->code.set(ID_identifier, code.function());
220-
t->function=f_it->first;
221219
t->location_number=1;
222220

223221
locationt l_next=l_call; l_next++;
@@ -238,9 +236,6 @@ bool flow_insensitive_analysis_baset::do_function_call(
238236
// get the state at the beginning of the function
239237
locationt l_begin=goto_function.body.instructions.begin();
240238

241-
DATA_INVARIANT(
242-
l_begin->function == f_it->first, "function names have to match");
243-
244239
// do the edge from the call site to the beginning of the function
245240
new_data =
246241
state.transform(ns, calling_function, l_call, f_it->first, l_begin);

src/analyses/goto_check.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1774,9 +1774,6 @@ void goto_checkt::goto_check(
17741774
i_it->source_location.set_java_bytecode_index(
17751775
it->source_location.get_java_bytecode_index());
17761776
}
1777-
1778-
if(i_it->function.empty())
1779-
i_it->function=it->function;
17801777
}
17811778

17821779
// insert new instructions -- make sure targets are not moved

src/analyses/interval_analysis.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ void instrument_intervals(
8282
t->make_assumption(conjunction(assertion));
8383
i_it++; // goes to original instruction
8484
t->source_location=i_it->source_location;
85-
t->function=i_it->function;
8685
}
8786
}
8887
}

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/aggressive_slicer.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,8 @@ void aggressive_slicert::get_all_functions_containing_properties()
4646
for(const auto &ins : fct.second.body.instructions)
4747
if(ins.is_assert())
4848
{
49-
if(functions_to_keep.insert(ins.function).second)
50-
note_functions_to_keep(ins.function);
49+
if(functions_to_keep.insert(fct.first).second)
50+
note_functions_to_keep(fct.first);
5151
}
5252
}
5353
}

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/code_contracts.cpp

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,6 @@ static void check_apply_invariants(
111111
{
112112
goto_programt::targett a=havoc_code.add_instruction(ASSERT);
113113
a->guard=invariant;
114-
a->function=loop_head->function;
115114
a->source_location=loop_head->source_location;
116115
a->source_location.set_comment("Loop invariant violated before entry");
117116
}
@@ -123,7 +122,6 @@ static void check_apply_invariants(
123122
{
124123
goto_programt::targett assume=havoc_code.add_instruction(ASSUME);
125124
assume->guard=invariant;
126-
assume->function=loop_head->function;
127125
assume->source_location=loop_head->source_location;
128126
}
129127

@@ -134,7 +132,6 @@ static void check_apply_invariants(
134132
jump->guard =
135133
side_effect_expr_nondett(bool_typet(), loop_head->source_location);
136134
jump->targets.push_back(loop_end);
137-
jump->function=loop_head->function;
138135
}
139136

140137
// Now havoc at the loop head. Use insert_swap to
@@ -145,7 +142,6 @@ static void check_apply_invariants(
145142
{
146143
goto_programt::instructiont a(ASSERT);
147144
a.guard=invariant;
148-
a.function=loop_end->function;
149145
a.source_location=loop_end->source_location;
150146
a.source_location.set_comment("Loop invariant not preserved");
151147
goto_function.body.insert_before_swap(loop_end, a);
@@ -215,7 +211,6 @@ void code_contractst::apply_contract(
215211
{
216212
goto_programt::instructiont a(ASSERT);
217213
a.guard=requires;
218-
a.function=target->function;
219214
a.source_location=target->source_location;
220215

221216
goto_program.insert_before_swap(target, a);
@@ -294,7 +289,6 @@ void code_contractst::add_contract_check(
294289
// build skip so that if(nondet) can refer to it
295290
goto_programt tmp_skip;
296291
goto_programt::targett skip=tmp_skip.add_instruction(SKIP);
297-
skip->function=dest.instructions.front().function;
298292
skip->source_location=ensures.source_location();
299293

300294
goto_programt check;
@@ -303,7 +297,6 @@ void code_contractst::add_contract_check(
303297
goto_programt::targett g=check.add_instruction();
304298
g->make_goto(
305299
skip, side_effect_expr_nondett(bool_typet(), skip->source_location));
306-
g->function=skip->function;
307300
g->source_location=skip->source_location;
308301

309302
// prepare function call including all declarations
@@ -314,7 +307,6 @@ void code_contractst::add_contract_check(
314307
if(gf.type.return_type()!=empty_typet())
315308
{
316309
goto_programt::targett d=check.add_instruction(DECL);
317-
d->function=skip->function;
318310
d->source_location=skip->source_location;
319311

320312
symbol_exprt r=
@@ -335,7 +327,6 @@ void code_contractst::add_contract_check(
335327
++p_it)
336328
{
337329
goto_programt::targett d=check.add_instruction(DECL);
338-
d->function=skip->function;
339330
d->source_location=skip->source_location;
340331

341332
symbol_exprt p=
@@ -357,7 +348,6 @@ void code_contractst::add_contract_check(
357348
{
358349
goto_programt::targett a=check.add_instruction();
359350
a->make_assumption(requires);
360-
a->function=skip->function;
361351
a->source_location=requires.source_location();
362352

363353
// rewrite any use of parameters
@@ -367,13 +357,11 @@ void code_contractst::add_contract_check(
367357
// ret=function(parameter1, ...)
368358
goto_programt::targett f=check.add_instruction();
369359
f->make_function_call(call);
370-
f->function=skip->function;
371360
f->source_location=skip->source_location;
372361

373362
// assert(ensures)
374363
goto_programt::targett a=check.add_instruction();
375364
a->make_assertion(ensures);
376-
a->function=skip->function;
377365
a->source_location=ensures.source_location();
378366

379367
// rewrite any use of __CPROVER_return_value
@@ -382,7 +370,6 @@ void code_contractst::add_contract_check(
382370
// assume(false)
383371
goto_programt::targett af=check.add_instruction();
384372
af->make_assumption(false_exprt());
385-
af->function=skip->function;
386373
af->source_location=ensures.source_location();
387374

388375
// prepend the new code to dest

src/goto-instrument/cover_instrument.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ class cover_instrumenter_baset
7373
t->source_location.set(ID_coverage_criterion, coverage_criterion);
7474
t->source_location.set_property_class(property_class);
7575
t->source_location.set_function(function);
76-
t->function = function;
7776
}
7877

7978
bool is_non_cover_assertion(goto_programt::const_targett t) const

src/goto-instrument/cover_instrument_mcdc.cpp

Lines changed: 0 additions & 3 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;
@@ -705,7 +703,6 @@ void cover_mcdc_instrumentert::instrument(
705703
i_it->source_location.set(ID_coverage_criterion, coverage_criterion);
706704
i_it->source_location.set_property_class(property_class);
707705
i_it->source_location.set_function(function);
708-
i_it->function = function;
709706
}
710707

711708
for(std::size_t i = 0; i < both.size() * 2 + controlling.size(); i++)

0 commit comments

Comments
 (0)