1414#include < util/std_expr.h>
1515#include < util/std_types.h>
1616
17- // / \param type: the type the abstract_object is representing
1817constant_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 )
2120{
22- PRECONDITION (t .id () == ID_pointer);
21+ PRECONDITION (type .id () == ID_pointer);
2322}
2423
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
3124constant_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 )
3629{
37- PRECONDITION (t .id () == ID_pointer);
30+ PRECONDITION (type .id () == ID_pointer);
3831}
3932
40- // / \param old: the abstract object to copy from
4133constant_pointer_abstract_objectt::constant_pointer_abstract_objectt (
4234 const constant_pointer_abstract_objectt &old)
4335 : pointer_abstract_objectt(old), value_stack(old.value_stack)
4436{
4537}
4638
47- // / \param expr: the expression to use as the starting pointer for
48- // / an abstract object
4939constant_pointer_abstract_objectt::constant_pointer_abstract_objectt (
50- const exprt &e ,
40+ const exprt &expr ,
5141 const abstract_environmentt &environment,
5242 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)
5545{
56- PRECONDITION (e .type ().id () == ID_pointer);
46+ PRECONDITION (expr .type ().id () == ID_pointer);
5747 if (value_stack.is_top_value ())
5848 {
5949 make_top ();
@@ -63,14 +53,7 @@ constant_pointer_abstract_objectt::constant_pointer_abstract_objectt(
6353 clear_top ();
6454 }
6555}
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+
7457abstract_object_pointert
7558constant_pointer_abstract_objectt::merge (abstract_object_pointert other) const
7659{
@@ -87,14 +70,6 @@ constant_pointer_abstract_objectt::merge(abstract_object_pointert other) const
8770 }
8871}
8972
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.
9873abstract_object_pointert
9974constant_pointer_abstract_objectt::merge_constant_pointers (
10075 const constant_pointer_abstract_pointert other) const
@@ -119,15 +94,6 @@ constant_pointer_abstract_objectt::merge_constant_pointers(
11994 }
12095}
12196
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- // /
13197exprt constant_pointer_abstract_objectt::to_constant () const
13298{
13399 if (is_top () || is_bottom ())
@@ -142,12 +108,6 @@ exprt constant_pointer_abstract_objectt::to_constant() const
142108 }
143109}
144110
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: ?
151111void constant_pointer_abstract_objectt::output (
152112 std::ostream &out,
153113 const ai_baset &ai,
@@ -191,15 +151,6 @@ void constant_pointer_abstract_objectt::output(
191151 }
192152}
193153
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
203154abstract_object_pointert constant_pointer_abstract_objectt::read_dereference (
204155 const abstract_environmentt &env,
205156 const namespacet &ns) const
@@ -218,23 +169,6 @@ abstract_object_pointert constant_pointer_abstract_objectt::read_dereference(
218169 }
219170}
220171
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.
238172sharing_ptrt<pointer_abstract_objectt>
239173constant_pointer_abstract_objectt::write_dereference (
240174 abstract_environmentt &environment,
0 commit comments