File tree Expand file tree Collapse file tree 7 files changed +13
-36
lines changed
Expand file tree Collapse file tree 7 files changed +13
-36
lines changed Original file line number Diff line number Diff line change @@ -125,14 +125,11 @@ typet ansi_c_declarationt::full_type(
125125 return result;
126126}
127127
128- void ansi_c_declarationt::to_symbol (
129- const ansi_c_declaratort &declarator,
130- symbolt &symbol) const
128+ symbolt
129+ ansi_c_declarationt::to_symbol (const ansi_c_declaratort &declarator) const
131130{
132- symbol. clear () ;
131+ symbolt symbol{declarator. get_name (), full_type (declarator), ID_C} ;
133132 symbol.value =declarator.value ();
134- symbol.type =full_type (declarator);
135- symbol.name =declarator.get_name ();
136133 symbol.pretty_name =symbol.name ;
137134 symbol.base_name =declarator.get_base_name ();
138135 symbol.is_type =get_is_typedef ();
@@ -190,4 +187,6 @@ void ansi_c_declarationt::to_symbol(
190187 symbol.is_macro || (!get_is_global () && !get_is_extern ()) ||
191188 (get_is_global () && get_is_static ()) || symbol.is_parameter ;
192189 }
190+
191+ return symbol;
193192}
Original file line number Diff line number Diff line change @@ -195,9 +195,7 @@ class ansi_c_declarationt:public exprt
195195 set (ID_is_weak, is_weak);
196196 }
197197
198- void to_symbol (
199- const ansi_c_declaratort &,
200- symbolt &symbol) const ;
198+ symbolt to_symbol (const ansi_c_declaratort &) const ;
201199
202200 typet full_type (const ansi_c_declaratort &) const ;
203201
Original file line number Diff line number Diff line change @@ -781,8 +781,7 @@ void c_typecheck_baset::typecheck_declaration(
781781 declaration.set_is_typedef (full_spec.is_typedef );
782782 declaration.set_is_weak (full_spec.is_weak );
783783
784- symbolt symbol;
785- declaration.to_symbol (declarator, symbol);
784+ symbolt symbol = declaration.to_symbol (declarator);
786785 current_symbol=symbol;
787786
788787 // now check other half of type
Original file line number Diff line number Diff line change @@ -43,8 +43,7 @@ bool jsil_convertt::operator()(
4343 it!=parse_tree.items .end ();
4444 ++it)
4545 {
46- symbolt new_symbol;
47- it->to_symbol (new_symbol);
46+ symbolt new_symbol = it->to_symbol ();
4847
4948 if (convert_code (new_symbol, to_code (new_symbol.value )))
5049 return true ;
Original file line number Diff line number Diff line change @@ -40,10 +40,8 @@ static bool insert_at_label(
4040 return true ;
4141}
4242
43- void jsil_declarationt::to_symbol (symbolt &symbol ) const
43+ symbolt jsil_declarationt::to_symbol () const
4444{
45- symbol.clear ();
46-
4745 symbol_exprt s (to_symbol_expr (
4846 static_cast <const exprt&>(find (ID_declarator))));
4947
@@ -56,10 +54,8 @@ void jsil_declarationt::to_symbol(symbolt &symbol) const
5654 else if (proc_type==" spec" )
5755 symbol_type=jsil_spec_code_typet (symbol_type);
5856
59- symbol. name = s.get_identifier ();
57+ symbolt symbol{ s.get_identifier (), symbol_type, " jsil " } ;
6058 symbol.base_name =s.get_identifier ();
61- symbol.mode =" jsil" ;
62- symbol.type =symbol_type;
6359 symbol.location =s.source_location ();
6460
6561 code_blockt code (to_code_block (
@@ -79,6 +75,8 @@ void jsil_declarationt::to_symbol(symbolt &symbol) const
7975 throw " throw label " +throws.get_string (ID_label)+" not found" ;
8076
8177 symbol.value .swap (code);
78+
79+ return symbol;
8280}
8381
8482void jsil_declarationt::output (std::ostream &out) const
Original file line number Diff line number Diff line change @@ -92,7 +92,7 @@ class jsil_declarationt:public exprt
9292 return static_cast <code_blockt &>(add (ID_value));
9393 }
9494
95- void to_symbol (symbolt &symbol ) const ;
95+ symbolt to_symbol () const ;
9696
9797 void output (std::ostream &) const ;
9898};
Original file line number Diff line number Diff line change @@ -93,22 +93,6 @@ class symbolt
9393 {
9494 }
9595
96- // / Zero initialise a symbol object.
97- void clear ()
98- {
99- type.make_nil ();
100- value.make_nil ();
101- location.make_nil ();
102-
103- name=module =base_name=mode=pretty_name=irep_idt ();
104-
105- is_type=is_macro=is_exported=
106- is_input=is_output=is_state_var=is_property=
107- is_static_lifetime=is_thread_local=
108- is_lvalue=is_file_local=is_extern=is_volatile=
109- is_parameter=is_auxiliary=is_weak=false ;
110- }
111-
11296 void swap (symbolt &b);
11397 void show (std::ostream &out) const ;
11498
You can’t perform that action at this time.
0 commit comments