14
14
#include < util/std_expr.h>
15
15
#include < util/std_types.h>
16
16
17
- // / \param type: the type the abstract_object is representing
18
17
constant_pointer_abstract_objectt::constant_pointer_abstract_objectt (
19
- const typet &t )
20
- : pointer_abstract_objectt(t )
18
+ const typet &type )
19
+ : pointer_abstract_objectt(type )
21
20
{
22
- PRECONDITION (t .id () == ID_pointer);
21
+ PRECONDITION (type .id () == ID_pointer);
23
22
}
24
23
25
- // / \param type: the type the abstract_object is representing
26
- // / \param top: is the abstract_object starting as top
27
- // / \param bottom: is the abstract_object starting as bottom
28
- // /
29
- // / Start the abstract object at either top or bottom or neither
30
- // / Asserts if both top and bottom are true
31
24
constant_pointer_abstract_objectt::constant_pointer_abstract_objectt (
32
- const typet &t ,
33
- bool tp ,
34
- bool bttm )
35
- : pointer_abstract_objectt(t, tp, bttm )
25
+ const typet &type ,
26
+ bool top ,
27
+ bool bottom )
28
+ : pointer_abstract_objectt(type, top, bottom )
36
29
{
37
- PRECONDITION (t .id () == ID_pointer);
30
+ PRECONDITION (type .id () == ID_pointer);
38
31
}
39
32
40
- // / \param old: the abstract object to copy from
41
33
constant_pointer_abstract_objectt::constant_pointer_abstract_objectt (
42
34
const constant_pointer_abstract_objectt &old)
43
35
: pointer_abstract_objectt(old), value_stack(old.value_stack)
44
36
{
45
37
}
46
38
47
- // / \param expr: the expression to use as the starting pointer for
48
- // / an abstract object
49
39
constant_pointer_abstract_objectt::constant_pointer_abstract_objectt (
50
- const exprt &e ,
40
+ const exprt &expr ,
51
41
const abstract_environmentt &environment,
52
42
const namespacet &ns)
53
- : pointer_abstract_objectt(e , environment, ns),
54
- value_stack(e , environment, ns)
43
+ : pointer_abstract_objectt(expr , environment, ns),
44
+ value_stack(expr , environment, ns)
55
45
{
56
- PRECONDITION (e .type ().id () == ID_pointer);
46
+ PRECONDITION (expr .type ().id () == ID_pointer);
57
47
if (value_stack.is_top_value ())
58
48
{
59
49
make_top ();
@@ -63,14 +53,7 @@ constant_pointer_abstract_objectt::constant_pointer_abstract_objectt(
63
53
clear_top ();
64
54
}
65
55
}
66
- // / Set this abstract object to be the result of merging this
67
- // / abstract object. This calls the merge_constant_pointers if
68
- // / we are trying to merge a constant pointer we use the constant pointer
69
- // / constant pointer merge
70
- // /
71
- // / \param other: the pointer being merged
72
- // /
73
- // / \return Returns the result of the merge.
56
+
74
57
abstract_object_pointert
75
58
constant_pointer_abstract_objectt::merge (abstract_object_pointert other) const
76
59
{
@@ -87,14 +70,6 @@ constant_pointer_abstract_objectt::merge(abstract_object_pointert other) const
87
70
}
88
71
}
89
72
90
- // / Merges two constant pointers. If they are pointing at the same
91
- // / value, we merge, otherwise we set to top.
92
- // /
93
- // / \param other: the pointer being merged
94
- // /
95
- // / \return Returns a new abstract object that is the result of the merge
96
- // / unless the merge is the same as this abstract object, in which
97
- // / case it returns this.
98
73
abstract_object_pointert
99
74
constant_pointer_abstract_objectt::merge_constant_pointers (
100
75
const constant_pointer_abstract_pointert other) const
@@ -119,15 +94,6 @@ constant_pointer_abstract_objectt::merge_constant_pointers(
119
94
}
120
95
}
121
96
122
- // / To try and find a constant expression for this abstract object
123
- // /
124
- // / \return Returns an expression representing the value if it can.
125
- // / Returns a nil expression if it can be more than one value.
126
- // / Returns null_pointer expression if it must be null
127
- // / Returns an address_of_exprt with the value set to the
128
- // / result of to_constant called on whatever abstract object this
129
- // / pointer is pointing to.
130
- // /
131
97
exprt constant_pointer_abstract_objectt::to_constant () const
132
98
{
133
99
if (is_top () || is_bottom ())
@@ -142,12 +108,6 @@ exprt constant_pointer_abstract_objectt::to_constant() const
142
108
}
143
109
}
144
110
145
- // / Print the value of the pointer. Either NULL if nullpointer or
146
- // / ptr -> ( output of what the pointer is pointing to).
147
- // /
148
- // / \param out: the stream to write to
149
- // / \param ai: ?
150
- // / \param ns: ?
151
111
void constant_pointer_abstract_objectt::output (
152
112
std::ostream &out,
153
113
const ai_baset &ai,
@@ -191,15 +151,6 @@ void constant_pointer_abstract_objectt::output(
191
151
}
192
152
}
193
153
194
- // / A helper function to dereference a value from a pointer. Providing
195
- // / the pointer can only be pointing at one thing, returns an abstract
196
- // / object representing that thing. If null or top will return top.
197
- // /
198
- // / \param env: the environment
199
- // / \param ns: the namespace
200
- // /
201
- // / \return An abstract object representing the value this pointer is pointing
202
- // / to
203
154
abstract_object_pointert constant_pointer_abstract_objectt::read_dereference (
204
155
const abstract_environmentt &env,
205
156
const namespacet &ns) const
@@ -218,23 +169,6 @@ abstract_object_pointert constant_pointer_abstract_objectt::read_dereference(
218
169
}
219
170
}
220
171
221
- // / A helper function to evaluate writing to a pointers value.
222
- // / If the pointer can only be pointing to one element that it overwrites
223
- // / that element (or merges if merging_write) with the new value.
224
- // / If don't know what we are pointing to, we delegate to the parent.
225
- // /
226
- // / \param environment: the environment
227
- // / \param ns: the namespace
228
- // / \param stack: the remaining stack
229
- // / \param new_value: the value to write to the dereferenced pointer
230
- // / \param merging_write: is it a merging write (i.e. we aren't certain
231
- // / we are writing to this particular pointer therefore
232
- // / the value should be merged with whatever is already
233
- // / there or we are certain we are writing to this pointer
234
- // / so therefore the value can be replaced
235
- // /
236
- // / \return A modified abstract object representing this pointer after it
237
- // / has been written to.
238
172
sharing_ptrt<pointer_abstract_objectt>
239
173
constant_pointer_abstract_objectt::write_dereference (
240
174
abstract_environmentt &environment,
0 commit comments