Skip to content

Commit 07cb45a

Browse files
authored
Merge pull request #5564 from tautschnig/remove-deprecated-value_sets
Remove deprecated methods of value sets
2 parents c1c4430 + 2d8642a commit 07cb45a

15 files changed

+29
-231
lines changed

jbmc/unit/pointer-analysis/custom_value_set_analysis.cpp

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -145,17 +145,8 @@ typedef
145145
#define TEST_FUNCTION_NAME TEST_PREFIX "test:()V"
146146
#define TEST_LOCAL_PREFIX TEST_FUNCTION_NAME "::"
147147

148-
template<class VST>
149-
static value_setst::valuest
150-
get_values(const VST &value_set, const namespacet &ns, const exprt &expr)
151-
{
152-
value_setst::valuest vals;
153-
value_set.get_value_set(expr, vals, ns);
154-
return vals;
155-
}
156-
157-
static std::size_t exprs_with_id(
158-
const value_setst::valuest &exprs, const irep_idt &id)
148+
static std::size_t
149+
exprs_with_id(const std::vector<exprt> &exprs, const irep_idt &id)
159150
{
160151
return std::count_if(
161152
exprs.begin(),
@@ -222,15 +213,15 @@ SCENARIO("test_value_set_analysis",
222213
TEST_LOCAL_PREFIX "23::ignored", jlo_ref_type);
223214
THEN("The normal analysis should write to it")
224215
{
225-
auto normal_exprs=
226-
get_values(normal_function_end_vs, ns, written_symbol);
216+
auto normal_exprs =
217+
normal_function_end_vs.get_value_set(written_symbol, ns);
227218
REQUIRE(exprs_with_id(normal_exprs, ID_dynamic_object)==1);
228219
REQUIRE(exprs_with_id(normal_exprs, ID_unknown)==0);
229220
}
230221
THEN("The custom analysis should ignore the write to it")
231222
{
232-
auto test_exprs=
233-
get_values(test_function_end_vs, ns, written_symbol);
223+
auto test_exprs =
224+
test_function_end_vs.get_value_set(written_symbol, ns);
234225
REQUIRE(exprs_with_id(test_exprs, ID_dynamic_object)==0);
235226
REQUIRE(exprs_with_id(test_exprs, ID_unknown)==1);
236227
}
@@ -242,15 +233,15 @@ SCENARIO("test_value_set_analysis",
242233
TEST_LOCAL_PREFIX "31::no_write", jlo_ref_type);
243234
THEN("The normal analysis should write to it")
244235
{
245-
auto normal_exprs=
246-
get_values(normal_function_end_vs, ns, written_symbol);
236+
auto normal_exprs =
237+
normal_function_end_vs.get_value_set(written_symbol, ns);
247238
REQUIRE(exprs_with_id(normal_exprs, ID_dynamic_object)==1);
248239
REQUIRE(exprs_with_id(normal_exprs, ID_unknown)==0);
249240
}
250241
THEN("The custom analysis should ignore the write to it")
251242
{
252-
auto test_exprs=
253-
get_values(test_function_end_vs, ns, written_symbol);
243+
auto test_exprs =
244+
test_function_end_vs.get_value_set(written_symbol, ns);
254245
REQUIRE(exprs_with_id(test_exprs, ID_dynamic_object)==0);
255246
REQUIRE(exprs_with_id(test_exprs, ID_unknown)==1);
256247
}
@@ -262,15 +253,15 @@ SCENARIO("test_value_set_analysis",
262253
TEST_LOCAL_PREFIX "55::read", jlo_ref_type);
263254
THEN("The normal analysis should find a dynamic object")
264255
{
265-
auto normal_exprs=
266-
get_values(normal_function_end_vs, ns, written_symbol);
256+
auto normal_exprs =
257+
normal_function_end_vs.get_value_set(written_symbol, ns);
267258
REQUIRE(exprs_with_id(normal_exprs, ID_dynamic_object)==1);
268259
REQUIRE(exprs_with_id(normal_exprs, ID_unknown)==0);
269260
}
270261
THEN("The custom analysis should have no information about it")
271262
{
272-
auto test_exprs=
273-
get_values(test_function_end_vs, ns, written_symbol);
263+
auto test_exprs =
264+
test_function_end_vs.get_value_set(written_symbol, ns);
274265
REQUIRE(test_exprs.size()==0);
275266
}
276267
}
@@ -281,16 +272,16 @@ SCENARIO("test_value_set_analysis",
281272
TEST_PREFIX "maybe_unknown_read", jlo_ref_type);
282273
THEN("The normal analysis should find a dynamic object")
283274
{
284-
auto normal_exprs=
285-
get_values(normal_function_end_vs, ns, written_symbol);
275+
auto normal_exprs =
276+
normal_function_end_vs.get_value_set(written_symbol, ns);
286277
REQUIRE(exprs_with_id(normal_exprs, ID_dynamic_object)==1);
287278
REQUIRE(exprs_with_id(normal_exprs, ID_unknown)==0);
288279
}
289280
THEN("The custom analysis should find a dynamic object "
290281
"*and* an unknown entry")
291282
{
292-
auto test_exprs=
293-
get_values(test_function_end_vs, ns, written_symbol);
283+
auto test_exprs =
284+
test_function_end_vs.get_value_set(written_symbol, ns);
294285
REQUIRE(test_exprs.size()==2);
295286
REQUIRE(exprs_with_id(test_exprs, ID_unknown)==1);
296287
REQUIRE(exprs_with_id(test_exprs, ID_dynamic_object)==1);
@@ -301,16 +292,16 @@ SCENARIO("test_value_set_analysis",
301292
{
302293
symbol_exprt read_before_cause_write(
303294
TEST_PREFIX "first_effect_read", jlo_ref_type);
304-
auto normal_exprs_before=
305-
get_values(normal_function_end_vs, ns, read_before_cause_write);
306-
auto test_exprs_before=
307-
get_values(test_function_end_vs, ns, read_before_cause_write);
295+
auto normal_exprs_before =
296+
normal_function_end_vs.get_value_set(read_before_cause_write, ns);
297+
auto test_exprs_before =
298+
test_function_end_vs.get_value_set(read_before_cause_write, ns);
308299
symbol_exprt read_after_cause_write(
309300
TEST_PREFIX "second_effect_read", jlo_ref_type);
310-
auto normal_exprs_after=
311-
get_values(normal_function_end_vs, ns, read_after_cause_write);
312-
auto test_exprs_after=
313-
get_values(test_function_end_vs, ns, read_after_cause_write);
301+
auto normal_exprs_after =
302+
normal_function_end_vs.get_value_set(read_after_cause_write, ns);
303+
auto test_exprs_after =
304+
test_function_end_vs.get_value_set(read_after_cause_write, ns);
314305

315306
THEN("Before writing to 'cause' both analyses should think 'effect' "
316307
"points to some object")

src/goto-instrument/value_set_fi_fp_removal.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -211,8 +211,7 @@ void value_set_fi_fp_removal(
211211
<< messaget::eom;
212212

213213
const auto &pointer = to_dereference_expr(call.function()).pointer();
214-
std::list<exprt> addresses;
215-
value_sets.get_values(f.first, target, pointer, addresses);
214+
auto addresses = value_sets.get_values(f.first, target, pointer);
216215

217216
std::set<symbol_exprt> functions;
218217

src/goto-symex/symex_dereference_state.cpp

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,6 @@ Author: Daniel Kroening, [email protected]
1313

1414
#include <util/symbol_table.h>
1515

16-
#ifdef DEBUG
17-
# include <iostream>
18-
#endif
19-
2016
/// Get or create a failed symbol for the given pointer-typed expression. These
2117
/// are used as placeholders when dereferencing expressions that are illegal to
2218
/// dereference, such as null pointers. The \ref add_failed_symbols pass must
@@ -81,33 +77,6 @@ symex_dereference_statet::get_or_create_failed_symbol(const exprt &expr)
8177
return nullptr;
8278
}
8379

84-
/// Just forwards a value-set query to `state.value_set`
85-
void symex_dereference_statet::get_value_set(
86-
const exprt &expr,
87-
value_setst::valuest &value_set) const
88-
{
89-
state.value_set.get_value_set(expr, value_set, ns);
90-
91-
#ifdef DEBUG
92-
std::cout << "symex_dereference_statet state.value_set={\n";
93-
state.value_set.output(ns, std::cout, " - ");
94-
std::cout << "}" << std::endl;
95-
#endif
96-
97-
#if 0
98-
std::cout << "E: " << from_expr(goto_symex.ns, irep_idt(), expr) << '\n';
99-
#endif
100-
101-
#if 0
102-
std::cout << "**************************\n";
103-
for(value_setst::valuest::const_iterator it=value_set.begin();
104-
it!=value_set.end();
105-
it++)
106-
std::cout << from_expr(goto_symex.ns, irep_idt(), *it) << '\n';
107-
std::cout << "**************************\n";
108-
#endif
109-
}
110-
11180
/// Just forwards a value-set query to `state.value_set`
11281
std::vector<exprt>
11382
symex_dereference_statet::get_value_set(const exprt &expr) const

src/goto-symex/symex_dereference_state.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,10 +34,6 @@ class symex_dereference_statet:
3434
goto_symext::statet &state;
3535
const namespacet &ns;
3636

37-
DEPRECATED(SINCE(2019, 05, 22, "use vector returning version instead"))
38-
void get_value_set(const exprt &expr, value_setst::valuest &value_set)
39-
const override;
40-
4137
std::vector<exprt> get_value_set(const exprt &expr) const override;
4238

4339
const symbolt *get_or_create_failed_symbol(const exprt &expr) override;

src/pointer-analysis/dereference_callback.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,10 +29,6 @@ class dereference_callbackt
2929
public:
3030
virtual ~dereference_callbackt() = default;
3131

32-
DEPRECATED(SINCE(2019, 05, 22, "use vector returning version instead"))
33-
virtual void
34-
get_value_set(const exprt &expr, value_setst::valuest &value_set) const = 0;
35-
3632
virtual std::vector<exprt> get_value_set(const exprt &expr) const = 0;
3733

3834
virtual const symbolt *get_or_create_failed_symbol(const exprt &expr) = 0;

src/pointer-analysis/goto_program_dereference.cpp

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -125,17 +125,6 @@ void goto_program_dereferencet::dereference_rec(exprt &expr)
125125
}
126126
}
127127

128-
/// Gets the value set corresponding to the current target and
129-
/// expression `expr`.
130-
/// \param expr: an expression
131-
/// \param [out] dest: gets the value set
132-
void goto_program_dereferencet::get_value_set(
133-
const exprt &expr,
134-
value_setst::valuest &dest) const
135-
{
136-
value_sets.get_values(current_function, current_target, expr, dest);
137-
}
138-
139128
/// Gets the value set corresponding to the current target and
140129
/// expression \p expr.
141130
/// \param expr: an expression

src/pointer-analysis/goto_program_dereference.h

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ class goto_program_dereferencet:protected dereference_callbackt
6565

6666
const symbolt *get_or_create_failed_symbol(const exprt &expr) override;
6767

68-
DEPRECATED(SINCE(2019, 05, 22, "use vector returning version instead"))
69-
void
70-
get_value_set(const exprt &expr, value_setst::valuest &dest) const override;
71-
7268
std::vector<exprt> get_value_set(const exprt &expr) const override;
7369

7470
void dereference_instruction(

src/pointer-analysis/value_set.cpp

Lines changed: 0 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -133,14 +133,6 @@ bool value_sett::insert(
133133
return true;
134134
}
135135

136-
void value_sett::output(
137-
const namespacet &,
138-
std::ostream &out,
139-
const std::string &indent) const
140-
{
141-
output(out, indent);
142-
}
143-
144136
void value_sett::output(std::ostream &out, const std::string &indent) const
145137
{
146138
values.iterate([&](const irep_idt &, const entryt &e) {
@@ -356,26 +348,6 @@ bool value_sett::eval_pointer_offset(
356348
return mod;
357349
}
358350

359-
void value_sett::get_value_set(
360-
exprt expr,
361-
value_setst::valuest &dest,
362-
const namespacet &ns) const
363-
{
364-
object_mapt object_map = get_value_set(std::move(expr), ns, false);
365-
366-
for(object_map_dt::const_iterator
367-
it=object_map.read().begin();
368-
it!=object_map.read().end();
369-
it++)
370-
dest.push_back(to_expr(*it));
371-
372-
#if 0
373-
for(value_setst::valuest::const_iterator it=dest.begin();
374-
it!=dest.end(); it++)
375-
std::cout << "GET_VALUE_SET: " << format(*it) << '\n';
376-
#endif
377-
}
378-
379351
std::vector<exprt>
380352
value_sett::get_value_set(exprt expr, const namespacet &ns) const
381353
{
@@ -384,18 +356,6 @@ value_sett::get_value_set(exprt expr, const namespacet &ns) const
384356
.map([&](const object_map_dt::value_type &pair) { return to_expr(pair); });
385357
}
386358

387-
void value_sett::get_value_set(
388-
exprt expr,
389-
object_mapt &dest,
390-
const namespacet &ns,
391-
bool is_simplified) const
392-
{
393-
if(!is_simplified)
394-
simplify(expr, ns);
395-
396-
get_value_set_rec(expr, dest, "", expr.type(), ns);
397-
}
398-
399359
value_sett::object_mapt value_sett::get_value_set(
400360
exprt expr,
401361
const namespacet &ns,

src/pointer-analysis/value_set.h

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -80,11 +80,6 @@ class value_sett
8080
/// Represents the offset into an object: either a unique integer offset,
8181
/// or an unknown value, represented by `!offset`.
8282
typedef optionalt<mp_integer> offsett;
83-
DEPRECATED(SINCE(2019, 05, 22, "Unused"))
84-
bool offset_is_zero(const offsett &offset) const
85-
{
86-
return offset && offset->is_zero();
87-
}
8883

8984
/// Represents a set of expressions (`exprt` instances) with corresponding
9085
/// offsets (`offsett` instances). This is the RHS set of a single row of
@@ -235,17 +230,6 @@ class value_sett
235230
}
236231
};
237232

238-
/// Set of expressions; only used for the `get` API, not for internal
239-
/// data representation.
240-
DEPRECATED(SINCE(2019, 05, 22, "Only used in deprecated function"))
241-
typedef std::set<exprt> expr_sett;
242-
243-
/// Set of dynamic object numbers, equivalent to a set of
244-
/// `dynamic_object_exprt`s with corresponding IDs. Used only in internal
245-
/// implementation details.
246-
DEPRECATED(SINCE(2019, 05, 22, "Unused"))
247-
typedef std::set<unsigned int> dynamic_object_id_sett;
248-
249233
/// Map representing the entire value set, mapping from string LHS IDs
250234
/// to RHS expression sets. Note this data structure is somewhat
251235
/// denormalized, for example mapping
@@ -261,15 +245,6 @@ class value_sett
261245
/// `entryt` fields.
262246
typedef sharing_mapt<irep_idt, entryt> valuest;
263247

264-
/// Gets values pointed to by \p expr, including following dereference
265-
/// operators (i.e. this is not a simple lookup in `valuest`).
266-
DEPRECATED(
267-
SINCE(2019, 05, 22, "Use get_value_set(exprt, const namespacet &) instead"))
268-
void get_value_set(
269-
exprt expr,
270-
value_setst::valuest &dest,
271-
const namespacet &ns) const;
272-
273248
/// Gets values pointed to by `expr`, including following dereference
274249
/// operators (i.e. this is not a simple lookup in `valuest`).
275250
/// \param expr: query expression
@@ -278,10 +253,6 @@ class value_sett
278253
/// are object_descriptor_exprt or have id ID_invalid or ID_unknown.
279254
std::vector<exprt> get_value_set(exprt expr, const namespacet &ns) const;
280255

281-
/// Appears to be unimplemented.
282-
DEPRECATED(SINCE(2019, 05, 22, "Unimplemented"))
283-
expr_sett &get(const irep_idt &identifier, const std::string &suffix);
284-
285256
void clear()
286257
{
287258
values.clear();
@@ -318,12 +289,6 @@ class value_sett
318289
/// \param indent: string to use for indentation of the output
319290
void output(std::ostream &out, const std::string &indent = "") const;
320291

321-
DEPRECATED(SINCE(2019, 06, 11, "Use the version without ns argument"))
322-
void output(
323-
const namespacet &ns,
324-
std::ostream &out,
325-
const std::string &indent = "") const;
326-
327292
/// Stores the LHS ID -> RHS expression set map. See `valuest` documentation
328293
/// for more detail.
329294
valuest values;
@@ -467,16 +432,6 @@ class value_sett
467432
void erase_symbol(const symbol_exprt &symbol_expr, const namespacet &ns);
468433

469434
protected:
470-
/// Reads the set of objects pointed to by \p expr, including making
471-
/// recursive lookups for dereference operations etc.
472-
DEPRECATED(
473-
SINCE(2019, 05, 22, "Use the version returning object_mapt instead"))
474-
void get_value_set(
475-
exprt expr,
476-
object_mapt &dest,
477-
const namespacet &ns,
478-
bool is_simplified) const;
479-
480435
/// Reads the set of objects pointed to by `expr`, including making
481436
/// recursive lookups for dereference operations etc.
482437
/// \param expr: query expression

src/pointer-analysis/value_set_analysis.h

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,17 +64,6 @@ class value_set_analysis_templatet:
6464
}
6565

6666
public:
67-
// interface value_sets
68-
DEPRECATED(SINCE(2019, 05, 22, "use list returning version instead"))
69-
void get_values(
70-
const irep_idt &,
71-
locationt l,
72-
const exprt &expr,
73-
value_setst::valuest &dest) override
74-
{
75-
(*this)[l].value_set.get_value_set(expr, dest, baset::ns);
76-
}
77-
7867
// interface value_sets
7968
std::vector<exprt>
8069
get_values(const irep_idt &, locationt l, const exprt &expr) override

0 commit comments

Comments
 (0)