@@ -149,7 +149,7 @@ static void check_apply_invariants(
149
149
150
150
// change the back edge into assume(false) or assume(guard)
151
151
loop_end->targets .clear ();
152
- loop_end->type = ASSUME;
152
+ loop_end->type = ASSUME;
153
153
if (loop_head->is_goto ())
154
154
loop_end->set_condition (false_exprt ());
155
155
else
@@ -168,20 +168,21 @@ void code_contractst::add_quantified_variable(
168
168
replace_symbolt &replace,
169
169
irep_idt mode)
170
170
{
171
- // If the expression is a quantified expression, this function adds
172
- // the quantified variable to the symbol table and to the expression map
171
+ // If the expression is a quantified expression, this function adds
172
+ // the quantified variable to the symbol table and to the expression map
173
173
174
- // TODO Currently only works if the contract contains only a single quantified formula
174
+ // TODO Currently only works if the contract contains only a single
175
+ // quantified formula
175
176
// i.e. (1) the top-level element is a quantifier formula
176
- // and (2) there are no inner quantifier formulae
177
+ // and (2) there are no inner quantifier formulae
177
178
if (expression.id () == ID_exists || expression.id () == ID_forall)
178
179
{
179
- // get quantified symbol
180
+ // get quantified symbol
180
181
exprt tuple = expression.operands ().front ();
181
182
exprt quantified_variable = tuple.operands ().front ();
182
183
symbol_exprt quantified_symbol = to_symbol_expr (quantified_variable);
183
184
184
- // create fresh symbol
185
+ // create fresh symbol
185
186
symbolt new_symbol = get_fresh_aux_symbol (
186
187
quantified_symbol.type (),
187
188
id2string (quantified_symbol.get_identifier ()),
@@ -264,7 +265,7 @@ bool code_contractst::apply_function_contract(
264
265
}
265
266
266
267
// Replace formal parameters
267
- code_function_callt::argumentst::const_iterator a_it=
268
+ code_function_callt::argumentst::const_iterator a_it =
268
269
call.arguments ().begin ();
269
270
for (code_typet::parameterst::const_iterator p_it = type.parameters ().begin ();
270
271
p_it != type.parameters ().end () && a_it != call.arguments ().end ();
@@ -479,38 +480,38 @@ void code_contractst::instrument_call_statement(
479
480
480
481
return ;
481
482
}
482
- else // Called function has assigns clause
483
+ else // Called function has assigns clause
484
+ {
485
+ replace_symbolt replace;
486
+ // Replace formal parameters
487
+ code_function_callt::argumentst::const_iterator a_it =
488
+ call.arguments ().begin ();
489
+ for (code_typet::parameterst::const_iterator p_it =
490
+ called_type.parameters ().begin ();
491
+ p_it != called_type.parameters ().end () &&
492
+ a_it != call.arguments ().end ();
493
+ ++p_it, ++a_it)
483
494
{
484
- replace_symbolt replace;
485
- // Replace formal parameters
486
- code_function_callt::argumentst::const_iterator a_it =
487
- call.arguments ().begin ();
488
- for (code_typet::parameterst::const_iterator p_it =
489
- called_type.parameters ().begin ();
490
- p_it != called_type.parameters ().end () &&
491
- a_it != call.arguments ().end ();
492
- ++p_it, ++a_it)
495
+ if (!p_it->get_identifier ().empty ())
493
496
{
494
- if (!p_it->get_identifier ().empty ())
495
- {
496
- symbol_exprt p (p_it->get_identifier (), p_it->type ());
497
- replace.insert (p, *a_it);
498
- }
497
+ symbol_exprt p (p_it->get_identifier (), p_it->type ());
498
+ replace.insert (p, *a_it);
499
499
}
500
-
501
- replace (called_assigns);
502
-
503
- // check compatibility of assigns clause with the called function
504
- assigns_clauset called_assigns_clause (
505
- called_assigns, *this , function_id, log);
506
- exprt compatible =
507
- assigns_clause.compatible_expression (called_assigns_clause);
508
- goto_programt alias_assertion;
509
- alias_assertion.add (goto_programt::make_assertion (
510
- compatible, instruction_iterator->source_location ));
511
- program.insert_before_swap (instruction_iterator, alias_assertion);
512
- ++instruction_iterator;
513
500
}
501
+
502
+ replace (called_assigns);
503
+
504
+ // check compatibility of assigns clause with the called function
505
+ assigns_clauset called_assigns_clause (
506
+ called_assigns, *this , function_id, log);
507
+ exprt compatible =
508
+ assigns_clause.compatible_expression (called_assigns_clause);
509
+ goto_programt alias_assertion;
510
+ alias_assertion.add (goto_programt::make_assertion (
511
+ compatible, instruction_iterator->source_location ));
512
+ program.insert_before_swap (instruction_iterator, alias_assertion);
513
+ ++instruction_iterator;
514
+ }
514
515
}
515
516
516
517
bool code_contractst::check_for_looped_mallocs (const goto_programt &program)
@@ -784,7 +785,7 @@ void code_contractst::add_contract_check(
784
785
.symbol_expr ();
785
786
check.add (goto_programt::make_decl (r, skip->source_location ));
786
787
787
- call.lhs ()= r;
788
+ call.lhs () = r;
788
789
return_stmt = code_returnt (r);
789
790
790
791
symbol_exprt ret_val (CPROVER_PREFIX " return_value" , call.lhs ().type ());
0 commit comments