@@ -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>
@@ -60,24 +61,10 @@ Author: Peter Schrammel
60
61
#include < goto-diff/goto_diff.h>
61
62
#include < goto-diff/unified_diff.h>
62
63
63
- // TODO: do not use language_uit for this; requires a refactoring of
64
- // initialize_goto_model to support parsing specific command line files
65
64
jdiff_parse_optionst::jdiff_parse_optionst (int argc, const char **argv)
66
65
: parse_options_baset(JDIFF_OPTIONS, argc, argv),
67
- jdiff_languagest(cmdline, ui_message_handler, &options),
68
- ui_message_handler(cmdline, std::string(" JDIFF " ) + CBMC_VERSION),
69
- languages2(cmdline, ui_message_handler, &options)
70
- {
71
- }
72
-
73
- ::jdiff_parse_optionst::jdiff_parse_optionst (
74
- int argc,
75
- const char **argv,
76
- const std::string &extra_options)
77
- : parse_options_baset(JDIFF_OPTIONS + extra_options, argc, argv),
78
- jdiff_languagest(cmdline, ui_message_handler, &options),
79
- ui_message_handler(cmdline, std::string(" JDIFF " ) + CBMC_VERSION),
80
- languages2(cmdline, ui_message_handler, &options)
66
+ messaget(ui_message_handler),
67
+ ui_message_handler(cmdline, std::string(" JDIFF " ) + CBMC_VERSION)
81
68
{
82
69
}
83
70
@@ -218,19 +205,21 @@ int jdiff_parse_optionst::doit()
218
205
return CPROVER_EXIT_INCORRECT_TASK;
219
206
}
220
207
221
- goto_modelt goto_model1, goto_model2 ;
208
+ register_languages () ;
222
209
223
- int get_goto_program_ret = get_goto_program (options, *this , goto_model1);
224
- if (get_goto_program_ret != -1 )
225
- return get_goto_program_ret;
226
- get_goto_program_ret = get_goto_program (options, languages2, goto_model2);
227
- if (get_goto_program_ret != -1 )
228
- return get_goto_program_ret;
210
+ goto_modelt goto_model1 =
211
+ initialize_goto_model ({cmdline.args [0 ]}, ui_message_handler, options);
212
+ if (process_goto_program (options, goto_model1))
213
+ return CPROVER_EXIT_INTERNAL_ERROR;
214
+ goto_modelt goto_model2 =
215
+ initialize_goto_model ({cmdline.args [1 ]}, ui_message_handler, options);
216
+ if (process_goto_program (options, goto_model2))
217
+ return CPROVER_EXIT_INTERNAL_ERROR;
229
218
230
219
if (cmdline.isset (" show-loops" ))
231
220
{
232
- show_loop_ids (get_ui (), goto_model1);
233
- show_loop_ids (get_ui (), goto_model2);
221
+ show_loop_ids (ui_message_handler. get_ui (), goto_model1);
222
+ show_loop_ids (ui_message_handler. get_ui (), goto_model2);
234
223
return CPROVER_EXIT_SUCCESS;
235
224
}
236
225
@@ -283,61 +272,6 @@ int jdiff_parse_optionst::doit()
283
272
return CPROVER_EXIT_SUCCESS;
284
273
}
285
274
286
- int jdiff_parse_optionst::get_goto_program (
287
- const optionst &options,
288
- jdiff_languagest &languages,
289
- goto_modelt &goto_model)
290
- {
291
- status () << " Reading program from `" << cmdline.args [0 ] << " '" << eom;
292
-
293
- if (is_goto_binary (cmdline.args [0 ]))
294
- {
295
- if (read_goto_binary (
296
- cmdline.args [0 ],
297
- goto_model.symbol_table ,
298
- goto_model.goto_functions ,
299
- languages.get_message_handler ()))
300
- return CPROVER_EXIT_INCORRECT_TASK;
301
-
302
- config.set (cmdline);
303
-
304
- // This one is done.
305
- cmdline.args .erase (cmdline.args .begin ());
306
- }
307
- else
308
- {
309
- // This is a a workaround to make parse() think that there is only
310
- // one source file.
311
- std::string arg2 (" " );
312
- if (cmdline.args .size () == 2 )
313
- {
314
- arg2 = cmdline.args [1 ];
315
- cmdline.args .erase (--cmdline.args .end ());
316
- }
317
-
318
- if (languages.parse () || languages.typecheck () || languages.final ())
319
- return CPROVER_EXIT_INCORRECT_TASK;
320
-
321
- // we no longer need any parse trees or language files
322
- languages.clear_parse ();
323
-
324
- status () << " Generating GOTO Program" << eom;
325
-
326
- goto_model.symbol_table = languages.symbol_table ;
327
- goto_convert (
328
- goto_model.symbol_table , goto_model.goto_functions , ui_message_handler);
329
-
330
- if (process_goto_program (options, goto_model))
331
- return CPROVER_EXIT_INTERNAL_ERROR;
332
-
333
- // if we had a second argument then we will handle it next
334
- if (arg2 != " " )
335
- cmdline.args [0 ] = arg2;
336
- }
337
-
338
- return -1 ; // no error, continue
339
- }
340
-
341
275
bool jdiff_parse_optionst::process_goto_program (
342
276
const optionst &options,
343
277
goto_modelt &goto_model)
0 commit comments