@@ -22,8 +22,8 @@ Date: June 2003
22
22
23
23
goto_convert_functionst::goto_convert_functionst (
24
24
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)
27
27
{
28
28
}
29
29
@@ -44,7 +44,9 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
44
44
!symbol_pair.second .is_type && !symbol_pair.second .is_macro &&
45
45
symbol_pair.second .type .id () == ID_code &&
46
46
(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))
48
50
{
49
51
symbol_list.push_back (symbol_pair.first );
50
52
}
@@ -57,8 +59,8 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
57
59
58
60
functions.compute_location_numbers ();
59
61
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
62
64
for(const auto &symbol_pair, symbol_table.symbols)
63
65
{
64
66
if(!symbol_pair.second.is_type &&
@@ -68,7 +70,7 @@ void goto_convert_functionst::goto_convert(goto_functionst &functions)
68
70
symbol_pair.second.value=codet();
69
71
}
70
72
}
71
- #endif
73
+ #endif
72
74
}
73
75
74
76
bool goto_convert_functionst::hide (const goto_programt &goto_program)
@@ -87,7 +89,7 @@ void goto_convert_functionst::add_return(
87
89
goto_functionst::goto_functiont &f,
88
90
const source_locationt &source_location)
89
91
{
90
- #if 0
92
+ #if 0
91
93
if(!f.body.instructions.empty() &&
92
94
f.body.instructions.back().is_return())
93
95
return; // not needed, we have one already
@@ -97,12 +99,11 @@ void goto_convert_functionst::add_return(
97
99
f.body.instructions.back().is_goto() &&
98
100
f.body.instructions.back().guard.is_true())
99
101
return;
100
- #else
102
+ #else
101
103
102
104
if (!f.body .instructions .empty ())
103
105
{
104
- goto_programt::const_targett last_instruction=
105
- f.body .instructions .end ();
106
+ goto_programt::const_targett last_instruction = f.body .instructions .end ();
106
107
last_instruction--;
107
108
108
109
while (true )
@@ -120,16 +121,17 @@ void goto_convert_functionst::add_return(
120
121
return ;
121
122
122
123
// 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 ())
126
128
last_instruction--;
127
129
else
128
130
break ; // give up
129
131
}
130
132
}
131
133
132
- #endif
134
+ #endif
133
135
134
136
side_effect_expr_nondett rhs (f.type .return_type (), source_location);
135
137
@@ -141,22 +143,23 @@ void goto_convert_functionst::convert_function(
141
143
const irep_idt &identifier,
142
144
goto_functionst::goto_functiont &f)
143
145
{
144
- const symbolt &symbol= ns.lookup (identifier);
146
+ const symbolt &symbol = ns.lookup (identifier);
145
147
const irep_idt mode = symbol.mode ;
146
148
147
149
if (f.body_available ())
148
150
return ; // already converted
149
151
150
152
// make tmp variables local to function
151
- tmp_symbol_prefix= id2string (symbol.name )+ " ::$tmp" ;
153
+ tmp_symbol_prefix = id2string (symbol.name ) + " ::$tmp" ;
152
154
153
155
// store the parameter identifiers in the goto functions
154
156
const code_typet &code_type = to_code_type (symbol.type );
155
157
f.type = code_type;
156
158
f.set_parameter_identifiers (code_type);
157
159
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 */
160
163
return ;
161
164
162
165
// we have a body, make sure all parameter names are valid
@@ -172,25 +175,24 @@ void goto_convert_functionst::convert_function(
172
175
lifetime = identifier == INITIALIZE_FUNCTION ? lifetimet::STATIC_GLOBAL
173
176
: lifetimet::AUTOMATIC_LOCAL;
174
177
175
- const codet &code= to_code (symbol.value );
178
+ const codet &code = to_code (symbol.value );
176
179
177
180
source_locationt end_location;
178
181
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 ();
181
184
else
182
185
end_location.make_nil ();
183
186
184
187
goto_programt tmp_end_function;
185
188
goto_programt::targett end_function =
186
189
tmp_end_function.add (goto_programt::make_end_function (end_location));
187
190
188
- targets= targetst ();
191
+ targets = targetst ();
189
192
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;
194
196
195
197
goto_convert_rec (code, f.body , mode);
196
198
@@ -199,12 +201,13 @@ void goto_convert_functionst::convert_function(
199
201
add_return (f, end_location);
200
202
201
203
// 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_" ))
204
207
{
205
208
goto_programt::instructiont a_begin;
206
209
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 ;
208
211
f.body .insert_before_swap (f.body .instructions .begin (), a_begin);
209
212
210
213
goto_programt::targett a_end =
@@ -231,9 +234,7 @@ void goto_convert_functionst::convert_function(
231
234
lifetime = parent_lifetime;
232
235
}
233
236
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)
237
238
{
238
239
symbol_table_buildert symbol_table_builder =
239
240
symbol_table_buildert::wrap (goto_model.symbol_table );
0 commit comments