@@ -27,6 +27,7 @@ Author: Peter Schrammel
27
27
#include < goto-programs/adjust_float_expressions.h>
28
28
#include < goto-programs/goto_convert_functions.h>
29
29
#include < goto-programs/goto_inline.h>
30
+ #include < goto-programs/initialize_goto_model.h>
30
31
#include < goto-programs/instrument_preconditions.h>
31
32
#include < goto-programs/link_to_library.h>
32
33
#include < goto-programs/loop_ids.h>
@@ -62,20 +63,8 @@ Author: Peter Schrammel
62
63
63
64
goto_diff_parse_optionst::goto_diff_parse_optionst (int argc, const char **argv)
64
65
: parse_options_baset(GOTO_DIFF_OPTIONS, argc, argv),
65
- goto_diff_languagest(cmdline, ui_message_handler),
66
- ui_message_handler(cmdline, std::string(" GOTO-DIFF " ) + CBMC_VERSION),
67
- languages2(cmdline, ui_message_handler)
68
- {
69
- }
70
-
71
- ::goto_diff_parse_optionst::goto_diff_parse_optionst (
72
- int argc,
73
- const char **argv,
74
- const std::string &extra_options)
75
- : parse_options_baset(GOTO_DIFF_OPTIONS + extra_options, argc, argv),
76
- goto_diff_languagest(cmdline, ui_message_handler),
77
- ui_message_handler(cmdline, std::string(" GOTO-DIFF " ) + CBMC_VERSION),
78
- languages2(cmdline, ui_message_handler)
66
+ messaget(ui_message_handler),
67
+ ui_message_handler(cmdline, std::string(" GOTO-DIFF " ) + CBMC_VERSION)
79
68
{
80
69
}
81
70
@@ -252,21 +241,21 @@ int goto_diff_parse_optionst::doit()
252
241
return CPROVER_EXIT_INCORRECT_TASK;
253
242
}
254
243
255
- goto_modelt goto_model1, goto_model2 ;
244
+ register_languages () ;
256
245
257
- int get_goto_program_ret =
258
- get_goto_program (options, * this , goto_model1 );
259
- if (get_goto_program_ret!=- 1 )
260
- return get_goto_program_ret ;
261
- get_goto_program_ret =
262
- get_goto_program (options, languages2, goto_model2 );
263
- if (get_goto_program_ret!=- 1 )
264
- return get_goto_program_ret ;
246
+ goto_modelt goto_model1 =
247
+ initialize_goto_model ({cmdline. args [ 0 ]}, ui_message_handler, options );
248
+ if (process_goto_program (options, goto_model1) )
249
+ return CPROVER_EXIT_INTERNAL_ERROR ;
250
+ goto_modelt goto_model2 =
251
+ initialize_goto_model ({cmdline. args [ 1 ]}, ui_message_handler, options );
252
+ if (process_goto_program (options, goto_model2) )
253
+ return CPROVER_EXIT_INTERNAL_ERROR ;
265
254
266
255
if (cmdline.isset (" show-loops" ))
267
256
{
268
- show_loop_ids (get_ui (), goto_model1);
269
- show_loop_ids (get_ui (), goto_model2);
257
+ show_loop_ids (ui_message_handler. get_ui (), goto_model1);
258
+ show_loop_ids (ui_message_handler. get_ui (), goto_model2);
270
259
return CPROVER_EXIT_SUCCESS;
271
260
}
272
261
@@ -323,65 +312,6 @@ int goto_diff_parse_optionst::doit()
323
312
return CPROVER_EXIT_SUCCESS;
324
313
}
325
314
326
- int goto_diff_parse_optionst::get_goto_program (
327
- const optionst &options,
328
- goto_diff_languagest &languages,
329
- goto_modelt &goto_model)
330
- {
331
- status () << " Reading program from `" << cmdline.args [0 ] << " '" << eom;
332
-
333
- if (is_goto_binary (cmdline.args [0 ]))
334
- {
335
- if (read_goto_binary (
336
- cmdline.args [0 ],
337
- goto_model.symbol_table ,
338
- goto_model.goto_functions ,
339
- languages.get_message_handler ()))
340
- return CPROVER_EXIT_INCORRECT_TASK;
341
-
342
- config.set (cmdline);
343
-
344
- // This one is done.
345
- cmdline.args .erase (cmdline.args .begin ());
346
- }
347
- else
348
- {
349
- // This is a a workaround to make parse() think that there is only
350
- // one source file.
351
- std::string arg2 (" " );
352
- if (cmdline.args .size ()==2 )
353
- {
354
- arg2 = cmdline.args [1 ];
355
- cmdline.args .erase (--cmdline.args .end ());
356
- }
357
-
358
- if (languages.parse () ||
359
- languages.typecheck () ||
360
- languages.final ())
361
- return CPROVER_EXIT_INCORRECT_TASK;
362
-
363
- // we no longer need any parse trees or language files
364
- languages.clear_parse ();
365
-
366
- status () << " Generating GOTO Program" << eom;
367
-
368
- goto_model.symbol_table =languages.symbol_table ;
369
- goto_convert (
370
- goto_model.symbol_table ,
371
- goto_model.goto_functions ,
372
- ui_message_handler);
373
-
374
- if (process_goto_program (options, goto_model))
375
- return CPROVER_EXIT_INTERNAL_ERROR;
376
-
377
- // if we had a second argument then we will handle it next
378
- if (arg2!=" " )
379
- cmdline.args [0 ]=arg2;
380
- }
381
-
382
- return -1 ; // no error, continue
383
- }
384
-
385
315
bool goto_diff_parse_optionst::process_goto_program (
386
316
const optionst &options,
387
317
goto_modelt &goto_model)
0 commit comments