20 auto &body = f.second.body;
22 for(
auto it = body.instructions.begin(); it != body.instructions.end(); it++)
26 if(it->is_backwards_goto())
28 const auto &invariants =
static_cast<const exprt &
>(
29 it->condition().find(ID_C_spec_loop_invariant));
30 if(!invariants.is_nil())
35 "Loop invariant is not side-effect free.",
36 it->condition().find_source_location());
40 for(
const auto &invariant : invariants.operands())
42 auto source_location = invariant.source_location();
43 source_location.set_property_class(
"invariant");
44 source_location.set_comment(
"loop invariant");
49 body.insert_before_swap(it->get_target(), assertion);
Base class for all expressions.
function_mapt function_map
goto_functionst goto_functions
GOTO functions.
static instructiont make_assertion(const exprt &g, const source_locationt &l=source_locationt::nil())
Thrown when a goto program that's being processed is in an invalid format, for example passing the wr...
bool has_subexpr(const exprt &expr, const std::function< bool(const exprt &)> &pred)
returns true if the expression has a subexpression that satisfies pred
Deprecated expression utility functions.
void instrument_given_invariants(goto_functionst::function_mapt::value_type &f)
Instrument Given Invariants.