Management of dynamic objects has always been a pain and this PR attempts to improve it. It's based on introducing 2 new classes:
dynamic_objectt representing a single dynamic object (i.e. a single symbol dynamic_object$loc$i) - it contains information about object's symbol, allocation site, allocation guard, etc.
dynamic_objectst representing a database of all dynamic objects in the analysed program (there's always a single instance of this class) - objects are stored in a per-location map depending on the location they are allocated in
The most significant changes in this PR are:
all the code related to creating and splitting dynamic objects is moved from malloc_ssa and preprocessing_util into dynamic_objectst
removed dependency on exprt properties and symbol names:
there's no need to use the #malloc_result property of exprt anymore - to check if an expression is a malloc result, it's possible to use dynamic_objectst::have_objects to see if any objects have been allocated in a given location
same applies for detecting if an object is dynamic - instead of checking its name for the dynamic_object$ substring, it is now possible to call dynamic_objectst::get_object_by_name, which also returns all the information about the object
the only thing that remains is the #dynamic property of typet which is not that easy to get rid of
some algorithms in dynobj_instance_analysist and assignmentst have been simplified thanks to the information stored in the database
The dynamic objects database has been made available to goto_unwindert and local_ssat so that they can use it to cleanup their algorithms in future.
Management of dynamic objects has always been a pain and this PR attempts to improve it. It's based on introducing 2 new classes:
dynamic_objectt
representing a single dynamic object (i.e. a single symboldynamic_object$loc$i
) - it contains information about object's symbol, allocation site, allocation guard, etc.dynamic_objectst
representing a database of all dynamic objects in the analysed program (there's always a single instance of this class) - objects are stored in a per-location map depending on the location they are allocated inThe most significant changes in this PR are:
malloc_ssa
andpreprocessing_util
intodynamic_objectst
exprt
properties and symbol names:#malloc_result
property ofexprt
anymore - to check if an expression is a malloc result, it's possible to usedynamic_objectst::have_objects
to see if any objects have been allocated in a given locationdynamic_object$
substring, it is now possible to calldynamic_objectst::get_object_by_name
, which also returns all the information about the object#dynamic
property oftypet
which is not that easy to get rid ofdynobj_instance_analysist
andassignmentst
have been simplified thanks to the information stored in the databaseThe dynamic objects database has been made available to
goto_unwindert
andlocal_ssat
so that they can use it to cleanup their algorithms in future.