Skip to content

Commit 0af4e71

Browse files
committed
Merge remote-tracking branch 'origin/test_gen' into test_gen_mocks
2 parents e6e3bff + 9ebc7d3 commit 0af4e71

File tree

2 files changed

+20
-1
lines changed

2 files changed

+20
-1
lines changed

src/cbmc/cbmc_parse_options.cpp

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,6 +465,9 @@ void cbmc_parse_optionst::get_command_line_options(optionst &options)
465465
if(cmdline.isset("cover-function-only"))
466466
options.set_option("cover-function-only", true);
467467

468+
if(cmdline.isset("assertions-as-assumptions"))
469+
options.set_option("assertions-as-assumptions", true);
470+
468471
if(cmdline.isset("java-disable-mocks"))
469472
options.set_option("java-disable-mocks", true);
470473
}
@@ -952,6 +955,20 @@ bool cbmc_parse_optionst::process_goto_program(
952955
get_message_handler(), goto_functions);
953956
}
954957

958+
if(cmdline.isset("assertions-as-assumptions"))
959+
{
960+
// turn assertions (from generic checks) into assumptions
961+
Forall_goto_functions(f_it, goto_functions)
962+
{
963+
goto_programt &body=f_it->second.body;
964+
Forall_goto_program_instructions(i_it, body)
965+
{
966+
if(i_it->is_assert())
967+
i_it->type= goto_program_instruction_typet::ASSUME;
968+
}
969+
}
970+
}
971+
955972
// add failed symbols
956973
// needs to be done before pointer analysis
957974
add_failed_symbols(symbol_table);
@@ -1166,7 +1183,8 @@ void cbmc_parse_optionst::help()
11661183
" --classpath dir/jar set the classpath\n"
11671184
" --main-class class-name set the name of the main class\n"
11681185
" --gen-java-test-case generate test case\n"
1169-
" --cover-function-only add coverage instrumentation only to the entry function"
1186+
" --cover-function-only add coverage instrumentation only to the entry function"
1187+
" --assertions-as-assumptions convert assertions from generic checks into assumptions"
11701188
"\n"
11711189
"Semantic transformations:\n"
11721190
" --nondet-static add nondeterministic initialization of variables with static lifetime\n"

src/cbmc/cbmc_parse_options.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ class optionst;
4545
"(stop-on-fail)(trace)" \
4646
"(error-label):(verbosity):(no-library)" \
4747
"(version)" \
48+
"(assertions-as-assumptions)" \
4849
"(cover):(cover-function-only)" \
4950
"(mm):" \
5051
"(i386-linux)(i386-macos)(i386-win32)(win32)(winx64)(gcc)" \

0 commit comments

Comments
 (0)