Skip to content

remove goto_programt::instructiont::function member [blocks: #3113] #3126

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Feb 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions jbmc/src/java_bytecode/remove_exceptions.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -237,7 +237,6 @@ void remove_exceptionst::instrument_exception_handler(
t_null->code=code_assignt(
thrown_global_symbol,
null_voidptr);
t_null->function=instr_it->function;

// add the assignment exc = @inflight_exception (before the null assignment)
goto_programt::targett t_exc=goto_program.insert_after(instr_it);
Expand All @@ -246,7 +245,6 @@ void remove_exceptionst::instrument_exception_handler(
t_exc->code=code_assignt(
thrown_exception_local,
typecast_exprt(thrown_global_symbol, thrown_exception_local.type()));
t_exc->function=instr_it->function;
}
instr_it->make_skip();
}
Expand Down Expand Up @@ -352,7 +350,6 @@ void remove_exceptionst::add_exception_dispatch_sequence(
goto_programt::targett t_exc=goto_program.insert_after(instr_it);
t_exc->make_goto(new_state_pc);
t_exc->source_location=instr_it->source_location;
t_exc->function=instr_it->function;

// use instanceof to check that this is the correct handler
struct_tag_typet type(stack_catch[i][j].first);
Expand All @@ -377,7 +374,6 @@ void remove_exceptionst::add_exception_dispatch_sequence(

default_dispatch->make_goto(default_target);
default_dispatch->source_location=instr_it->source_location;
default_dispatch->function=instr_it->function;

// add dead instructions
for(const auto &local : locals)
Expand All @@ -386,7 +382,6 @@ void remove_exceptionst::add_exception_dispatch_sequence(
t_dead->make_dead();
t_dead->code=code_deadt(local);
t_dead->source_location=instr_it->source_location;
t_dead->function=instr_it->function;
}
}

Expand Down Expand Up @@ -466,7 +461,6 @@ bool remove_exceptionst::instrument_function_call(
goto_programt::targett t_null=goto_program.insert_after(instr_it);
t_null->make_goto(next_it);
t_null->source_location=instr_it->source_location;
t_null->function=instr_it->function;
t_null->guard=no_exception_currently_in_flight;
}

Expand Down
3 changes: 0 additions & 3 deletions jbmc/src/jbmc/jbmc_parse_options.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -840,9 +840,6 @@ void jbmc_parse_optionst::process_goto_function(
function.compute_location_numbers();
goto_function.body.compute_loop_numbers();
}

// update the function member in each instruction
function.update_instructions_function();
}
}

Expand Down
15 changes: 0 additions & 15 deletions jbmc/src/jdiff/java_syntactic_diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -75,21 +75,6 @@ bool java_syntactic_difft::operator()()
modified_functions.insert(it->first);
continue;
}

