@@ -22,8 +22,8 @@ Date: June 2003
2222
2323goto_convert_functionst::goto_convert_functionst (
2424 symbol_table_baset &_symbol_table,
25- message_handlert &_message_handler):
26- goto_convertt(_symbol_table, _message_handler)
25+ message_handlert &_message_handler)
26+ : goto_convertt(_symbol_table, _message_handler)
2727{
2828}
2929
@@ -44,7 +44,9 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
4444 !symbol_pair.second .is_type && !symbol_pair.second .is_macro &&
4545 symbol_pair.second .type .id () == ID_code &&
4646 (symbol_pair.second .mode == ID_C || symbol_pair.second .mode == ID_cpp ||
47- symbol_pair.second .mode == ID_java || symbol_pair.second .mode == " jsil" ))
47+ symbol_pair.second .mode == ID_java ||
48+ symbol_pair.second .mode == " jsil" ||
49+ symbol_pair.second .mode == ID_statement_list))
4850 {
4951 symbol_list.push_back (symbol_pair.first );
5052 }
@@ -57,8 +59,8 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
5759
5860 functions.compute_location_numbers ();
5961
60- // this removes the parse tree of the bodies from memory
61- #if 0
62+ // this removes the parse tree of the bodies from memory
63+ #if 0
6264 for(const auto &symbol_pair, symbol_table.symbols)
6365 {
6466 if(!symbol_pair.second.is_type &&
@@ -68,7 +70,7 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
6870 symbol_pair.second.value=codet();
6971 }
7072 }
71- #endif
73+ #endif
7274}
7375
7476bool goto_convert_functionst::hide (const goto_programt &goto_program)
@@ -87,7 +89,7 @@ void goto_convert_functionst::add_return(
8789 goto_functionst::goto_functiont &f,
8890 const source_locationt &source_location)
8991{
90- #if 0
92+ #if 0
9193 if(!f.body.instructions.empty() &&
9294 f.body.instructions.back().is_return())
9395 return; // not needed, we have one already
@@ -97,12 +99,11 @@ void goto_convert_functionst::add_return(
9799 f.body.instructions.back().is_goto() &&
98100 f.body.instructions.back().guard.is_true())
99101 return;
100- #else
102+ #else
101103
102104 if (!f.body .instructions .empty ())
103105 {
104- goto_programt::const_targett last_instruction=
105- f.body .instructions .end ();
106+ goto_programt::const_targett last_instruction = f.body .instructions .end ();
106107 last_instruction--;
107108
108109 while (true )
@@ -120,16 +121,17 @@ void goto_convert_functionst::add_return(
120121 return ;
121122
122123 // advance if it's a 'dead' without branch target
123- if (last_instruction->is_dead () &&
124- last_instruction!=f.body .instructions .begin () &&
125- !last_instruction->is_target ())
124+ if (
125+ last_instruction->is_dead () &&
126+ last_instruction != f.body .instructions .begin () &&
127+ !last_instruction->is_target ())
126128 last_instruction--;
127129 else
128130 break ; // give up
129131 }
130132 }
131133
132- #endif
134+ #endif
133135
134136 side_effect_expr_nondett rhs (f.type .return_type (), source_location);
135137
@@ -141,22 +143,23 @@ void goto_convert_functionst::convert_function(
141143 const irep_idt &identifier,
142144 goto_functionst::goto_functiont &f)
143145{
144- const symbolt &symbol= ns.lookup (identifier);
146+ const symbolt &symbol = ns.lookup (identifier);
145147 const irep_idt mode = symbol.mode ;
146148
147149 if (f.body_available ())
148150 return ; // already converted
149151
150152 // make tmp variables local to function
151- tmp_symbol_prefix= id2string (symbol.name )+ " ::$tmp" ;
153+ tmp_symbol_prefix = id2string (symbol.name ) + " ::$tmp" ;
152154
153155 // store the parameter identifiers in the goto functions
154156 const code_typet &code_type = to_code_type (symbol.type );
155157 f.type = code_type;
156158 f.set_parameter_identifiers (code_type);
157159
158- if (symbol.value .is_nil () ||
159- symbol.is_compiled ()) /* goto_inline may have removed the body */
160+ if (
161+ symbol.value .is_nil () ||
162+ symbol.is_compiled ()) /* goto_inline may have removed the body */
160163 return ;
161164
162165 // we have a body, make sure all parameter names are valid
@@ -172,25 +175,24 @@ void goto_convert_functionst::convert_function(
172175 lifetime = identifier == INITIALIZE_FUNCTION ? lifetimet::STATIC_GLOBAL
173176 : lifetimet::AUTOMATIC_LOCAL;
174177
175- const codet &code= to_code (symbol.value );
178+ const codet &code = to_code (symbol.value );
176179
177180 source_locationt end_location;
178181
179- if (code.get_statement ()== ID_block)
180- end_location= to_code_block (code).end_location ();
182+ if (code.get_statement () == ID_block)
183+ end_location = to_code_block (code).end_location ();
181184 else
182185 end_location.make_nil ();
183186
184187 goto_programt tmp_end_function;
185188 goto_programt::targett end_function =
186189 tmp_end_function.add (goto_programt::make_end_function (end_location));
187190
188- targets= targetst ();
191+ targets = targetst ();
189192 targets.set_return (end_function);
190- targets.has_return_value =
191- f.type .return_type ().id ()!=ID_empty &&
192- f.type .return_type ().id ()!=ID_constructor &&
193- f.type .return_type ().id ()!=ID_destructor;
193+ targets.has_return_value = f.type .return_type ().id () != ID_empty &&
194+ f.type .return_type ().id () != ID_constructor &&
195+ f.type .return_type ().id () != ID_destructor;
194196
195197 goto_convert_rec (code, f.body , mode);
196198
@@ -199,12 +201,13 @@ void goto_convert_functionst::convert_function(
199201 add_return (f, end_location);
200202
201203 // handle SV-COMP's __VERIFIER_atomic_
202- if (!f.body .instructions .empty () &&
203- has_prefix (id2string (identifier), " __VERIFIER_atomic_" ))
204+ if (
205+ !f.body .instructions .empty () &&
206+ has_prefix (id2string (identifier), " __VERIFIER_atomic_" ))
204207 {
205208 goto_programt::instructiont a_begin;
206209 a_begin = goto_programt::make_atomic_begin ();
207- a_begin.source_location = f.body .instructions .front ().source_location ;
210+ a_begin.source_location = f.body .instructions .front ().source_location ;
208211 f.body .insert_before_swap (f.body .instructions .begin (), a_begin);
209212
210213 goto_programt::targett a_end =
@@ -231,9 +234,7 @@ void goto_convert_functionst::convert_function(
231234 lifetime = parent_lifetime;
232235}
233236
234- void goto_convert (
235- goto_modelt &goto_model,
236- message_handlert &message_handler)
237+ void goto_convert (goto_modelt &goto_model, message_handlert &message_handler)
237238{
238239 symbol_table_buildert symbol_table_builder =
239240 symbol_table_buildert::wrap (goto_model.symbol_table );
0 commit comments