Skip to content

Commit eed983a

Browse files
committed
JBMC: add property checks on a per-function basis
1 parent db3bc99 commit eed983a

File tree

5 files changed

+14
-9
lines changed

5 files changed

+14
-9
lines changed

src/analyses/goto_check.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1753,10 +1753,11 @@ void goto_checkt::goto_check(
17531753
void goto_check(
17541754
const namespacet &ns,
17551755
const optionst &options,
1756+
const irep_idt &mode,
17561757
goto_functionst::goto_functiont &goto_function)
17571758
{
17581759
goto_checkt goto_check(ns, options);
1759-
goto_check.goto_check(goto_function, irep_idt());
1760+
goto_check.goto_check(goto_function, mode);
17601761
}
17611762

17621763
void goto_check(

src/analyses/goto_check.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ void goto_check(
2626
void goto_check(
2727
const namespacet &ns,
2828
const optionst &options,
29+
const irep_idt &mode,
2930
goto_functionst::goto_functiont &goto_function);
3031

3132
void goto_check(

src/goto-programs/lazy_goto_model.h

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,8 +64,9 @@ class lazy_goto_modelt : public can_produce_functiont
6464
message_handlert &message_handler)
6565
{
6666
return lazy_goto_modelt(
67-
[&handler] (goto_model_functiont &fun, const can_produce_functiont &cpf) { // NOLINT(*)
68-
handler.process_goto_function(fun, cpf);
67+
[&handler, &options]
68+
(goto_model_functiont &fun, const can_produce_functiont &cpf) { // NOLINT(*)
69+
handler.process_goto_function(fun, cpf, options);
6970
},
7071
[&handler, &options] (goto_modelt &goto_model) -> bool { // NOLINT(*)
7172
return handler.process_goto_functions(goto_model, options);

src/jbmc/jbmc_parse_options.cpp

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -643,9 +643,11 @@ int jbmc_parse_optionst::get_goto_program(
643643

644644
void jbmc_parse_optionst::process_goto_function(
645645
goto_model_functiont &function,
646-
const can_produce_functiont &available_functions)
646+
const can_produce_functiont &available_functions,
647+
const optionst &options)
647648
{
648649
symbol_tablet &symbol_table = function.get_symbol_table();
650+
namespacet ns(symbol_table);
649651
goto_functionst::goto_functiont &goto_function = function.get_goto_function();
650652
try
651653
{
@@ -688,6 +690,9 @@ void jbmc_parse_optionst::process_goto_function(
688690
function,
689691
get_message_handler(),
690692
factory_params);
693+
694+
// add generic checks
695+
goto_check(ns, options, ID_java, function.get_goto_function());
691696
}
692697

693698
catch(const char *e)
@@ -725,10 +730,6 @@ bool jbmc_parse_optionst::process_goto_functions(
725730
// instrument library preconditions
726731
instrument_preconditions(goto_model);
727732

728-
// add generic checks
729-
status() << "Generic Property Instrumentation" << eom;
730-
goto_check(options, goto_model);
731-
732733
// checks don't know about adjusted float expressions
733734
adjust_float_expressions(goto_model);
734735

src/jbmc/jbmc_parse_options.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,8 @@ class jbmc_parse_optionst:
8686

8787
void process_goto_function(
8888
goto_model_functiont &function,
89-
const can_produce_functiont &);
89+
const can_produce_functiont &,
90+
const optionst &);
9091
bool process_goto_functions(goto_modelt &goto_model, const optionst &options);
9192

9293
protected:

0 commit comments

Comments
 (0)