@@ -472,35 +472,54 @@ std::string recursive_initialization_configt::to_string() const
472472 return out.str ();
473473}
474474
475- irep_idt recursive_initializationt::get_fresh_global_name (
476- const std::string &symbol_name,
477- const exprt &initial_value) const
475+ static symbolt &get_fresh_global_symbol (
476+ symbol_tablet &symbol_table,
477+ const std::string &symbol_base_name,
478+ typet symbol_type,
479+ irep_idt mode)
478480{
481+ source_locationt source_location{};
482+ source_location.set_file (CPROVER_PREFIX " harness.c" );
479483 symbolt &fresh_symbol = get_fresh_aux_symbol (
480- signed_int_type ( ),
484+ std::move (symbol_type ),
481485 CPROVER_PREFIX,
482- symbol_name ,
486+ symbol_base_name ,
483487 source_locationt{},
484- initialization_config.mode ,
485- goto_model.symbol_table );
488+ mode,
489+ symbol_table);
490+ fresh_symbol.base_name = fresh_symbol.pretty_name = symbol_base_name;
486491 fresh_symbol.is_static_lifetime = true ;
487492 fresh_symbol.is_lvalue = true ;
493+ fresh_symbol.is_auxiliary = false ;
494+ fresh_symbol.is_file_local = false ;
495+ fresh_symbol.is_thread_local = false ;
496+ fresh_symbol.is_state_var = false ;
497+ fresh_symbol.module = CPROVER_PREFIX " harness" ;
498+ fresh_symbol.location = std::move (source_location);
499+ return fresh_symbol;
500+ }
501+
502+ irep_idt recursive_initializationt::get_fresh_global_name (
503+ const std::string &symbol_name,
504+ const exprt &initial_value) const
505+ {
506+ auto &fresh_symbol = get_fresh_global_symbol (
507+ goto_model.symbol_table ,
508+ symbol_name,
509+ signed_int_type (), // FIXME why always signed_int_type???
510+ initialization_config.mode );
488511 fresh_symbol.value = initial_value;
489512 return fresh_symbol.name ;
490513}
491514
492515symbol_exprt recursive_initializationt::get_fresh_global_symexpr (
493516 const std::string &symbol_name) const
494517{
495- symbolt &fresh_symbol = get_fresh_aux_symbol (
496- signed_int_type (),
497- CPROVER_PREFIX,
518+ auto &fresh_symbol = get_fresh_global_symbol (
519+ goto_model.symbol_table ,
498520 symbol_name,
499- source_locationt{},
500- initialization_config.mode ,
501- goto_model.symbol_table );
502- fresh_symbol.is_static_lifetime = true ;
503- fresh_symbol.is_lvalue = true ;
521+ signed_int_type (),
522+ initialization_config.mode );
504523 fresh_symbol.value = from_integer (0 , signed_int_type ());
505524 return fresh_symbol.symbol_expr ();
506525}
0 commit comments