Skip to content

Commit cb12035

Browse files
author
Daniel Kroening
committed
remove goto_programt::instructiont::function member
1 parent e2bc456 commit cb12035

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
@@ -1770,9 +1770,6 @@ void goto_checkt::goto_check(
17701770
i_it->source_location.set_java_bytecode_index(
17711771
it->source_location.get_java_bytecode_index());
17721772
}
1773-
1774-
if(i_it->function.empty())
1775-
i_it->function=it->function;
17761773
}
17771774

17781775
// 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
@@ -110,7 +110,7 @@ bool symex_bmct::get_unwind(
110110
const goto_symex_statet::call_stackt &context,
111111
unsigned unwind)
112112
{
113-
const irep_idt id=goto_programt::loop_id(*source.pc);
113+
const irep_idt id = goto_programt::loop_id(source.function, *source.pc);
114114

115115
tvt abort_unwind_decision;
116116
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++)

src/goto-instrument/cover_instrument_other.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -87,5 +87,4 @@ void cover_instrument_end_of_function(
8787
if_it->source_location.set_comment(comment);
8888
if_it->source_location.set_property_class("reachability_constraint");
8989
if_it->source_location.set_function(function);
90-
if_it->function = function;
9190
}

src/goto-instrument/function.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ void function_enter(
9191
body.insert_before(body.instructions.begin());
9292
t->make_function_call(
9393
function_to_call(goto_model.symbol_table, id, f_it->first));
94-
t->function=f_it->first;
9594
}
9695
}
9796

@@ -123,7 +122,6 @@ void function_exit(
123122
if(i_it->is_return())
124123
{
125124
goto_programt::instructiont call;
126-
call.function=f_it->first;
127125
call.make_function_call(
128126
function_to_call(goto_model.symbol_table, id, f_it->first));
129127
body.insert_before_swap(i_it, call);
@@ -154,7 +152,6 @@ void function_exit(
154152
goto_programt::instructiont call;
155153
call.make_function_call(
156154
function_to_call(goto_model.symbol_table, id, f_it->first));
157-
call.function=f_it->first;
158155
body.insert_before_swap(last, call);
159156
}
160157
}

src/goto-instrument/havoc_loops.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,6 @@ void havoc_loopst::build_havoc_code(
9696
side_effect_expr_nondett(lhs.type(), loop_head->source_location);
9797

9898
goto_programt::targett t=dest.add_instruction(ASSIGN);
99-
t->function=loop_head->function;
10099
t->source_location=loop_head->source_location;
101100
t->code=code_assignt(lhs, rhs);
102101
t->code.add_source_location()=loop_head->source_location;

src/goto-instrument/interrupt.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -104,11 +104,9 @@ void interrupt(
104104
t_goto->make_goto(t_orig);
105105
t_goto->source_location=source_location;
106106
t_goto->guard = side_effect_expr_nondett(bool_typet(), source_location);
107-
t_goto->function=original_instruction.function;
108107

109108
t_call->make_function_call(isr_call);
110109
t_call->source_location=source_location;
111-
t_call->function=original_instruction.function;
112110

113111
t_orig->swap(original_instruction);
114112

@@ -132,11 +130,9 @@ void interrupt(
132130
t_goto->make_goto(t_orig);
133131
t_goto->source_location=source_location;
134132
t_goto->guard = side_effect_expr_nondett(bool_typet(), source_location);
135-
t_goto->function=i_it->function;
136133

137134
t_call->make_function_call(isr_call);
138135
t_call->source_location=source_location;
139-
t_call->function=i_it->function;
140136

141137
i_it=t_call; // the for loop already counts us up
142138
}

src/goto-instrument/loop_utils.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ void build_havoc_code(
4949
side_effect_expr_nondett(lhs.type(), loop_head->source_location);
5050

5151
goto_programt::targett t=dest.add_instruction(ASSIGN);
52-
t->function=loop_head->function;
5352
t->source_location=loop_head->source_location;
5453
t->code=code_assignt(lhs, rhs);
5554
t->code.add_source_location()=loop_head->source_location;

src/goto-instrument/model_argc_argv.cpp

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,7 @@ bool model_argc_argv(
152152
main_symbol.mode);
153153

154154
Forall_goto_program_instructions(it, init_instructions)
155-
{
156155
it->source_location.set_file("<built-in-library>");
157-
it->function=goto_model.goto_functions.entry_point();
158-
}
159156

160157
goto_functionst::function_mapt::iterator start_entry=
161158
goto_model.goto_functions.function_map.find(

src/goto-instrument/nondet_static.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ void nondet_static(
9797
side_effect_expr_nondett(
9898
sym.type(), original_instruction.source_location));
9999
i_it->source_location = original_instruction.source_location;
100-
i_it->function = original_instruction.function;
101100
}
102101
}
103102
else if(instruction.is_function_call())

src/goto-instrument/skip_loops.cpp

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@ static bool skip_loops(
4848
goto_programt::targett g=goto_program.insert_before(loop_head);
4949
g->make_goto(next, true_exprt());
5050
g->source_location=loop_head->source_location;
51-
g->function=loop_head->function;
5251

5352
++l_it;
5453
}

src/goto-instrument/stack_depth.cpp

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ void stack_depth(
5454
goto_programt::targett assert_ins=goto_program.insert_before(first);
5555
assert_ins->make_assertion(guard);
5656
assert_ins->source_location=first->source_location;
57-
assert_ins->function=first->function;
5857

5958
assert_ins->source_location.set_comment(
6059
"Stack depth exceeds "+std::to_string(i_depth));
@@ -65,7 +64,6 @@ void stack_depth(
6564
plus_ins->code=code_assignt(symbol,
6665
plus_exprt(symbol, from_integer(1, symbol.type())));
6766
plus_ins->source_location=first->source_location;
68-
plus_ins->function=first->function;
6967

7068
goto_programt::targett last=--goto_program.instructions.end();
7169
assert(last->is_end_function());
@@ -75,7 +73,6 @@ void stack_depth(
7573
minus_ins.code=code_assignt(symbol,
7674
minus_exprt(symbol, from_integer(1, symbol.type())));
7775
minus_ins.source_location=last->source_location;
78-
minus_ins.function=last->function;
7976

8077
goto_program.insert_before_swap(last, minus_ins);
8178
}
@@ -108,7 +105,6 @@ void stack_depth(
108105
it->make_assignment();
109106
it->code=code_assignt(sym, from_integer(0, sym.type()));
110107
// no suitable value for source location -- omitted
111-
it->function = INITIALIZE_FUNCTION;
112108

113109
// update counters etc.
114110
goto_model.goto_functions.update();

0 commit comments

Comments
 (0)