Skip to content

Commit d116215

Browse files
author
Daniel Kroening
committed
use instructiont::get_condition()
1 parent 4dc7725 commit d116215

12 files changed

+37
-40
lines changed

src/analyses/constant_propagator.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ void constant_propagator_domaint::transform(
169169
}
170170
else if(from->is_assume())
171171
{
172-
two_way_propagate_rec(from->guard, ns, cp);
172+
two_way_propagate_rec(from->get_condition(), ns, cp);
173173
}
174174
else if(from->is_goto())
175175
{
@@ -178,9 +178,9 @@ void constant_propagator_domaint::transform(
178178
// Comparing iterators is safe as the target must be within the same list
179179
// of instructions because this is a GOTO.
180180
if(from->get_target()==to)
181-
g = from->guard;
181+
g = from->get_condition();
182182
else
183-
g = not_exprt(from->guard);
183+
g = not_exprt(from->get_condition());
184184
partial_evaluate(values, g, ns);
185185
if(g.is_false())
186186
values.set_to_bottom();

src/analyses/custom_bitvector_analysis.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -520,9 +520,9 @@ void custom_bitvector_domaint::transform(
520520
break;
521521

522522
case GOTO:
523-
if(has_get_must_or_may(instruction.guard))
523+
if(has_get_must_or_may(instruction.get_condition()))
524524
{
525-
exprt guard=instruction.guard;
525+
exprt guard = instruction.get_condition();
526526

527527
// Comparing iterators is safe as the target must be within the same list
528528
// of instructions because this is a GOTO.
@@ -776,13 +776,14 @@ void custom_bitvector_analysist::check(
776776

777777
if(i_it->is_assert())
778778
{
779-
if(!custom_bitvector_domaint::has_get_must_or_may(i_it->guard))
779+
if(!custom_bitvector_domaint::has_get_must_or_may(
780+
i_it->get_condition()))
780781
continue;
781782

782783
if(operator[](i_it).has_values.is_false())
783784
continue;
784785

785-
exprt tmp=eval(i_it->guard, i_it);
786+
exprt tmp = eval(i_it->get_condition(), i_it);
786787
const namespacet ns(goto_model.symbol_table);
787788
result=simplify_expr(tmp, ns);
788789

src/analyses/flow_insensitive_analysis.cpp

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,10 @@ exprt flow_insensitive_abstract_domain_baset::get_guard(
2424
{
2525
if(!from->is_goto())
2626
return true_exprt();
27-
28-
locationt next=from;
29-
next++;
30-
31-
if(next==to)
32-
return boolean_negate(from->guard);
33-
34-
return from->guard;
27+
else if(std::next(from) == to)
28+
return boolean_negate(from->get_condition());
29+
else
30+
return from->get_condition();
3531
}
3632

3733
exprt flow_insensitive_abstract_domain_baset::get_return_lhs(locationt to) const

src/analyses/interval_domain.cpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -88,15 +88,15 @@ void interval_domaint::transform(
8888
if(from->get_target() != next) // If equal then a skip
8989
{
9090
if(next == to)
91-
assume(not_exprt(instruction.guard), ns);
91+
assume(not_exprt(instruction.get_condition()), ns);
9292
else
93-
assume(instruction.guard, ns);
93+
assume(instruction.get_condition(), ns);
9494
}
9595
}
9696
break;
9797

9898
case ASSUME:
99-
assume(instruction.guard, ns);
99+
assume(instruction.get_condition(), ns);
100100
break;
101101

102102
case FUNCTION_CALL:

src/analyses/invariant_propagation.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ void invariant_propagationt::simplify(goto_programt &goto_program)
253253

254254
const invariant_sett &invariant_set = d.invariant_set;
255255

256-
exprt simplified_guard(i_it->guard);
256+
exprt simplified_guard(i_it->get_condition());
257257

258258
invariant_set.simplify(simplified_guard);
259259
::simplify(simplified_guard, ns);

src/analyses/invariant_set_domain.cpp

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -28,12 +28,10 @@ void invariant_set_domaint::transform(
2828
{
2929
// Comparing iterators is safe as the target must be within the same list
3030
// of instructions because this is a GOTO.
31-
exprt tmp(from_l->guard);
31+
exprt tmp(from_l->get_condition());
3232

33-
goto_programt::const_targett next=from_l;
34-
next++;
35-
if(next==to_l)
36-
tmp = boolean_negate(from_l->guard);
33+
if(std::next(from_l) == to_l)
34+
tmp = boolean_negate(from_l->get_condition());
3735

3836
simplify(tmp, ns);
3937
invariant_set.strengthen(tmp);
@@ -43,7 +41,7 @@ void invariant_set_domaint::transform(
4341
case ASSERT:
4442
case ASSUME:
4543
{
46-
exprt tmp(from_l->guard);
44+
exprt tmp(from_l->get_condition());
4745
simplify(tmp, ns);
4846
invariant_set.strengthen(tmp);
4947
}

src/analyses/local_safe_pointers.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ void local_safe_pointerst::operator()(const goto_programt &goto_program)
126126

127127
// Possible checks:
128128
case ASSUME:
129-
if(auto assume_check = get_null_checked_expr(instruction.guard))
129+
if(auto assume_check = get_null_checked_expr(instruction.get_condition()))
130130
{
131131
if(assume_check->checked_when_taken)
132132
checked_expressions.insert(assume_check->checked_expr);
@@ -147,7 +147,9 @@ void local_safe_pointerst::operator()(const goto_programt &goto_program)
147147
// merge point and everything will be assumed maybe-null in any case.
148148
if(target_emplace_result.second)
149149
{
150-
if(auto conditional_check = get_null_checked_expr(instruction.guard))
150+
if(
151+
auto conditional_check =
152+
get_null_checked_expr(instruction.get_condition()))
151153
{
152154
// Add the GOTO condition to either the target or current state,
153155
// as appropriate:

src/analyses/static_analysis.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ exprt static_analysis_baset::get_guard(
3232
next++;
3333

3434
if(next==to)
35-
return boolean_negate(from->guard);
35+
return boolean_negate(from->get_condition());
3636

37-
return from->guard;
37+
return from->get_condition();
3838
}
3939

4040
exprt static_analysis_baset::get_return_lhs(locationt to)

src/goto-programs/cfg.h

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -218,8 +218,9 @@ void cfg_baset<T, P, I>::compute_edges_goto(
218218
goto_programt::const_targett next_PC,
219219
entryt &entry)
220220
{
221-
if(next_PC!=goto_program.instructions.end() &&
222-
!instruction.guard.is_true())
221+
if(
222+
next_PC != goto_program.instructions.end() &&
223+
!instruction.get_condition().is_true())
223224
this->add_edge(entry, entry_map[next_PC]);
224225

225226
this->add_edge(entry, entry_map[instruction.get_target()]);
@@ -400,7 +401,7 @@ void cfg_baset<T, P, I>::compute_edges(
400401

401402
case ASSUME:
402403
// false guard -> no successor
403-
if(instruction.guard.is_false())
404+
if(instruction.get_condition().is_false())
404405
break;
405406

406407
case ASSIGN:

src/goto-programs/goto_program.h

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,7 +1030,7 @@ std::list<Target> goto_programt::get_successors(
10301030
{
10311031
std::list<Target> successors(i.targets.begin(), i.targets.end());
10321032

1033-
if(!i.guard.is_true() && next!=instructions.end())
1033+
if(!i.get_condition().is_true() && next != instructions.end())
10341034
successors.push_back(next);
10351035

10361036
return successors;
@@ -1060,10 +1060,9 @@ std::list<Target> goto_programt::get_successors(
10601060

10611061
if(i.is_assume())
10621062
{
1063-
return
1064-
!i.guard.is_false() && next!=instructions.end() ?
1065-
std::list<Target>{next} :
1066-
std::list<Target>();
1063+
return !i.get_condition().is_false() && next != instructions.end()
1064+
? std::list<Target>{next}
1065+
: std::list<Target>();
10671066
}
10681067

10691068
if(next!=instructions.end())

src/goto-symex/symex_goto.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ void goto_symext::symex_goto(statet &state)
3434
return; // nothing to do
3535
}
3636

37-
exprt old_guard=instruction.guard;
37+
exprt old_guard = instruction.get_condition();
3838
clean_expr(old_guard, state, false);
3939

4040
exprt new_guard=old_guard;

src/goto-symex/symex_main.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -408,7 +408,7 @@ void goto_symext::symex_step(
408408
case ASSUME:
409409
if(!state.guard.is_false())
410410
{
411-
exprt tmp=instruction.guard;
411+
exprt tmp = instruction.get_condition();
412412
clean_expr(tmp, state, false);
413413
state.rename(tmp, ns);
414414
symex_assume(state, tmp);
@@ -423,7 +423,7 @@ void goto_symext::symex_step(
423423
std::string msg=id2string(state.source.pc->source_location.get_comment());
424424
if(msg=="")
425425
msg="assertion";
426-
exprt tmp(instruction.guard);
426+
exprt tmp(instruction.get_condition());
427427
clean_expr(tmp, state, false);
428428
vcc(tmp, msg, state);
429429
}

0 commit comments

Comments
 (0)