Skip to content

Commit 08f611e

Browse files
committed
jbmc, janalyzer: Remove unnecessary dynamic_cast
`lazy_goto_modelt::process_whole_model_and_freeze` returns a unique pointer to `goto_modelt`, which these call sites unnecessarily generalised to `abstract_goto_modelt` (just to then `dynamic_cast` it to `goto_modelt`). Fix the local pointer types and remove the now no longer necessary cast.
1 parent b87d38a commit 08f611e

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

jbmc/src/janalyzer/janalyzer_parse_options.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -401,13 +401,13 @@ int janalyzer_parse_optionst::doit()
401401
log.status() << "Generating GOTO Program" << messaget::eom;
402402
lazy_goto_model.load_all_functions();
403403

404-
std::unique_ptr<abstract_goto_modelt> goto_model_ptr =
404+
std::unique_ptr<goto_modelt> goto_model_ptr =
405405
lazy_goto_modelt::process_whole_model_and_freeze(
406406
std::move(lazy_goto_model));
407407
if(goto_model_ptr == nullptr)
408408
return CPROVER_EXIT_INTERNAL_ERROR;
409409

410-
goto_modelt &goto_model = dynamic_cast<goto_modelt &>(*goto_model_ptr);
410+
goto_modelt &goto_model = *goto_model_ptr;
411411

412412
// show it?
413413
if(cmdline.isset("show-symbol-table"))

jbmc/src/jbmc/jbmc_parse_options.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -474,7 +474,7 @@ int jbmc_parse_optionst::doit()
474474
stub_objects_are_not_null =
475475
options.get_bool_option("java-assume-inputs-non-null");
476476

477-
std::unique_ptr<abstract_goto_modelt> goto_model_ptr;
477+
std::unique_ptr<goto_modelt> goto_model_ptr;
478478
int get_goto_program_ret = get_goto_program(goto_model_ptr, options);
479479
if(get_goto_program_ret != -1)
480480
return get_goto_program_ret;
@@ -594,7 +594,7 @@ int jbmc_parse_optionst::doit()
594594
}
595595

596596
int jbmc_parse_optionst::get_goto_program(
597-
std::unique_ptr<abstract_goto_modelt> &goto_model_ptr,
597+
std::unique_ptr<goto_modelt> &goto_model_ptr,
598598
const optionst &options)
599599
{
600600
if(options.is_set("context-include") || options.is_set("context-exclude"))
@@ -633,7 +633,7 @@ int jbmc_parse_optionst::get_goto_program(
633633
if(goto_model_ptr == nullptr)
634634
return CPROVER_EXIT_INTERNAL_ERROR;
635635

636-
goto_modelt &goto_model = dynamic_cast<goto_modelt &>(*goto_model_ptr);
636+
goto_modelt &goto_model = *goto_model_ptr;
637637

638638
if(cmdline.isset("validate-goto-model"))
639639
{

0 commit comments

Comments
 (0)