@@ -472,36 +472,54 @@ std::string recursive_initialization_configt::to_string() const
472
472
return out.str ();
473
473
}
474
474
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)
478
480
{
481
+ source_locationt source_location{};
482
+ source_location.set_file (CPROVER_PREFIX " harness.c" );
479
483
symbolt &fresh_symbol = get_fresh_aux_symbol (
480
- signed_int_type ( ),
484
+ std::move (symbol_type ),
481
485
CPROVER_PREFIX,
482
- symbol_name ,
486
+ symbol_base_name ,
483
487
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;
486
491
fresh_symbol.is_static_lifetime = true ;
487
492
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 );
488
511
fresh_symbol.value = initial_value;
489
512
return fresh_symbol.name ;
490
513
}
491
514
492
515
symbol_exprt recursive_initializationt::get_fresh_global_symexpr (
493
516
const std::string &symbol_name) const
494
517
{
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 ,
498
520
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 ;
504
- fresh_symbol.value = from_integer (0 , signed_int_type ());
521
+ signed_int_type (),
522
+ initialization_config.mode );
505
523
return fresh_symbol.symbol_expr ();
506
524
}
507
525
0 commit comments