|
15 | 15 |
|
16 | 16 | #include <json/json_parser.h>
|
17 | 17 |
|
| 18 | +#include <goto-programs/lazy_goto_model.h> |
18 | 19 | #include <goto-programs/set_properties.h>
|
19 | 20 | #include <goto-programs/remove_function_pointers.h>
|
20 | 21 | #include <goto-programs/remove_virtual_functions.h>
|
@@ -140,10 +141,19 @@ int sec_driver_parse_optionst::doit()
|
140 | 141 | register_languages();
|
141 | 142 | register_evs_pretty_printer();
|
142 | 143 |
|
143 |
| - goto_model=initialize_goto_model(cmdline, get_message_handler()); |
| 144 | + lazy_goto_modelt lazy_goto_model = lazy_goto_modelt::from_handler_object( |
| 145 | + *this, options, get_message_handler()); |
| 146 | + lazy_goto_model.initialize(cmdline); |
144 | 147 |
|
145 |
| - if(process_goto_program(options)) |
| 148 | + status() << "Generating GOTO Program" << messaget::eom; |
| 149 | + lazy_goto_model.load_all_functions(); |
| 150 | + |
| 151 | + std::unique_ptr<goto_modelt> maybe_goto_model = |
| 152 | + lazy_goto_modelt::process_whole_model_and_freeze( |
| 153 | + std::move(lazy_goto_model)); |
| 154 | + if(maybe_goto_model == nullptr) |
146 | 155 | return 6;
|
| 156 | + goto_modelt &goto_model = *maybe_goto_model; |
147 | 157 |
|
148 | 158 | if (cmdline.isset("security-scanner"))
|
149 | 159 | {
|
@@ -292,16 +302,45 @@ int sec_driver_parse_optionst::doit()
|
292 | 302 | return 6;
|
293 | 303 | }
|
294 | 304 |
|
295 |
| -bool sec_driver_parse_optionst::process_goto_program( |
296 |
| - const optionst &options) |
| 305 | +void sec_driver_parse_optionst::process_goto_function( |
| 306 | + goto_functionst::goto_functiont &function, |
| 307 | + symbol_tablet &symbol_table) |
297 | 308 | {
|
298 | 309 | try
|
299 | 310 | {
|
300 | 311 | #if 0
|
301 | 312 | // Remove inline assembler; this needs to happen before
|
302 | 313 | // adding the library.
|
303 |
| - remove_asm(goto_model); |
| 314 | + remove_asm(function.body, symbol_table); |
| 315 | +#endif |
| 316 | + } |
| 317 | + |
| 318 | + catch(const char *e) |
| 319 | + { |
| 320 | + error() << e << eom; |
| 321 | + throw; |
| 322 | + } |
| 323 | + |
| 324 | + catch(const std::string &e) |
| 325 | + { |
| 326 | + error() << e << eom; |
| 327 | + throw; |
| 328 | + } |
| 329 | + |
| 330 | + catch(const std::bad_alloc &) |
| 331 | + { |
| 332 | + error() << "Out of memory" << eom; |
| 333 | + throw; |
| 334 | + } |
| 335 | +} |
304 | 336 |
|
| 337 | +bool sec_driver_parse_optionst::process_goto_functions( |
| 338 | + goto_modelt &goto_model, |
| 339 | + const optionst &options) |
| 340 | +{ |
| 341 | + try |
| 342 | + { |
| 343 | +#if 0 |
305 | 344 | // add the library
|
306 | 345 | status() << "Adding CPROVER library ("
|
307 | 346 | << config.ansi_c.arch << ")" << eom;
|
@@ -340,9 +379,6 @@ bool sec_driver_parse_optionst::process_goto_program(
|
340 | 379 | // recalculate numbers, etc.
|
341 | 380 | goto_model.goto_functions.update();
|
342 | 381 |
|
343 |
| - // add loop ids |
344 |
| - goto_model.goto_functions.compute_loop_numbers(); |
345 |
| - |
346 | 382 | // show it?
|
347 | 383 | if(cmdline.isset("show-goto-functions"))
|
348 | 384 | {
|
|
0 commit comments