Skip to content

Commit a2e8439

Browse files
committed
Create symbol name on heap allocation
1 parent ed910a2 commit a2e8439

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

regression/goto-analyzer/heap-allocation/test-constant-pointers.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ main.c
33
--variable-sensitivity --vsd-pointers constants --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
main::1::i_was_malloced \(\) -> ptr ->\(heap-object\[0\]\)
6+
main::1::i_was_malloced \(\) -> ptr ->\(allocated-on-heap\[0\]\)
77
--

regression/goto-analyzer/heap-allocation/test-value-set-pointers.desc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@ main.c
33
--variable-sensitivity --vsd-pointers value-set --show
44
^EXIT=0$
55
^SIGNAL=0$
6-
main::1::i_was_malloced \(\) -> value-set-begin: ptr ->\(heap allocation\) :value-set-end
6+
main::1::i_was_malloced \(\) -> value-set-begin: ptr ->\(allocated-on-heap\) :value-set-end
77
--

src/analyses/variable-sensitivity/abstract_environment.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ abstract_environmentt::eval(const exprt &expr, const namespacet &ns) const
8888
simplified_id == ID_side_effect &&
8989
(simplified_expr.get(ID_statement) == ID_allocate))
9090
{
91-
auto heap_symbol = unary_exprt(
92-
ID_address_of, exprt(ID_dynamic_object), simplified_expr.type());
91+
auto dynamic_object = exprt(ID_dynamic_object);
92+
dynamic_object.set(ID_identifier, "allocated-on-heap");
93+
auto heap_symbol =
94+
unary_exprt(ID_address_of, dynamic_object, simplified_expr.type());
9395
auto heap_pointer =
9496
abstract_object_factory(simplified_expr.type(), heap_symbol, ns);
9597
return heap_pointer;

src/analyses/variable-sensitivity/constant_pointer_abstract_object.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,7 @@ void constant_pointer_abstract_objectt::output(
127127
}
128128
else if(addressee.id() == ID_dynamic_object)
129129
{
130-
out << "heap allocation";
130+
out << addressee.get(ID_identifier);
131131
}
132132
else if(addressee.id() == ID_index)
133133
{
@@ -232,7 +232,7 @@ abstract_object_pointert constant_pointer_abstract_objectt::typecast(
232232
auto heap_array_type = array_typet(new_type.subtype(), nil_exprt());
233233
auto array_object =
234234
environment.abstract_object_factory(heap_array_type, ns, true, false);
235-
auto heap_symbol = symbol_exprt("heap-object", heap_array_type);
235+
auto heap_symbol = symbol_exprt(value.get(ID_identifier), heap_array_type);
236236
env.assign(heap_symbol, array_object, ns);
237237
auto heap_address = address_of_exprt(
238238
index_exprt(heap_symbol, from_integer(0, signed_size_type())));

0 commit comments

Comments
 (0)