@@ -229,17 +229,10 @@ void cpp_typecheckt::typecheck_compound_type(
229229 else
230230 {
231231 // produce new symbol
232- symbolt symbol;
233-
234- symbol.name =symbol_name;
232+ type_symbolt symbol{symbol_name, type, ID_cpp};
235233 symbol.base_name =base_name;
236- symbol.value .make_nil ();
237234 symbol.location =type.source_location ();
238- symbol.mode =ID_cpp;
239235 symbol.module =module ;
240- symbol.type .swap (type);
241- symbol.is_type =true ;
242- symbol.is_macro =false ;
243236 symbol.pretty_name =
244237 cpp_scopes.current_scope ().prefix +
245238 id2string (symbol.base_name )+
@@ -577,16 +570,12 @@ void cpp_typecheckt::typecheck_compound_declarator(
577570 if (!symbol_table.has_symbol (vt_name))
578571 {
579572 // first time: create a virtual-table symbol type
580- symbolt vt_symb_type;
581- vt_symb_type.name = vt_name;
573+ type_symbolt vt_symb_type{vt_name, struct_typet (), ID_cpp};
582574 vt_symb_type.base_name =" virtual_table::" +id2string (symbol.base_name );
583575 vt_symb_type.pretty_name =vt_symb_type.base_name ;
584- vt_symb_type.mode =ID_cpp;
585576 vt_symb_type.module =module ;
586577 vt_symb_type.location =symbol.location ;
587- vt_symb_type.type =struct_typet ();
588578 vt_symb_type.type .set (ID_name, vt_symb_type.name );
589- vt_symb_type.is_type =true ;
590579
591580 const bool failed=!symbol_table.insert (std::move (vt_symb_type)).second ;
592581 CHECK_RETURN (!failed);
@@ -626,15 +615,14 @@ void cpp_typecheckt::typecheck_compound_declarator(
626615 irep_idt virtual_base=*virtual_bases.begin ();
627616
628617 // a new function that does 'late casting' of the 'this' parameter
629- symbolt func_symb;
630- func_symb.name =
631- id2string (component.get_name ())+" ::" +id2string (virtual_base);
618+ symbolt func_symb{
619+ id2string (component.get_name ()) + " ::" + id2string (virtual_base),
620+ component.type (),
621+ symbol.mode };
632622 func_symb.base_name = component.get_base_name ();
633623 func_symb.pretty_name = component.get_base_name ();
634- func_symb.mode = symbol.mode ;
635624 func_symb.module =module ;
636625 func_symb.location =component.source_location ();
637- func_symb.type =component.type ();
638626
639627 // change the type of the 'this' pointer
640628 code_typet &code_type=to_code_type (func_symb.type );
@@ -653,14 +641,13 @@ void cpp_typecheckt::typecheck_compound_declarator(
653641 if (param_base_name.empty ())
654642 param_base_name = " arg" + std::to_string (i++);
655643
656- symbolt arg_symb;
657- arg_symb.name =
658- id2string (func_symb.name ) + " ::" + id2string (param_base_name);
644+ symbolt arg_symb{
645+ id2string (func_symb.name ) + " ::" + id2string (param_base_name),
646+ arg.type (),
647+ symbol.mode };
659648 arg_symb.base_name = param_base_name;
660649 arg_symb.pretty_name = param_base_name;
661- arg_symb.mode = symbol.mode ;
662650 arg_symb.location =func_symb.location ;
663- arg_symb.type =arg.type ();
664651
665652 arg.set_identifier (arg_symb.name );
666653
@@ -725,10 +712,7 @@ void cpp_typecheckt::typecheck_compound_declarator(
725712 if (is_static && !is_method) // static non-method member
726713 {
727714 // add as global variable to symbol_table
728- symbolt static_symbol;
729- static_symbol.mode =symbol.mode ;
730- static_symbol.name =identifier;
731- static_symbol.type =component.type ();
715+ symbolt static_symbol{identifier, component.type (), symbol.mode };
732716 static_symbol.base_name = component.get_base_name ();
733717 static_symbol.is_lvalue =true ;
734718 static_symbol.is_static_lifetime =true ;
@@ -1282,8 +1266,6 @@ void cpp_typecheckt::typecheck_member_function(
12821266 const typet &method_qualifier,
12831267 exprt &value)
12841268{
1285- symbolt symbol;
1286-
12871269 code_typet &type = to_code_type (component.type ());
12881270
12891271 if (component.get_bool (ID_is_static))
@@ -1322,14 +1304,10 @@ void cpp_typecheckt::typecheck_member_function(
13221304 if (value.is_not_nil ())
13231305 to_code_type (type).set_inlined (true );
13241306
1325- symbol. name = identifier;
1307+ symbolt symbol{ identifier, type, compound_symbol. mode } ;
13261308 symbol.base_name =component.get_base_name ();
13271309 symbol.value .swap (value);
1328- symbol.mode = compound_symbol.mode ;
13291310 symbol.module =module ;
1330- symbol.type =type;
1331- symbol.is_type =false ;
1332- symbol.is_macro =false ;
13331311 symbol.location =component.source_location ();
13341312
13351313 // move early, it must be visible before doing any value
0 commit comments