Skip to content

Commit 78af785

Browse files
Replace guardt by exprt::operandst in rw_set
This was not making really use of guardt, since no guardt specific operations where performed, but instead just represents a conjunction. We replace that by a list of expressions and do the conjunction when needed. This avoids dependencies on guardt.
1 parent ea7ffaa commit 78af785

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

src/goto-instrument/rw_set.cpp

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -79,14 +79,15 @@ void _rw_set_loct::compute()
7979
void _rw_set_loct::assign(const exprt &lhs, const exprt &rhs)
8080
{
8181
read(rhs);
82-
read_write_rec(lhs, false, true, "", guardt(true_exprt()));
82+
read_write_rec(lhs, false, true, "", exprt::operandst());
8383
}
8484

8585
void _rw_set_loct::read_write_rec(
8686
const exprt &expr,
87-
bool r, bool w,
87+
bool r,
88+
bool w,
8889
const std::string &suffix,
89-
const guardt &guard)
90+
const exprt::operandst &guard)
9091
{
9192
if(expr.id()==ID_symbol)
9293
{
@@ -96,16 +97,16 @@ void _rw_set_loct::read_write_rec(
9697

9798
if(r)
9899
{
99-
const auto &entry =
100-
r_entries.emplace(object, entryt(symbol_expr, object, guard.as_expr()));
100+
const auto &entry = r_entries.emplace(
101+
object, entryt(symbol_expr, object, conjunction(guard)));
101102

102103
track_deref(entry.first->second, true);
103104
}
104105

105106
if(w)
106107
{
107-
const auto &entry =
108-
w_entries.emplace(object, entryt(symbol_expr, object, guard.as_expr()));
108+
const auto &entry = w_entries.emplace(
109+
object, entryt(symbol_expr, object, conjunction(guard)));
109110

110111
track_deref(entry.first->second, false);
111112
}
@@ -176,12 +177,12 @@ void _rw_set_loct::read_write_rec(
176177
assert(expr.operands().size()==3);
177178
read(expr.op0(), guard);
178179

179-
guardt true_guard(guard);
180-
true_guard.add(expr.op0());
180+
exprt::operandst true_guard = guard;
181+
true_guard.push_back(expr.op0());
181182
read_write_rec(expr.op1(), r, w, suffix, true_guard);
182183

183-
guardt false_guard(guard);
184-
false_guard.add(not_exprt(expr.op0()));
184+
exprt::operandst false_guard = guard;
185+
false_guard.push_back(not_exprt(expr.op0()));
185186
read_write_rec(expr.op2(), r, w, suffix, false_guard);
186187
}
187188
else

src/goto-instrument/rw_set.h

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ Date: February 2006
1818
#include <vector>
1919
#include <set>
2020

21-
#include <util/guard.h>
2221
#include <util/std_expr.h>
2322

2423
#include <goto-programs/goto_model.h>
@@ -158,17 +157,17 @@ class _rw_set_loct:public rw_set_baset
158157

159158
void read(const exprt &expr)
160159
{
161-
read_write_rec(expr, true, false, "", guardt(true_exprt()));
160+
read_write_rec(expr, true, false, "", exprt::operandst());
162161
}
163162

164-
void read(const exprt &expr, const guardt &guard)
163+
void read(const exprt &expr, const exprt::operandst &guard)
165164
{
166165
read_write_rec(expr, true, false, "", guard);
167166
}
168167

169168
void write(const exprt &expr)
170169
{
171-
read_write_rec(expr, false, true, "", guardt(true_exprt()));
170+
read_write_rec(expr, false, true, "", exprt::operandst());
172171
}
173172

174173
void compute();
@@ -177,9 +176,10 @@ class _rw_set_loct:public rw_set_baset
177176

178177
void read_write_rec(
179178
const exprt &expr,
180-
bool r, bool w,
179+
bool r,
180+
bool w,
181181
const std::string &suffix,
182-
const guardt &guard);
182+
const exprt::operandst &guard);
183183
};
184184

185185
class rw_set_loct:public _rw_set_loct

0 commit comments

Comments
 (0)