11
11
12
12
#include " cbmc_parse_options.h"
13
13
14
- #include < fstream>
15
14
#include < cstdlib> // exit()
15
+ #include < fstream>
16
16
#include < iostream>
17
17
#include < memory>
18
18
@@ -178,8 +178,9 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
178
178
exit (CPROVER_EXIT_USAGE_ERROR);
179
179
}
180
180
181
- if (cmdline.isset (" reachability-slice" ) &&
182
- cmdline.isset (" reachability-slice-fb" ))
181
+ if (
182
+ cmdline.isset (" reachability-slice" ) &&
183
+ cmdline.isset (" reachability-slice-fb" ))
183
184
{
184
185
log.error ()
185
186
<< " --reachability-slice and --reachability-slice-fb must not be "
@@ -258,9 +259,9 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
258
259
if (cmdline.isset (" no-simplify" ))
259
260
options.set_option (" simplify" , false );
260
261
261
- if (cmdline. isset ( " stop-on-fail " ) ||
262
- cmdline.isset (" dimacs" ) ||
263
- cmdline.isset (" outfile" ))
262
+ if (
263
+ cmdline. isset ( " stop-on-fail " ) || cmdline.isset (" dimacs" ) ||
264
+ cmdline.isset (" outfile" ))
264
265
options.set_option (" stop-on-fail" , true );
265
266
266
267
if (
@@ -370,8 +371,7 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
370
371
371
372
if (cmdline.isset (" max-node-refinement" ))
372
373
options.set_option (
373
- " max-node-refinement" ,
374
- cmdline.get_value (" max-node-refinement" ));
374
+ " max-node-refinement" , cmdline.get_value (" max-node-refinement" ));
375
375
376
376
// SMT Options
377
377
@@ -387,11 +387,11 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
387
387
if (cmdline.isset (" fpa" ))
388
388
options.set_option (" fpa" , true );
389
389
390
- bool solver_set= false ;
390
+ bool solver_set = false ;
391
391
392
392
if (cmdline.isset (" boolector" ))
393
393
{
394
- options.set_option (" boolector" , true ), solver_set= true ;
394
+ options.set_option (" boolector" , true ), solver_set = true ;
395
395
options.set_option (" smt2" , true );
396
396
}
397
397
@@ -403,25 +403,25 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
403
403
404
404
if (cmdline.isset (" mathsat" ))
405
405
{
406
- options.set_option (" mathsat" , true ), solver_set= true ;
406
+ options.set_option (" mathsat" , true ), solver_set = true ;
407
407
options.set_option (" smt2" , true );
408
408
}
409
409
410
410
if (cmdline.isset (" cvc4" ))
411
411
{
412
- options.set_option (" cvc4" , true ), solver_set= true ;
412
+ options.set_option (" cvc4" , true ), solver_set = true ;
413
413
options.set_option (" smt2" , true );
414
414
}
415
415
416
416
if (cmdline.isset (" yices" ))
417
417
{
418
- options.set_option (" yices" , true ), solver_set= true ;
418
+ options.set_option (" yices" , true ), solver_set = true ;
419
419
options.set_option (" smt2" , true );
420
420
}
421
421
422
422
if (cmdline.isset (" z3" ))
423
423
{
424
- options.set_option (" z3" , true ), solver_set= true ;
424
+ options.set_option (" z3" , true ), solver_set = true ;
425
425
options.set_option (" smt2" , true );
426
426
}
427
427
@@ -461,8 +461,7 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
461
461
if (cmdline.isset (" symex-coverage-report" ))
462
462
{
463
463
options.set_option (
464
- " symex-coverage-report" ,
465
- cmdline.get_value (" symex-coverage-report" ));
464
+ " symex-coverage-report" , cmdline.get_value (" symex-coverage-report" ));
466
465
options.set_option (" paths-symex-explore-all" , true );
467
466
}
468
467
@@ -512,8 +511,7 @@ int cbmc_parse_optionst::doit()
512
511
// Unwinding of transition systems is done by hw-cbmc.
513
512
//
514
513
515
- if (cmdline.isset (" module" ) ||
516
- cmdline.isset (" gen-interface" ))
514
+ if (cmdline.isset (" module" ) || cmdline.isset (" gen-interface" ))
517
515
{
518
516
log.error () << " This version of CBMC has no support for "
519
517
" hardware modules. Please use hw-cbmc."
@@ -552,13 +550,13 @@ int cbmc_parse_optionst::doit()
552
550
return CPROVER_EXIT_INCORRECT_TASK;
553
551
}
554
552
555
- std::string filename= cmdline.args [0 ];
553
+ std::string filename = cmdline.args [0 ];
556
554
557
- #ifdef _MSC_VER
555
+ #ifdef _MSC_VER
558
556
std::ifstream infile (widen (filename));
559
- #else
557
+ #else
560
558
std::ifstream infile (filename);
561
- #endif
559
+ #endif
562
560
563
561
if (!infile)
564
562
{
@@ -567,10 +565,9 @@ int cbmc_parse_optionst::doit()
567
565
return CPROVER_EXIT_INCORRECT_TASK;
568
566
}
569
567
570
- std::unique_ptr<languaget> language=
571
- get_language_from_filename (filename);
568
+ std::unique_ptr<languaget> language = get_language_from_filename (filename);
572
569
573
- if (language== nullptr )
570
+ if (language == nullptr )
574
571
{
575
572
log.error () << " failed to figure out type of file '" << filename << " '"
576
573
<< messaget::eom;
@@ -595,11 +592,12 @@ int cbmc_parse_optionst::doit()
595
592
int get_goto_program_ret =
596
593
get_goto_program (goto_model, options, cmdline, ui_message_handler);
597
594
598
- if (get_goto_program_ret!= -1 )
595
+ if (get_goto_program_ret != -1 )
599
596
return get_goto_program_ret;
600
597
601
- if (cmdline.isset (" show-claims" ) || // will go away
602
- cmdline.isset (" show-properties" )) // use this one
598
+ if (
599
+ cmdline.isset (" show-claims" ) || // will go away
600
+ cmdline.isset (" show-properties" )) // use this one
603
601
{
604
602
show_properties (goto_model, ui_message_handler);
605
603
return CPROVER_EXIT_SUCCESS;
@@ -840,14 +838,20 @@ bool cbmc_parse_optionst::process_goto_program(
840
838
log.status () << " Removal of function pointers and virtual functions"
841
839
<< messaget::eom;
842
840
843
- const auto function_pointer_restrictions =
844
- function_pointer_restrictionst::from_options (
845
- options, log. get_message_handler ());
846
- if (!function_pointer_restrictions. restrictions . empty ( ))
841
+ if (
842
+ options. is_set (RESTRICT_FUNCTION_POINTER_OPT) ||
843
+ options. is_set (RESTRICT_FUNCTION_POINTER_BY_NAME_OPT) ||
844
+ options. is_set (RESTRICT_FUNCTION_POINTER_FROM_FILE_OPT ))
847
845
{
848
846
label_function_pointer_call_sites (goto_model);
847
+ auto const by_name_restrictions =
848
+ get_function_pointer_by_name_restrictions (goto_model, options);
849
+ const auto function_pointer_restrictions =
850
+ by_name_restrictions.merge (function_pointer_restrictionst::from_options (
851
+ options, log.get_message_handler ()));
849
852
restrict_function_pointers (goto_model, function_pointer_restrictions);
850
853
}
854
+
851
855
remove_function_pointers (
852
856
log.get_message_handler (),
853
857
goto_model,
0 commit comments