6
6
7
7
\*******************************************************************/
8
8
9
+ // TODO add property class on make_assertion
9
10
#include " dfcc_instrument.h"
10
11
#include < goto-programs/goto_convert_class.h>
11
12
@@ -130,17 +131,17 @@ void dfcc_instrumentt::instrument_function(const irep_idt &function_id)
130
131
131
132
function_cfg_infot cfg_info (goto_function);
132
133
133
- const auto &dfcc_param = utils.add_parameter (
134
+ const auto &write_set = utils.add_parameter (
134
135
function_id,
135
136
" __write_set_to_check" ,
136
137
library.dfcc_type [dfcc_typet::SET_PTR]);
137
138
138
- instrument_function_body (function_id, dfcc_param .symbol_expr (), cfg_info);
139
+ instrument_function_body (function_id, write_set .symbol_expr (), cfg_info);
139
140
}
140
141
141
142
void dfcc_instrumentt::instrument_function_body (
142
143
const irep_idt &function_id,
143
- const symbol_exprt &dfcc_param ,
144
+ const symbol_exprt &write_set ,
144
145
cfg_infot &cfg_info)
145
146
{
146
147
auto &goto_function = goto_model.goto_functions .function_map .at (function_id);
@@ -160,7 +161,7 @@ void dfcc_instrumentt::instrument_function_body(
160
161
// instrument the whole body
161
162
instrument_instructions (
162
163
function_id,
163
- dfcc_param ,
164
+ write_set ,
164
165
body,
165
166
body.instructions .begin (),
166
167
body.instructions .end (),
@@ -188,7 +189,7 @@ void dfcc_instrumentt::instrument_function_body(
188
189
189
190
void dfcc_instrumentt::instrument_instructions (
190
191
const irep_idt &function_id,
191
- const symbol_exprt &dfcc_param ,
192
+ const symbol_exprt &write_set ,
192
193
goto_programt &goto_program,
193
194
goto_programt::targett first_instruction,
194
195
const goto_programt::targett &last_instruction, // excluding the last
@@ -222,25 +223,25 @@ void dfcc_instrumentt::instrument_instructions(
222
223
223
224
if (target->is_decl () && must_track_decl_or_dead (target, cfg_info))
224
225
{
225
- instrument_decl (function_id, dfcc_param , target, goto_program, cfg_info);
226
+ instrument_decl (function_id, write_set , target, goto_program, cfg_info);
226
227
}
227
228
if (target->is_dead () && must_track_decl_or_dead (target, cfg_info))
228
229
{
229
- instrument_dead (function_id, dfcc_param , target, goto_program, cfg_info);
230
+ instrument_dead (function_id, write_set , target, goto_program, cfg_info);
230
231
}
231
232
else if (target->is_assign ())
232
233
{
233
234
instrument_assign (
234
- function_id, dfcc_param , target, goto_program, cfg_info);
235
+ function_id, write_set , target, goto_program, cfg_info);
235
236
}
236
237
else if (target->is_function_call ())
237
238
{
238
239
instrument_function_call (
239
- function_id, dfcc_param , target, goto_program, cfg_info);
240
+ function_id, write_set , target, goto_program, cfg_info);
240
241
}
241
242
else if (target->is_other ())
242
243
{
243
- instrument_other (function_id, dfcc_param , target, goto_program, cfg_info);
244
+ instrument_other (function_id, write_set , target, goto_program, cfg_info);
244
245
}
245
246
// else do nothing
246
247
target++;
@@ -263,14 +264,14 @@ bool dfcc_instrumentt::must_track_decl_or_dead(
263
264
264
265
void dfcc_instrumentt::instrument_decl (
265
266
const irep_idt &function_id,
266
- const symbol_exprt &dfcc_param ,
267
+ const symbol_exprt &write_set ,
267
268
goto_programt::targett &target,
268
269
goto_programt &goto_program,
269
270
cfg_infot &cfg_info)
270
271
{
271
272
// ```
272
273
// DECL decl_symbol;
273
- // IF !__dfcc_param GOTO skip_target;
274
+ // IF !__write_set GOTO skip_target;
274
275
// CALL __CPROVER_assignable_obj_set_add(__stack_allocated, &decl_symbol);
275
276
// skip_target: SKIP;
276
277
// ```
@@ -279,11 +280,11 @@ void dfcc_instrumentt::instrument_decl(
279
280
target++;
280
281
goto_programt payload;
281
282
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
282
- utils.make_null_check_expr (dfcc_param )));
283
+ utils.make_null_check_expr (write_set )));
283
284
284
285
payload.add (goto_programt::make_function_call (code_function_callt{
285
286
library.dfcc_fun_symbol [dfcc_funt::SET_ADD_ALLOCATED].symbol_expr (),
286
- {dfcc_param , address_of_exprt (decl_symbol)}}));
287
+ {write_set , address_of_exprt (decl_symbol)}}));
287
288
288
289
auto label_instruction = payload.add (goto_programt::make_skip ());
289
290
goto_instruction->complete_goto (label_instruction);
@@ -295,7 +296,7 @@ void dfcc_instrumentt::instrument_decl(
295
296
296
297
void dfcc_instrumentt::instrument_dead (
297
298
const irep_idt &function_id,
298
- const symbol_exprt &dfcc_param ,
299
+ const symbol_exprt &write_set ,
299
300
goto_programt::targett &target,
300
301
goto_programt &goto_program,
301
302
cfg_infot &cfg_info)
@@ -311,11 +312,11 @@ void dfcc_instrumentt::instrument_dead(
311
312
goto_programt payload;
312
313
313
314
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
314
- utils.make_null_check_expr (dfcc_param )));
315
+ utils.make_null_check_expr (write_set )));
315
316
316
317
payload.add (goto_programt::make_function_call (code_function_callt{
317
318
library.dfcc_fun_symbol [dfcc_funt::SET_REMOVE_DEAD].symbol_expr (),
318
- {dfcc_param , address_of_exprt (decl_symbol)}}));
319
+ {write_set , address_of_exprt (decl_symbol)}}));
319
320
320
321
auto label_instruction = payload.add (goto_programt::make_skip ());
321
322
goto_instruction->complete_goto (label_instruction);
@@ -387,7 +388,7 @@ bool dfcc_instrumentt::must_check_assign_lhs(
387
388
388
389
void dfcc_instrumentt::instrument_assign (
389
390
const irep_idt &function_id,
390
- const symbol_exprt &dfcc_param ,
391
+ const symbol_exprt &write_set ,
391
392
goto_programt::targett &target,
392
393
goto_programt &goto_program,
393
394
cfg_infot &cfg_info)
@@ -414,8 +415,9 @@ void dfcc_instrumentt::instrument_assign(
414
415
goto_programt payload;
415
416
416
417
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
417
- utils.make_null_check_expr (dfcc_param )));
418
+ utils.make_null_check_expr (write_set )));
418
419
420
+ // TODO use dfcc_utilst class
419
421
auto &check_sym = get_fresh_aux_symbol (
420
422
bool_typet (),
421
423
id2string (function_id),
@@ -431,7 +433,7 @@ void dfcc_instrumentt::instrument_assign(
431
433
payload.add (goto_programt::make_function_call (code_function_callt{
432
434
check_var,
433
435
library.dfcc_fun_symbol [dfcc_funt::SET_CHECK_ASSIGNMENT].symbol_expr (),
434
- {dfcc_param , lhs, utils.make_sizeof_expr (lhs)}}));
436
+ {write_set , lhs, utils.make_sizeof_expr (lhs)}}));
435
437
436
438
// TODO add property class on assertion source_location
437
439
payload.add (goto_programt::make_assertion (check_var));
@@ -460,11 +462,11 @@ void dfcc_instrumentt::instrument_assign(
460
462
goto_programt payload;
461
463
462
464
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
463
- utils.make_null_check_expr (dfcc_param )));
465
+ utils.make_null_check_expr (write_set )));
464
466
465
467
payload.add (goto_programt::make_function_call (code_function_callt{
466
468
library.dfcc_fun_symbol [dfcc_funt::SET_ADD_ALLOCATED].symbol_expr (),
467
- {dfcc_param , lhs}}));
469
+ {write_set , lhs}}));
468
470
469
471
auto label_instruction = payload.add (goto_programt::make_skip ());
470
472
goto_instruction->complete_goto (label_instruction);
@@ -478,7 +480,7 @@ void dfcc_instrumentt::instrument_assign(
478
480
479
481
void dfcc_instrumentt::instrument_function_call (
480
482
const irep_idt &function_id,
481
- const symbol_exprt &dfcc_param ,
483
+ const symbol_exprt &write_set ,
482
484
goto_programt::targett &target,
483
485
goto_programt &goto_program,
484
486
cfg_infot &cfg_info)
@@ -521,7 +523,7 @@ void dfcc_instrumentt::instrument_function_call(
521
523
goto_programt payload;
522
524
523
525
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
524
- utils.make_null_check_expr (dfcc_param )));
526
+ utils.make_null_check_expr (write_set )));
525
527
526
528
auto &check_sym = get_fresh_aux_symbol (
527
529
bool_typet (),
@@ -540,7 +542,7 @@ void dfcc_instrumentt::instrument_function_call(
540
542
payload.add (goto_programt::make_function_call (code_function_callt{
541
543
check_var,
542
544
library.dfcc_fun_symbol [dfcc_funt::SET_CHECK_DEALLOCATE].symbol_expr (),
543
- {dfcc_param , ptr}}));
545
+ {write_set , ptr}}));
544
546
545
547
// TODO add property class on assertion source_location
546
548
payload.add (goto_programt::make_assertion (check_var));
@@ -549,7 +551,7 @@ void dfcc_instrumentt::instrument_function_call(
549
551
payload.add (goto_programt::make_function_call (code_function_callt{
550
552
library.dfcc_fun_symbol [dfcc_funt::SET_REMOVE_DEALLOCATED]
551
553
.symbol_expr (),
552
- {dfcc_param , ptr}}));
554
+ {write_set , ptr}}));
553
555
554
556
auto label_instruction = payload.add (goto_programt::make_skip ());
555
557
goto_instruction->complete_goto (label_instruction);
@@ -570,13 +572,13 @@ void dfcc_instrumentt::instrument_function_call(
570
572
goto_programt payload;
571
573
572
574
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
573
- utils.make_null_check_expr (dfcc_param )));
575
+ utils.make_null_check_expr (write_set )));
574
576
575
577
const auto &lhs = target->call_lhs ();
576
578
target++;
577
579
payload.add (goto_programt::make_function_call (code_function_callt{
578
580
library.dfcc_fun_symbol [dfcc_funt::SET_ADD_ALLOCATED].symbol_expr (),
579
- {dfcc_param , lhs}}));
581
+ {write_set , lhs}}));
580
582
581
583
auto label_instruction = payload.add (goto_programt::make_skip ());
582
584
goto_instruction->complete_goto (label_instruction);
@@ -595,21 +597,21 @@ void dfcc_instrumentt::instrument_function_call(
595
597
// a user defined or library function symbol
596
598
// propagate dfcc parameters
597
599
auto &arguments = target->call_arguments ();
598
- arguments.emplace_back (dfcc_param );
600
+ arguments.emplace_back (write_set );
599
601
}
600
602
}
601
603
else
602
604
{
603
605
// a function pointer expression
604
606
// propagate dfcc parameters
605
607
auto &arguments = target->call_arguments ();
606
- arguments.emplace_back (dfcc_param );
608
+ arguments.emplace_back (write_set );
607
609
}
608
610
}
609
611
610
612
void dfcc_instrumentt::instrument_other (
611
613
const irep_idt &function_id,
612
- const symbol_exprt &dfcc_param ,
614
+ const symbol_exprt &write_set ,
613
615
goto_programt::targett &target,
614
616
goto_programt &goto_program,
615
617
cfg_infot &cfg_info)
@@ -631,7 +633,7 @@ void dfcc_instrumentt::instrument_other(
631
633
goto_programt payload;
632
634
633
635
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
634
- utils.make_null_check_expr (dfcc_param )));
636
+ utils.make_null_check_expr (write_set )));
635
637
636
638
auto &check_sym = get_fresh_aux_symbol (
637
639
bool_typet (),
@@ -650,7 +652,7 @@ void dfcc_instrumentt::instrument_other(
650
652
payload.add (goto_programt::make_function_call (code_function_callt{
651
653
check_var,
652
654
library.dfcc_fun_symbol [dfcc_funt::SET_CHECK_ARRAY_SET].symbol_expr (),
653
- {dfcc_param , dest}}));
655
+ {write_set , dest}}));
654
656
655
657
// TODO add property class on assertion source_location
656
658
payload.add (goto_programt::make_assertion (check_var));
@@ -677,7 +679,7 @@ void dfcc_instrumentt::instrument_other(
677
679
goto_programt payload;
678
680
679
681
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
680
- utils.make_null_check_expr (dfcc_param )));
682
+ utils.make_null_check_expr (write_set )));
681
683
682
684
auto &check_sym = get_fresh_aux_symbol (
683
685
bool_typet (),
@@ -696,7 +698,7 @@ void dfcc_instrumentt::instrument_other(
696
698
payload.add (goto_programt::make_function_call (code_function_callt{
697
699
check_var,
698
700
library.dfcc_fun_symbol [dfcc_funt::SET_CHECK_ARRAY_COPY].symbol_expr (),
699
- {dfcc_param , dest}}));
701
+ {write_set , dest}}));
700
702
701
703
// TODO add property class on assertion source_location
702
704
payload.add (goto_programt::make_assertion (check_var));
@@ -723,7 +725,7 @@ void dfcc_instrumentt::instrument_other(
723
725
goto_programt payload;
724
726
725
727
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
726
- utils.make_null_check_expr (dfcc_param )));
728
+ utils.make_null_check_expr (write_set )));
727
729
728
730
auto &check_sym = get_fresh_aux_symbol (
729
731
bool_typet (),
@@ -743,7 +745,7 @@ void dfcc_instrumentt::instrument_other(
743
745
payload.add (goto_programt::make_function_call (code_function_callt{
744
746
check_var,
745
747
library.dfcc_fun_symbol [dfcc_funt::SET_CHECK_ARRAY_REPLACE].symbol_expr (),
746
- {dfcc_param , dest, src}}));
748
+ {write_set , dest, src}}));
747
749
748
750
// TODO add property class on assertion source_location
749
751
payload.add (goto_programt::make_assertion (check_var));
@@ -769,7 +771,7 @@ void dfcc_instrumentt::instrument_other(
769
771
goto_programt payload;
770
772
771
773
auto goto_instruction = payload.add (goto_programt::make_incomplete_goto (
772
- utils.make_null_check_expr (dfcc_param )));
774
+ utils.make_null_check_expr (write_set )));
773
775
774
776
auto &check_sym = get_fresh_aux_symbol (
775
777
bool_typet (),
@@ -788,7 +790,7 @@ void dfcc_instrumentt::instrument_other(
788
790
payload.add (goto_programt::make_function_call (code_function_callt{
789
791
check_var,
790
792
library.dfcc_fun_symbol [dfcc_funt::SET_CHECK_HAVOC_OBJECT].symbol_expr (),
791
- {dfcc_param , ptr}}));
793
+ {write_set , ptr}}));
792
794
793
795
// TODO add property class on assertion source_location
794
796
payload.add (goto_programt::make_assertion (check_var));
0 commit comments