Skip to content

Commit 17ceafd

Browse files
author
Daniel Kroening
committed
introduce non-const instructiont::get_condition()
This will eventually allow us to protect the guard data member.
1 parent 252bf55 commit 17ceafd

9 files changed

+18
-9
lines changed

src/analyses/constant_propagator.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -756,11 +756,12 @@ void constant_propagator_ait::replace(
756756
continue;
757757

758758
replace_types_rec(d.values.replace_const, it->code);
759-
replace_types_rec(d.values.replace_const, it->guard);
760759

761760
if(it->is_goto() || it->is_assume() || it->is_assert())
762761
{
763-
constant_propagator_domaint::partial_evaluate(d.values, it->guard, ns);
762+
replace_types_rec(d.values.replace_const, it->get_condition());
763+
constant_propagator_domaint::partial_evaluate(
764+
d.values, it->get_condition(), ns);
764765
}
765766
else if(it->is_assign())
766767
{

src/goto-programs/adjust_float_expressions.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ void adjust_float_expressions(
202202
adjust_float_expressions(it->code, ns);
203203

204204
if(it->has_condition())
205-
adjust_float_expressions(it->guard, ns);
205+
adjust_float_expressions(it->get_condition(), ns);
206206
}
207207
}
208208

src/goto-programs/goto_inline_class.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ void goto_inlinet::insert_function_body(
318318
replace_location(it->code, target->source_location);
319319

320320
if(it->has_condition())
321-
replace_location(it->guard, target->source_location);
321+
replace_location(it->get_condition(), target->source_location);
322322
}
323323
}
324324

src/goto-programs/goto_program.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -287,6 +287,13 @@ class goto_programt
287287
return guard;
288288
}
289289

290+
/// Get the condition of gotos, assume, assert
291+
exprt &get_condition()
292+
{
293+
PRECONDITION(has_condition());
294+
return guard;
295+
}
296+
290297
// The below will eventually become a single target only.
291298
/// The target for gotos and for start_thread nodes
292299
typedef std::list<instructiont>::iterator targett;

src/goto-programs/link_goto_model.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ static void rename_symbols_in_function(
3535
rename_symbol(iit->code);
3636

3737
if(iit->has_condition())
38-
rename_symbol(iit->guard);
38+
rename_symbol(iit->get_condition());
3939
}
4040
}
4141

src/goto-programs/remove_complex.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -290,7 +290,7 @@ static void remove_complex(
290290
remove_complex(it->code);
291291

292292
if(it->has_condition())
293-
remove_complex(it->guard);
293+
remove_complex(it->get_condition());
294294
}
295295
}
296296

src/goto-programs/remove_vector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -223,7 +223,7 @@ void remove_vector(goto_functionst::goto_functiont &goto_function)
223223
remove_vector(it->code);
224224

225225
if(it->has_condition())
226-
remove_vector(it->guard);
226+
remove_vector(it->get_condition());
227227
}
228228
}
229229

src/goto-programs/rewrite_union.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ void rewrite_union(goto_functionst::goto_functiont &goto_function)
106106
rewrite_union(it->code);
107107

108108
if(it->has_condition())
109-
rewrite_union(it->guard);
109+
rewrite_union(it->get_condition());
110110
}
111111
}
112112

src/pointer-analysis/goto_program_dereference.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ void goto_program_dereferencet::dereference_instruction(
302302
goto_programt::instructiont &i=*target;
303303

304304
if(i.has_condition())
305-
dereference_expr(i.guard, checks_only, value_set_dereferencet::modet::READ);
305+
dereference_expr(
306+
i.get_condition(), checks_only, value_set_dereferencet::modet::READ);
306307

307308
if(i.is_assign())
308309
{

0 commit comments

Comments
 (0)