12 #ifndef CBMC_ABSTRACT_AGGREGATE_OBJECT_H
13 #define CBMC_ABSTRACT_AGGREGATE_OBJECT_H
28 template <
class aggregate_typet,
class aggregate_traitst>
37 type.
id() != ID_struct_tag || ID_struct == aggregate_traitst::TYPE_ID());
39 type.
id() != ID_union_tag || ID_union == aggregate_traitst::TYPE_ID());
41 type.
id() == ID_struct_tag ||
type.
id() == ID_union_tag ||
42 type.
id() == aggregate_traitst::TYPE_ID());
52 expr.
type().
id() != ID_struct_tag ||
53 ID_struct == aggregate_traitst::TYPE_ID());
55 expr.
type().
id() != ID_union_tag ||
56 ID_union == aggregate_traitst::TYPE_ID());
58 expr.
type().
id() == ID_struct_tag || expr.
type().
id() == ID_union_tag ||
59 expr.
type().
id() == aggregate_traitst::TYPE_ID());
64 const std::vector<abstract_object_pointert> &operands,
68 if(expr.
id() == aggregate_traitst::ACCESS_EXPR_ID())
72 expr, operands, environment, ns);
78 const std::stack<exprt> &stack,
79 const exprt &specifier,
81 bool merging_write)
const override
84 environment, ns, stack, specifier, value, merging_write);
94 aggregate_traitst::get_statistics(
statistics, visited, env, ns);
95 this->
statistics(statistics, visited, env, ns);
107 aggregate_traitst::read_type(expr.
type(),
type()),
116 const std::stack<exprt> &stack,
119 bool merging_write)
const
123 return shared_from_this();
127 return std::make_shared<aggregate_typet>(
type(),
true,
false);
137 template <
class keyt,
typename hash>
144 bool modified =
false;
147 delta_viewt delta_view;
150 for(
auto &item : delta_view)
157 out_map.
replace(item.k, v_new.object);
An abstract version of a program environment.
abstract_objectt is the top of the inheritance heirarchy of objects used to represent individual vari...
std::set< abstract_object_pointert > abstract_object_visitedt
sharing_ptrt< class abstract_objectt > abstract_object_pointert
Statistics gathering for the variable senstivity domain.
abstract_aggregate_objectt(const typet &type, bool tp, bool bttm)
virtual abstract_object_pointert read_component(const abstract_environmentt &environment, const exprt &expr, const namespacet &ns) const
static bool merge_shared_maps(const sharing_mapt< keyt, abstract_object_pointert, false, hash > &map1, const sharing_mapt< keyt, abstract_object_pointert, false, hash > &map2, sharing_mapt< keyt, abstract_object_pointert, false, hash > &out_map, const widen_modet &widen_mode)
void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns) const override
abstract_aggregate_objectt(const exprt &expr, const abstract_environmentt &environment, const namespacet &ns)
virtual void statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns) const =0
abstract_object_pointert write(abstract_environmentt &environment, const namespacet &ns, const std::stack< exprt > &stack, const exprt &specifier, const abstract_object_pointert &value, bool merging_write) const override
A helper function to evaluate writing to a component of an abstract object.
abstract_object_pointert expression_transform(const exprt &expr, const std::vector< abstract_object_pointert > &operands, const abstract_environmentt &environment, const namespacet &ns) const override
Interface for transforms.
virtual abstract_object_pointert write_component(abstract_environmentt &environment, const namespacet &ns, const std::stack< exprt > &stack, const exprt &expr, const abstract_object_pointert &value, bool merging_write) const
virtual abstract_object_pointert abstract_object_factory(const typet &type, const namespacet &ns, bool top, bool bottom) const
Look at the configuration for the sensitivity and create an appropriate abstract_object.
virtual bool is_top() const
Find out if the abstract object is top.
virtual bool is_bottom() const
Find out if the abstract object is bottom.
virtual abstract_object_pointert expression_transform(const exprt &expr, const std::vector< abstract_object_pointert > &operands, const abstract_environmentt &environment, const namespacet &ns) const
Interface for transforms.
static combine_result merge(const abstract_object_pointert &op1, const abstract_object_pointert &op2, const locationt &merge_location, const widen_modet &widen_mode)
virtual void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns) const
virtual const typet & type() const
Get the real type of the variable this abstract object is representing.
const typet & element_type() const
The type of the elements of the array.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
typet & type()
Return the type of the expression.
const irep_idt & id() const
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
A map implemented as a tree where subtrees can be shared between different maps.
void replace(const key_type &k, valueU &&m)
Replace element, element must exist in map.
void get_delta_view(const sharing_mapt &other, delta_viewt &delta_view, const bool only_common=true) const
Get a delta view of the elements in the map.
The type of an expression, extends irept.
#define PRECONDITION(CONDITION)
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
std::size_t number_of_structs
std::size_t number_of_arrays
static typet read_type(const typet &, const typet &object_type)
static void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns)
static const irep_idt TYPE_ID()
static const irep_idt ACCESS_EXPR_ID()
static const typet & read_type(const typet &expr_type, const typet &)
static void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns)
static const irep_idt & TYPE_ID()
static const irep_idt & ACCESS_EXPR_ID()
static typet read_type(const typet &, const typet &object_type)
static const irep_idt TYPE_ID()
static void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns)
static const irep_idt ACCESS_EXPR_ID()