Skip to content

use make_X API follow-up #4182

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 5 commits into from
Feb 26, 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
2 changes: 1 addition & 1 deletion jbmc/src/java_bytecode/remove_instanceof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ bool remove_instanceoft::lower_instanceof(
// GOTO programs before the target instruction without inserting into the
// wrong basic block.
goto_program.insert_before_swap(target);
*target = goto_programt::make_skip();
target->turn_into_skip();
// Actually alter the now-moved instruction:
++target;
}
Expand Down
8 changes: 4 additions & 4 deletions src/analyses/constant_propagator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,13 +156,13 @@ void constant_propagator_domaint::transform(

if(from->is_decl())
{
const code_declt &code_decl=to_code_decl(from->code);
const auto &code_decl = from->get_decl();
const symbol_exprt &symbol = code_decl.symbol();
values.set_to_top(symbol);
}
else if(from->is_assign())
{
const code_assignt &assignment=to_code_assign(from->code);
const auto &assignment = from->get_assign();
const exprt &lhs=assignment.lhs();
const exprt &rhs=assignment.rhs();
assign_rec(values, lhs, rhs, ns, cp, true);
Expand All @@ -189,12 +189,12 @@ void constant_propagator_domaint::transform(
}
else if(from->is_dead())
{
const code_deadt &code_dead=to_code_dead(from->code);
const auto &code_dead = from->get_dead();
values.set_to_top(code_dead.symbol());
}
else if(from->is_function_call())
{
const code_function_callt &function_call=to_code_function_call(from->code);
const auto &function_call = from->get_function_call();
const exprt &function=function_call.function();

if(function.id()==ID_symbol)
Expand Down
5 changes: 2 additions & 3 deletions src/analyses/goto_check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1852,7 +1852,7 @@ void goto_checkt::goto_check(
lhs);
goto_programt::targett t =
new_code.add(goto_programt::make_assignment(
code_assignt(std::move(lhs), std::move(rhs)), i.source_location));
std::move(lhs), std::move(rhs), i.source_location));
t->code.add_source_location()=i.source_location;
}
}
Expand All @@ -1867,8 +1867,7 @@ void goto_checkt::goto_check(
const symbol_exprt leak_expr=leak.symbol_expr();

// add self-assignment to get helpful counterexample output
new_code.add(
goto_programt::make_assignment(code_assignt(leak_expr, leak_expr)));
new_code.add(goto_programt::make_assignment(leak_expr, leak_expr));

source_locationt source_location;
source_location.set_function(function_identifier);
Expand Down
12 changes: 4 additions & 8 deletions src/assembler/remove_asm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -266,8 +266,7 @@ void remove_asmt::process_instruction_gcc(

if(x86_32_locked_atomic)
{
goto_programt::targett ab = tmp_dest.add_instruction(ATOMIC_BEGIN);
ab->source_location = code.source_location();
tmp_dest.add(goto_programt::make_atomic_begin(code.source_location()));

codet code_fence(ID_fence);
code_fence.add_source_location() = code.source_location();
Expand Down Expand Up @@ -360,8 +359,7 @@ void remove_asmt::process_instruction_gcc(

if(x86_32_locked_atomic)
{
goto_programt::targett ae = tmp_dest.add_instruction(ATOMIC_END);
ae->source_location = code.source_location();
tmp_dest.add(goto_programt::make_atomic_end(code.source_location()));

x86_32_locked_atomic = false;
}
Expand Down Expand Up @@ -437,8 +435,7 @@ void remove_asmt::process_instruction_msc(

if(x86_32_locked_atomic)
{
goto_programt::targett ab = tmp_dest.add_instruction(ATOMIC_BEGIN);
ab->source_location = code.source_location();
tmp_dest.add(goto_programt::make_atomic_begin(code.source_location()));

codet code_fence(ID_fence);
code_fence.add_source_location() = code.source_location();
Expand All @@ -465,8 +462,7 @@ void remove_asmt::process_instruction_msc(

if(x86_32_locked_atomic)
{
goto_programt::targett ae = tmp_dest.add_instruction(ATOMIC_END);
ae->source_location = code.source_location();
tmp_dest.add(goto_programt::make_atomic_end(code.source_location()));

x86_32_locked_atomic = false;
}
Expand Down
2 changes: 1 addition & 1 deletion src/goto-analyzer/taint_analysis.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ bool taint_analysist::operator()(

goto_programt end, gotos, calls;

end.add_instruction(END_FUNCTION);
end.add(goto_programt::make_end_function());

forall_goto_functions(f_it, goto_functions)
if(f_it->second.body_available() &&
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -914,7 +914,7 @@ void disjunctive_polynomial_accelerationt::build_fixed()
if(loop.find(t)==loop.end())
{
// This instruction isn't part of the loop... Just remove it.
*fixedt = goto_programt::make_skip(fixedt->source_location);
fixedt->turn_into_skip();
continue;
}

Expand Down
26 changes: 11 additions & 15 deletions src/goto-instrument/accelerate/polynomial_accelerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ bool polynomial_acceleratort::accelerate(
// assume(guard);
// assume(no overflows in previous code);

program.add_instruction(ASSUME)->guard=guard;
program.add(goto_programt::make_assumption(guard));

program.assign(
loop_counter,
Expand All @@ -261,7 +261,7 @@ bool polynomial_acceleratort::accelerate(
return false;
}

program.add_instruction(ASSUME)->guard=guard_last;
program.add(goto_programt::make_assumption(guard_last));
program.fix_types();

if(path_is_monotone)
Expand Down Expand Up @@ -406,9 +406,7 @@ bool polynomial_acceleratort::fit_polynomial_sliced(
#endif

// Now do an ASSERT(false) to grab a counterexample
goto_programt::targett assertion=program.add_instruction(ASSERT);
assertion->guard=false_exprt();

program.add(goto_programt::make_assertion(false_exprt()));

// If the path is satisfiable, we've fitted a polynomial. Extract the
// relevant coefficients and return the expression.
Expand Down Expand Up @@ -600,7 +598,7 @@ void polynomial_acceleratort::assert_for_values(
exprt overflow_expr;
overflow.overflow_expr(rhs, overflow_expr);

program.add_instruction(ASSUME)->guard=not_exprt(overflow_expr);
program.add(goto_programt::make_assumption(not_exprt(overflow_expr)));

rhs=typecast_exprt(rhs, target.type());

Expand All @@ -609,8 +607,7 @@ void polynomial_acceleratort::assert_for_values(
const equal_exprt polynomial_holds(target, rhs);

// Finally, assert that the polynomial equals the variable we're fitting.
goto_programt::targett assumption=program.add_instruction(ASSUME);
assumption->guard=polynomial_holds;
program.add(goto_programt::make_assumption(polynomial_holds));
}

void polynomial_acceleratort::cone_of_influence(
Expand Down Expand Up @@ -680,24 +677,23 @@ bool polynomial_acceleratort::check_inductive(
++it)
{
const equal_exprt holds(it->first, it->second.to_expr());
program.add_instruction(ASSUME)->guard=holds;
program.add(goto_programt::make_assumption(holds));

polynomials_hold.push_back(holds);
}

program.append(body);

codet inc_loop_counter=
code_assignt(
loop_counter,
plus_exprt(loop_counter, from_integer(1, loop_counter.type())));
program.add_instruction(ASSIGN)->code=inc_loop_counter;
auto inc_loop_counter = code_assignt(
loop_counter,
plus_exprt(loop_counter, from_integer(1, loop_counter.type())));
program.add(goto_programt::make_assignment(inc_loop_counter));

for(std::vector<exprt>::iterator it=polynomials_hold.begin();
it!=polynomials_hold.end();
++it)
{
program.add_instruction(ASSERT)->guard=*it;
program.add(goto_programt::make_assertion(*it));
}

#ifdef DEBUG
Expand Down
10 changes: 5 additions & 5 deletions src/goto-instrument/accelerate/sat_path_enumerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ bool sat_path_enumeratort::next(patht &path)
program.assume(new_path);
}

program.add_instruction(ASSERT)->guard=false_exprt();
program.add(goto_programt::make_assertion(false_exprt()));

try
{
Expand Down Expand Up @@ -227,13 +227,13 @@ void sat_path_enumeratort::build_fixed()
// As such, any path that jumps outside of the loop or jumps backwards
// to a location other than the loop header (i.e. a nested loop) is not
// one we're interested in, and we'll redirect it to this assume(false).
goto_programt::targett kill=fixed.add_instruction(ASSUME);
kill->guard=false_exprt();
goto_programt::targett kill =
fixed.add(goto_programt::make_assumption(false_exprt()));

// Make a sentinel instruction to mark the end of the loop body.
// We'll use this as the new target for any back-jumps to the loop
// header.
goto_programt::targett end=fixed.add_instruction(SKIP);
goto_programt::targett end = fixed.add(goto_programt::make_skip());

// A pointer to the start of the fixed-path body. We'll be using this to
// iterate over the fixed-path body, but for now it's just a pointer to the
Expand Down Expand Up @@ -269,7 +269,7 @@ void sat_path_enumeratort::build_fixed()
if(loop.find(t)==loop.end())
{
// This instruction isn't part of the loop... Just remove it.
*fixedt = goto_programt::make_skip(fixedt->source_location);
fixedt->turn_into_skip();
continue;
}

Expand Down
2 changes: 1 addition & 1 deletion src/goto-instrument/dump_c.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ void dump_ct::cleanup_decl(
tmp.add(goto_programt::make_decl(decl.symbol()));

if(value.is_not_nil())
tmp.add(goto_programt::make_assignment(code_assignt(decl.op0(), value)));
tmp.add(goto_programt::make_assignment(decl.symbol(), value));

tmp.add(goto_programt::make_end_function());

Expand Down
Loading