goto_programt::instructionst::const_iterator i_it1 =
it->second.body.instructions.begin();
for(goto_programt::instructionst::const_iterator
i_it2 = f_it->second.body.instructions.begin();
i_it1 != it->second.body.instructions.end() &&
i_it2 != f_it->second.body.instructions.end();
++i_it1, ++i_it2)
{
if(i_it1->function != i_it2->function)
{
modified_functions.insert(it->first);
break;
}
}
}
forall_goto_functions(it, goto_model2.goto_functions)
{
Expand Down
6 changes: 0 additions & 6 deletions src/analyses/flow_insensitive_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,12 +212,9 @@ bool flow_insensitive_analysis_baset::do_function_call(

goto_programt::targett r = temp.add(goto_programt::make_return(code_returnt(
side_effect_expr_nondett(code.lhs().type(), l_call->source_location))));

r->function=f_it->first;
r->location_number=0;

goto_programt::targett t = temp.add(goto_programt::make_end_function());
t->function=f_it->first;
t->location_number=1;

locationt l_next=l_call; l_next++;
Expand All @@ -242,9 +239,6 @@ bool flow_insensitive_analysis_baset::do_function_call(
// get the state at the beginning of the function
locationt l_begin=goto_function.body.instructions.begin();

DATA_INVARIANT(
l_begin->function == f_it->first, "function names have to match");

// do the edge from the call site to the beginning of the function
new_data =
state.transform(ns, calling_function, l_call, f_it->first, l_begin);
Expand Down
3 changes: 0 additions & 3 deletions src/analyses/goto_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1900,9 +1900,6 @@ void goto_checkt::goto_check(
i_it->source_location.set_java_bytecode_index(
it->source_location.get_java_bytecode_index());
}

if(i_it->function.empty())
i_it->function=it->function;
}

// insert new instructions -- make sure targets are not moved
Expand Down
1 change: 0 additions & 1 deletion src/analyses/interval_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,6 @@ void instrument_intervals(
t->make_assumption(conjunction(assertion));
i_it++; // goes to original instruction
t->source_location=i_it->source_location;
t->function=i_it->function;
}
}
}
Expand Down
3 changes: 0 additions & 3 deletions src/assembler/remove_asm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -493,9 +493,6 @@ void remove_asmt::process_function(
it->make_skip();
did_something = true;

for(auto &instruction : tmp_dest.instructions)
instruction.function = it->function;

goto_programt::targett next = it;
next++;

Expand Down
15 changes: 0 additions & 15 deletions src/goto-diff/syntactic_diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,21 +74,6 @@ bool syntactic_difft::operator()()
modified_functions.insert(it->first);
continue;
}

