|
6 | 6 | #include <util/config.h> |
7 | 7 | #include <util/message.h> |
8 | 8 | #include <util/options.h> |
| 9 | +#include <util/ui_message.h> |
9 | 10 |
|
10 | 11 | #include <goto-programs/goto_model.h> |
11 | 12 | #include <goto-programs/initialize_goto_model.h> |
| 13 | +#include <goto-programs/link_to_library.h> |
| 14 | +#include <goto-programs/process_goto_program.h> |
| 15 | +#include <goto-programs/remove_skip.h> |
| 16 | +#include <goto-programs/set_properties.h> |
12 | 17 |
|
13 | 18 | #include <ansi-c/ansi_c_language.h> |
| 19 | +#include <ansi-c/cprover_library.h> |
| 20 | +#include <assembler/remove_asm.h> |
| 21 | +#include <goto-checker/all_properties_verifier_with_trace_storage.h> |
| 22 | +#include <goto-checker/multi_path_symex_checker.h> |
14 | 23 | #include <langapi/mode.h> |
| 24 | +#include <pointer-analysis/add_failed_symbols.h> |
15 | 25 |
|
16 | 26 | #include <memory> |
17 | 27 | #include <string> |
@@ -105,3 +115,47 @@ void api_sessiont::load_model_from_files(const std::vector<std::string> &files) |
105 | 115 | implementation->model = util_make_unique<goto_modelt>(initialize_goto_model( |
106 | 116 | files, *implementation->message_handler, *implementation->options)); |
107 | 117 | } |
| 118 | + |
| 119 | +void api_sessiont::verify_model() |
| 120 | +{ |
| 121 | + PRECONDITION(implementation->model); |
| 122 | + |
| 123 | + // Remove inline assembler; this needs to happen before adding the library. |
| 124 | + remove_asm(*implementation->model); |
| 125 | + |
| 126 | + // add the library |
| 127 | + messaget log{*implementation->message_handler}; |
| 128 | + log.status() << "Adding CPROVER library (" << config.ansi_c.arch << ")" |
| 129 | + << messaget::eom; |
| 130 | + link_to_library( |
| 131 | + *implementation->model, |
| 132 | + *implementation->message_handler, |
| 133 | + cprover_c_library_factory); |
| 134 | + |
| 135 | + // Common removal of types and complex constructs |
| 136 | + if(::process_goto_program( |
| 137 | + *implementation->model, *implementation->options, log)) |
| 138 | + { |
| 139 | + return; |
| 140 | + } |
| 141 | + |
| 142 | + // add failed symbols |
| 143 | + // needs to be done before pointer analysis |
| 144 | + add_failed_symbols(implementation->model->symbol_table); |
| 145 | + |
| 146 | + // label the assertions |
| 147 | + // This must be done after adding assertions and |
| 148 | + // before using the argument of the "property" option. |
| 149 | + // Do not re-label after using the property slicer because |
| 150 | + // this would cause the property identifiers to change. |
| 151 | + label_properties(*implementation->model); |
| 152 | + |
| 153 | + remove_skip(*implementation->model); |
| 154 | + |
| 155 | + ui_message_handlert ui_message_handler(*implementation->message_handler); |
| 156 | + all_properties_verifier_with_trace_storaget<multi_path_symex_checkert> |
| 157 | + verifier( |
| 158 | + *implementation->options, ui_message_handler, *implementation->model); |
| 159 | + (void)verifier(); |
| 160 | + verifier.report(); |
| 161 | +} |
0 commit comments