Skip to content

Commit 97b6d87

Browse files
committed
Remove abstract_objectt::read member function
Now we've moved some work into expression_transform, we don't need a read member on the base class.
1 parent c8f3e48 commit 97b6d87

16 files changed

+7
-177
lines changed

src/analyses/variable-sensitivity/abstract_object.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -136,14 +136,6 @@ abstract_object_pointert abstract_objectt::expression_transform(
136136
return environment.abstract_object_factory(copy.type(), copy, ns);
137137
}
138138

139-
abstract_object_pointert abstract_objectt::read(
140-
const abstract_environmentt &env,
141-
const exprt &specifier,
142-
const namespacet &ns) const
143-
{
144-
return shared_from_this();
145-
}
146-
147139
abstract_object_pointert abstract_objectt::write(
148140
abstract_environmentt &environment,
149141
const namespacet &ns,

src/analyses/variable-sensitivity/abstract_object.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -177,23 +177,6 @@ class abstract_objectt : public std::enable_shared_from_this<abstract_objectt>
177177
/// that allows an object to be built from a value.
178178
virtual exprt to_constant() const;
179179

180-
/**
181-
* A helper function to evaluate an abstract object contained
182-
* within a container object. More precise abstractions may override this
183-
* to return more precise results.
184-
*
185-
* \param env the abstract environment
186-
* \param specifier a modifier expression, such as an array index or field
187-
* specifier used to indicate access to a specific component
188-
* \param ns the current namespace
189-
*
190-
* \return the abstract_objectt representing the value of the read component.
191-
*/
192-
virtual abstract_object_pointert read(
193-
const abstract_environmentt &env,
194-
const exprt &specifier,
195-
const namespacet &ns) const;
196-
197180
/**
198181
* A helper function to evaluate writing to a component of an
199182
* abstract object. More precise abstractions may override this to

src/analyses/variable-sensitivity/array_abstract_object.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -43,21 +43,13 @@ abstract_object_pointert array_abstract_objectt::expression_transform(
4343
{
4444
if(expr.id() == ID_index)
4545
{
46-
return read(environment, expr, ns);
46+
return read_index(environment, to_index_expr(expr), ns);
4747
}
4848

4949
return abstract_objectt::expression_transform(
5050
expr, operands, environment, ns);
5151
}
5252

53-
abstract_object_pointert array_abstract_objectt::read(
54-
const abstract_environmentt &env,
55-
const exprt &specifier,
56-
const namespacet &ns) const
57-
{
58-
return this->read_index(env, to_index_expr(specifier), ns);
59-
}
60-
6153
abstract_object_pointert array_abstract_objectt::write(
6254
abstract_environmentt &environment,
6355
const namespacet &ns,

src/analyses/variable-sensitivity/array_abstract_object.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,6 @@ class array_abstract_objectt : public abstract_objectt
6363
const abstract_environmentt &environment,
6464
const namespacet &ns) const override;
6565

66-
/**
67-
* A helper function to evaluate an abstract object contained
68-
* within a container object. More precise abstractions may override this
69-
* to return more precise results.
70-
*
71-
* \param env the abstract environment
72-
* \param specifier a modifier expression, such as an array index or field
73-
* specifier used to indicate access to a specific component
74-
* \param ns the current namespace
75-
*
76-
* \return the abstract_objectt representing the value of the read component.
77-
*/
78-
abstract_object_pointert read(
79-
const abstract_environmentt &env,
80-
const exprt &specifier,
81-
const namespacet &ns) const override;
82-
8366
/**
8467
* A helper function to evaluate writing to a component of an
8568
* abstract object. More precise abstractions may override this to

src/analyses/variable-sensitivity/context_abstract_object.cpp

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -30,28 +30,6 @@ void context_abstract_objectt::set_not_top_internal()
3030
set_child(child_abstract_object->clear_top());
3131
}
3232

33-
/**
34-
* A helper function to evaluate an abstract object contained
35-
* within a container object. More precise abstractions may override this
36-
* to return more precise results.
37-
*
38-
* \param env the abstract environment
39-
* \param specifier a modifier expression, such as an array index or field
40-
* specifier used to indicate access to a specific component
41-
* \param ns the current namespace
42-
*
43-
* \return the abstract_objectt representing the value of the read component.
44-
* For the dependency context, the operation is simply delegated to the
45-
* child object
46-
*/
47-
abstract_object_pointert context_abstract_objectt::read(
48-
const abstract_environmentt &env,
49-
const exprt &specifier,
50-
const namespacet &ns) const
51-
{
52-
return child_abstract_object->read(env, specifier, ns);
53-
}
54-
5533
/**
5634
* A helper function to evaluate writing to a component of an
5735
* abstract object. More precise abstractions may override this to

src/analyses/variable-sensitivity/context_abstract_object.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -107,11 +107,6 @@ class context_abstract_objectt : public abstract_objectt
107107
void set_top_internal() override;
108108
void set_not_top_internal() override;
109109

110-
abstract_object_pointert read(
111-
const abstract_environmentt &env,
112-
const exprt &specifier,
113-
const namespacet &ns) const override;
114-
115110
abstract_object_pointert write(
116111
abstract_environmentt &environment,
117112
const namespacet &ns,

src/analyses/variable-sensitivity/pointer_abstract_object.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -44,21 +44,13 @@ abstract_object_pointert pointer_abstract_objectt::expression_transform(
4444
{
4545
if(expr.id() == ID_dereference)
4646
{
47-
return read(environment, expr, ns);
47+
return read_dereference(environment, ns);
4848
}
4949

5050
return abstract_objectt::expression_transform(
5151
expr, operands, environment, ns);
5252
}
5353

54-
abstract_object_pointert pointer_abstract_objectt::read(
55-
const abstract_environmentt &env,
56-
const exprt &specifier,
57-
const namespacet &ns) const
58-
{
59-
return read_dereference(env, ns);
60-
}
61-
6254
abstract_object_pointert pointer_abstract_objectt::write(
6355
abstract_environmentt &environment,
6456
const namespacet &ns,

src/analyses/variable-sensitivity/pointer_abstract_object.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,6 @@ class pointer_abstract_objectt : public abstract_objectt
6464
const abstract_environmentt &environment,
6565
const namespacet &ns);
6666

67-
/**
68-
* A helper function to evaluate an abstract object contained
69-
* within a container object. More precise abstractions may override this
70-
* to return more precise results.
71-
*
72-
* \param env the abstract environment
73-
* \param specifier a modifier expression, such as an array index or field
74-
* specifier used to indicate access to a specific component
75-
* \param ns the current namespace
76-
*
77-
* \return the abstract_objectt representing the value of the read component.
78-
*/
79-
abstract_object_pointert read(
80-
const abstract_environmentt &env,
81-
const exprt &specifier,
82-
const namespacet &ns) const override;
83-
8467
/**
8568
* A helper function to evaluate writing to a component of an
8669
* abstract object. More precise abstractions may override this to

src/analyses/variable-sensitivity/struct_abstract_object.cpp

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -45,21 +45,13 @@ abstract_object_pointert struct_abstract_objectt::expression_transform(
4545
{
4646
if(expr.id() == ID_member)
4747
{
48-
return read(environment, expr, ns);
48+
return read_component(environment, to_member_expr(expr), ns);
4949
}
5050

5151
return abstract_objectt::expression_transform(
5252
expr, operands, environment, ns);
5353
}
5454

55-
abstract_object_pointert struct_abstract_objectt::read(
56-
const abstract_environmentt &env,
57-
const exprt &specifier,
58-
const namespacet &ns) const
59-
{
60-
return this->read_component(env, to_member_expr(specifier), ns);
61-
}
62-
6355
abstract_object_pointert struct_abstract_objectt::write(
6456
abstract_environmentt &environment,
6557
const namespacet &ns,

src/analyses/variable-sensitivity/struct_abstract_object.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -63,23 +63,6 @@ class struct_abstract_objectt : public abstract_objectt
6363
const abstract_environmentt &environment,
6464
const namespacet &ns);
6565

66-
/**
67-
* A helper function to evaluate an abstract object contained
68-
* within a container object. More precise abstractions may override this
69-
* to return more precise results.
70-
*
71-
* \param env the abstract environment
72-
* \param specifier a modifier expression, such as an array index or field
73-
* specifier used to indicate access to a specific component
74-
* \param ns the current namespace
75-
*
76-
* \return the abstract_objectt representing the value of the read component.
77-
*/
78-
abstract_object_pointert read(
79-
const abstract_environmentt &env,
80-
const exprt &specifier,
81-
const namespacet &ns) const override;
82-
8366
/**
8467
* A helper function to evaluate writing to a component of an
8568
* abstract object. More precise abstractions may override this to

src/analyses/variable-sensitivity/union_abstract_object.cpp

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,6 @@ union_abstract_objectt::union_abstract_objectt(
3636
PRECONDITION(ns.follow(expr.type()).id() == ID_union);
3737
}
3838

39-
abstract_object_pointert union_abstract_objectt::read(
40-
const abstract_environmentt &env,
41-
const exprt &specifier,
42-
const namespacet &ns) const
43-
{
44-
return read_component(env, to_member_expr(specifier), ns);
45-
}
46-
4739
abstract_object_pointert union_abstract_objectt::write(
4840
abstract_environmentt &environment,
4941
const namespacet &ns,

src/analyses/variable-sensitivity/union_abstract_object.h

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@ class union_abstract_objectt : public abstract_objectt
4242
const abstract_environmentt &environment,
4343
const namespacet &ns);
4444

45-
/**
46-
* A helper function to evaluate an abstract object contained
47-
* within a container object. More precise abstractions may override this
48-
* to return more precise results.
49-
*
50-
* \param env the abstract environment
51-
* \param specifier a modifier expression, such as an array index or field
52-
* specifier used to indicate access to a specific component
53-
* \param ns the current namespace
54-
*
55-
* \return the abstract_objectt representing the value of the read component.
56-
*/
57-
abstract_object_pointert read(
58-
const abstract_environmentt &env,
59-
const exprt &specifier,
60-
const namespacet &ns) const override;
61-
6245
/**
6346
* A helper function to evaluate writing to a component of an
6447
* abstract object. More precise abstractions may override this to

src/analyses/variable-sensitivity/value_set_abstract_object.cpp

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -111,18 +111,6 @@ abstract_object_pointert value_set_abstract_objectt::expression_transform(
111111
return resolve_new_values(resulting_objects);
112112
}
113113

114-
abstract_object_pointert value_set_abstract_objectt::read(
115-
const abstract_environmentt &env,
116-
const exprt &specifier,
117-
const namespacet &ns) const
118-
{
119-
abstract_object_sett new_values;
120-
for(const auto &st_value : values)
121-
new_values.insert(st_value->read(env, specifier, ns));
122-
123-
return resolve_new_values(new_values);
124-
}
125-
126114
abstract_object_pointert value_set_abstract_objectt::write(
127115
abstract_environmentt &environment,
128116
const namespacet &ns,

src/analyses/variable-sensitivity/value_set_abstract_object.h

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -89,14 +89,6 @@ class value_set_abstract_objectt : public abstract_valuet
8989
/// either converted to interval or marked as `top`.
9090
static const size_t max_value_set_size = 10;
9191

92-
/// \copydoc abstract_objectt::read
93-
///
94-
/// Delegate reading to stored values.
95-
abstract_object_pointert read(
96-
const abstract_environmentt &env,
97-
const exprt &specifier,
98-
const namespacet &ns) const override;
99-
10092
/// \copydoc abstract_objectt::write
10193
///
10294
/// Delegate writing to stored values.

unit/analyses/variable-sensitivity/constant_array_abstract_object/merge.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,8 @@ class array_utilt
6161
constant_array_abstract_object_pointert array_object,
6262
const index_exprt &index) const
6363
{
64-
return array_object->read(enviroment, index, ns)->to_constant();
64+
return array_object->expression_transform(index, {}, enviroment, ns)
65+
->to_constant();
6566
}
6667

6768
private:

unit/analyses/variable-sensitivity/full_struct_abstract_object/merge.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,8 @@ class struct_utilt
4242
full_struct_abstract_objectt::constant_struct_pointert struct_object,
4343
const member_exprt &component) const
4444
{
45-
return struct_object->read(enviroment, component, ns)->to_constant();
45+
return struct_object->expression_transform(component, {}, enviroment, ns)
46+
->to_constant();
4647
}
4748

4849
// At the moment the full_struct_abstract_object does not support

0 commit comments

Comments
 (0)