goto_programt::instructionst::const_iterator
i_it1=it->second.body.instructions.begin();
for(goto_programt::instructionst::const_iterator
i_it2=f_it->second.body.instructions.begin();
i_it1!=it->second.body.instructions.end() &&
i_it2!=f_it->second.body.instructions.end();
++i_it1, ++i_it2)
{
if(i_it1->function != i_it2->function)
{
modified_functions.insert(it->first);
break;
}
}
}
forall_goto_functions(it, goto_model2.goto_functions)
{
Expand Down
2 changes: 1 addition & 1 deletion src/goto-diff/unified_diff.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ bool unified_difft::instructions_equal(
const goto_programt::instructiont &ins1,
const goto_programt::instructiont &ins2)
{
return ins1.equals(ins2) && ins1.function == ins2.function &&
return ins1.equals(ins2) &&
(ins1.targets.empty() ||
instructions_equal(*ins1.get_target(), *ins2.get_target()));
}
Expand Down
2 changes: 0 additions & 2 deletions src/goto-instrument/branch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,13 @@ void branch(
goto_programt::targett t1=body.insert_after(i_it);
t1->make_function_call(
function_to_call(goto_model.symbol_table, id, "taken"));
t1->function=f_it->first;

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

goto_programt::targett t3=body.insert_after(t2);
t3->make_function_call(
function_to_call(goto_model.symbol_table, id, "not-taken"));
t3->function=f_it->first;
i_it->targets.clear();
i_it->targets.push_back(t3);
}
Expand Down
13 changes: 0 additions & 13 deletions src/goto-instrument/code_contracts.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@ static void check_apply_invariants(
{
goto_programt::targett a=havoc_code.add_instruction(ASSERT);
a->guard=invariant;
a->function=loop_head->function;
a->source_location=loop_head->source_location;
a->source_location.set_comment("Loop invariant violated before entry");
}
Expand All @@ -124,7 +123,6 @@ static void check_apply_invariants(
{
goto_programt::targett assume=havoc_code.add_instruction(ASSUME);
assume->guard=invariant;
assume->function=loop_head->function;
assume->source_location=loop_head->source_location;
}

Expand All @@ -135,7 +133,6 @@ static void check_apply_invariants(
jump->guard =
side_effect_expr_nondett(bool_typet(), loop_head->source_location);
jump->targets.push_back(loop_end);
jump->function=loop_head->function;
}

// Now havoc at the loop head. Use insert_swap to
Expand All @@ -146,7 +143,6 @@ static void check_apply_invariants(
{
goto_programt::instructiont a(ASSERT);
a.guard=invariant;
a.function=loop_end->function;
a.source_location=loop_end->source_location;
a.source_location.set_comment("Loop invariant not preserved");
goto_function.body.insert_before_swap(loop_end, a);
Expand Down Expand Up @@ -216,7 +212,6 @@ void code_contractst::apply_contract(
{
goto_programt::instructiont a(ASSERT);
a.guard=requires;
a.function=target->function;
a.source_location=target->source_location;

goto_program.insert_before_swap(target, a);
Expand Down Expand Up @@ -295,7 +290,6 @@ void code_contractst::add_contract_check(
// build skip so that if(nondet) can refer to it
goto_programt tmp_skip;
goto_programt::targett skip=tmp_skip.add_instruction(SKIP);
skip->function=dest.instructions.front().function;
skip->source_location=ensures.source_location();

goto_programt check;
Expand All @@ -304,7 +298,6 @@ void code_contractst::add_contract_check(
goto_programt::targett g=check.add_instruction();
g->make_goto(
skip, side_effect_expr_nondett(bool_typet(), skip->source_location));
g->function=skip->function;
g->source_location=skip->source_location;

// prepare function call including all declarations
Expand All @@ -315,7 +308,6 @@ void code_contractst::add_contract_check(
if(gf.type.return_type()!=empty_typet())
{
goto_programt::targett d=check.add_instruction(DECL);
d->function=skip->function;
d->source_location=skip->source_location;

symbol_exprt r=
Expand All @@ -336,7 +328,6 @@ void code_contractst::add_contract_check(
++p_it)
{
goto_programt::targett d=check.add_instruction(DECL);
d->function=skip->function;
d->source_location=skip->source_location;

symbol_exprt p=
Expand All @@ -358,7 +349,6 @@ void code_contractst::add_contract_check(
{
goto_programt::targett a=check.add_instruction();
a->make_assumption(requires);
a->function=skip->function;
a->source_location=requires.source_location();

// rewrite any use of parameters
Expand All @@ -368,13 +358,11 @@ void code_contractst::add_contract_check(
// ret=function(parameter1, ...)
goto_programt::targett f=check.add_instruction();
f->make_function_call(call);
f->function=skip->function;
f->source_location=skip->source_location;

// assert(ensures)
goto_programt::targett a=check.add_instruction();
a->make_assertion(ensures);
a->function=skip->function;
a->source_location=ensures.source_location();

// rewrite any use of __CPROVER_return_value
Expand All @@ -383,7 +371,6 @@ void code_contractst::add_contract_check(
// assume(false)
goto_programt::targett af=check.add_instruction();
af->make_assumption(false_exprt());
af->function=skip->function;
af->source_location=ensures.source_location();

// prepend the new code to dest
Expand Down
1 change: 0 additions & 1 deletion src/goto-instrument/cover_instrument.h
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class cover_instrumenter_baset
t->source_location.set(ID_coverage_criterion, coverage_criterion);
t->source_location.set_property_class(property_class);
t->source_location.set_function(function_id);
t->function = function_id;
}

bool is_non_cover_assertion(goto_programt::const_targett t) const
Expand Down
3 changes: 0 additions & 3 deletions src/goto-instrument/cover_instrument_mcdc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -667,7 +667,6 @@ void cover_mcdc_instrumentert::instrument(
i_it->source_location.set(ID_coverage_criterion, coverage_criterion);
i_it->source_location.set_property_class(property_class);
i_it->source_location.set_function(function_id);
i_it->function = function_id;

std::string comment_f = description + " `" + p_string + "' false";
goto_program.insert_before_swap(i_it);
Expand All @@ -677,7 +676,6 @@ void cover_mcdc_instrumentert::instrument(
i_it->source_location.set(ID_coverage_criterion, coverage_criterion);
i_it->source_location.set_property_class(property_class);
i_it->source_location.set_function(function_id);
i_it->function = function_id;
}

std::set<exprt> controlling;
Expand All @@ -704,7 +702,6 @@ void cover_mcdc_instrumentert::instrument(
i_it->source_location.set(ID_coverage_criterion, coverage_criterion);
i_it->source_location.set_property_class(property_class);
i_it->source_location.set_function(function_id);
i_it->function = function_id;
}

for(std::size_t i = 0; i < both.size() * 2 + controlling.size(); i++)
Expand Down
1 change: 0 additions & 1 deletion src/goto-instrument/cover_instrument_other.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,5 +86,4 @@ void cover_instrument_end_of_function(
if_it->source_location.set_comment(comment);
if_it->source_location.set_property_class("reachability_constraint");
if_it->source_location.set_function(function_id);
if_it->function = function_id;
}
3 changes: 0 additions & 3 deletions src/goto-instrument/function.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@ void function_enter(
body.insert_before(body.instructions.begin());
t->make_function_call(
function_to_call(goto_model.symbol_table, id, f_it->first));
t->function=f_it->first;
}
}

Expand Down Expand Up @@ -123,7 +122,6 @@ void function_exit(
if(i_it->is_return())
{
goto_programt::instructiont call;
call.function=f_it->first;
call.make_function_call(
function_to_call(goto_model.symbol_table, id, f_it->first));
body.insert_before_swap(i_it, call);
Expand Down Expand Up @@ -154,7 +152,6 @@ void function_exit(
goto_programt::instructiont call;
call.make_function_call(
function_to_call(goto_model.symbol_table, id, f_it->first));
call.function=f_it->first;
body.insert_before_swap(last, call);
}
}
Expand Down
4 changes: 0 additions & 4 deletions src/goto-instrument/generate_function_bodies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ class assume_false_generate_function_bodiest : public generate_function_bodiest
// NOLINTNEXTLINE
auto add_instruction = [&]() {
auto instruction = function.body.add_instruction();
instruction->function = function_name;
instruction->source_location = function_symbol.location;
return instruction;
};
Expand All @@ -99,7 +98,6 @@ class assert_false_generate_function_bodiest : public generate_function_bodiest
// NOLINTNEXTLINE
auto add_instruction = [&]() {
auto instruction = function.body.add_instruction();
instruction->function = function_name;
instruction->source_location = function_symbol.location;
instruction->source_location.set_function(function_name);
return instruction;
Expand Down Expand Up @@ -130,7 +128,6 @@ class assert_false_then_assume_false_generate_function_bodiest
// NOLINTNEXTLINE
auto add_instruction = [&]() {
auto instruction = function.body.add_instruction();
instruction->function = function_name;
instruction->source_location = function_symbol.location;
instruction->source_location.set_function(function_name);
return instruction;
Expand Down Expand Up @@ -212,7 +209,6 @@ class havoc_generate_function_bodiest : public generate_function_bodiest
// NOLINTNEXTLINE
auto add_instruction = [&]() {
auto instruction = function.body.add_instruction();
instruction->function = function_name;
instruction->source_location = function_symbol.location;
return instruction;
};
Expand Down
4 changes: 0 additions & 4 deletions src/goto-instrument/interrupt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,9 @@ static void interrupt(
t_goto->make_goto(t_orig);
t_goto->source_location=source_location;
t_goto->guard = side_effect_expr_nondett(bool_typet(), source_location);
t_goto->function=original_instruction.function;

t_call->make_function_call(isr_call);
t_call->source_location=source_location;
t_call->function=original_instruction.function;

t_orig->swap(original_instruction);

Expand All @@ -138,11 +136,9 @@ static void interrupt(
t_goto->make_goto(t_orig);
t_goto->source_location=source_location;
t_goto->guard = side_effect_expr_nondett(bool_typet(), source_location);
t_goto->function=i_it->function;

t_call->make_function_call(isr_call);
t_call->source_location=source_location;
t_call->function=i_it->function;

i_it=t_call; // the for loop already counts us up
}
Expand Down
Loading