File tree 3 files changed +30
-33
lines changed
3 files changed +30
-33
lines changed Original file line number Diff line number Diff line change @@ -197,17 +197,16 @@ void adjust_float_expressions(
197
197
goto_functionst::goto_functiont &goto_function,
198
198
const namespacet &ns)
199
199
{
200
- Forall_goto_program_instructions (it, goto_function.body )
201
- {
202
- adjust_float_expressions (it->code , ns);
203
-
204
- if (it->has_condition ())
205
- {
206
- exprt c = it->get_condition ();
207
- adjust_float_expressions (c, ns);
208
- it->set_condition (c);
209
- }
210
- }
200
+ for (auto &i : goto_function.body .instructions )
201
+ i.transform ([&ns](exprt expr) -> optionalt<exprt> {
202
+ if (have_to_adjust_float_expressions (expr))
203
+ {
204
+ adjust_float_expressions (expr, ns);
205
+ return expr;
206
+ }
207
+ else
208
+ return {};
209
+ });
211
210
}
212
211
213
212
void adjust_float_expressions (
Original file line number Diff line number Diff line change @@ -285,17 +285,16 @@ static void remove_complex(
285
285
{
286
286
remove_complex (goto_function.type );
287
287
288
- Forall_goto_program_instructions (it, goto_function.body )
289
- {
290
- remove_complex (it->code );
291
-
292
- if (it->has_condition ())
293
- {
294
- exprt c = it->get_condition ();
295
- remove_complex (c);
296
- it->set_condition (c);
297
- }
298
- }
288
+ for (auto &i : goto_function.body .instructions )
289
+ i.transform ([](exprt e) -> optionalt<exprt> {
290
+ if (have_to_remove_complex (e))
291
+ {
292
+ remove_complex (e);
293
+ return e;
294
+ }
295
+ else
296
+ return {};
297
+ });
299
298
}
300
299
301
300
// / removes complex data type
Original file line number Diff line number Diff line change @@ -219,17 +219,16 @@ void remove_vector(goto_functionst::goto_functiont &goto_function)
219
219
{
220
220
remove_vector (goto_function.type );
221
221
222
- Forall_goto_program_instructions (it, goto_function.body )
223
- {
224
- remove_vector (it->code );
225
-
226
- if (it->has_condition ())
227
- {
228
- exprt c = it->get_condition ();
229
- remove_vector (c);
230
- it->set_condition (c);
231
- }
232
- }
222
+ for (auto &i : goto_function.body .instructions )
223
+ i.transform ([](exprt e) -> optionalt<exprt> {
224
+ if (have_to_remove_vector (e))
225
+ {
226
+ remove_vector (e);
227
+ return e;
228
+ }
229
+ else
230
+ return {};
231
+ });
233
232
}
234
233
235
234
// / removes vector data type
You can’t perform that action at this time.
0 commit comments