CBMC
full_struct_abstract_object.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Struct abstract object
4 
5 Author: Thomas Kiley, thomas.kiley@diffblue.com
6 
7 \*******************************************************************/
8 
11 #ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_FULL_STRUCT_ABSTRACT_OBJECT_H
12 #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_FULL_STRUCT_ABSTRACT_OBJECT_H
13 
15 #include <iosfwd>
16 #include <util/sharing_map.h>
17 
19  full_struct_abstract_objectt,
20  struct_aggregate_typet>
21 {
22 public:
28 
35 
37  explicit full_struct_abstract_objectt(const typet &type);
38 
45  full_struct_abstract_objectt(const typet &type, bool top, bool bottom);
46 
52  const exprt &expr,
53  const abstract_environmentt &environment,
54  const namespacet &ns);
55 
64  void output(
65  std::ostream &out,
66  const class ai_baset &ai,
67  const class namespacet &ns) const override;
68 
78  write_location_context(const locationt &location) const override;
80  merge_location_context(const locationt &location) const override;
81 
94  visit_sub_elements(const abstract_object_visitort &visitor) const override;
95 
96  void statistics(
98  abstract_object_visitedt &visited,
99  const abstract_environmentt &env,
100  const namespacet &ns) const override;
101 
102 private:
103  // no entry means component is top
107 
118  const widen_modet &widen_mode) const;
119 
120 protected:
122 
135  const abstract_environmentt &environment,
136  const exprt &expr,
137  const namespacet &ns) const override;
138 
157  abstract_environmentt &environment,
158  const namespacet &ns,
159  const std::stack<exprt> &stack,
160  const exprt &expr,
161  const abstract_object_pointert &value,
162  bool merging_write) const override;
163 
172  bool verify() const override;
173 
183  const abstract_object_pointert &other,
184  const widen_modet &widen_mode) const override;
185 
186  exprt to_predicate_internal(const exprt &name) const override;
187 };
188 
189 #endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_FULL_STRUCT_ABSTRACT_OBJECT_H
widen_modet
widen_modet
Definition: abstract_environment.h:32
abstract_object_pointert
sharing_ptrt< class abstract_objectt > abstract_object_pointert
Definition: abstract_object.h:69
full_struct_abstract_objectt::visit_sub_elements
abstract_object_pointert visit_sub_elements(const abstract_object_visitort &visitor) const override
Apply a visitor operation to all sub elements of this abstract_object.
Definition: full_struct_abstract_object.cpp:294
abstract_objectt::locationt
goto_programt::const_targett locationt
Definition: abstract_object.h:220
sharing_mapt< irep_idt, abstract_object_pointert, false, irep_id_hash >
full_struct_abstract_objectt::constant_struct_pointert
sharing_ptrt< full_struct_abstract_objectt > constant_struct_pointert
Definition: full_struct_abstract_object.h:23
typet
The type of an expression, extends irept.
Definition: type.h:28
full_struct_abstract_objectt::map
shared_struct_mapt map
Definition: full_struct_abstract_object.h:106
full_struct_abstract_objectt::merge_constant_structs
abstract_object_pointert merge_constant_structs(constant_struct_pointert other, const widen_modet &widen_mode) const
Performs an element wise merge of the map for each struct.
Definition: full_struct_abstract_object.cpp:256
abstract_objectt::type
virtual const typet & type() const
Get the real type of the variable this abstract object is representing.
Definition: abstract_object.cpp:47
full_struct_abstract_objectt::read_component
abstract_object_pointert read_component(const abstract_environmentt &environment, const exprt &expr, const namespacet &ns) const override
A helper function to evaluate the abstract object contained within a struct.
Definition: full_struct_abstract_object.cpp:76
abstract_environmentt
Definition: abstract_environment.h:40
exprt
Base class for all expressions.
Definition: expr.h:55
sharing_ptrt
std::shared_ptr< const T > sharing_ptrt
Merge is designed to allow different abstractions to be merged gracefully.
Definition: abstract_object.h:67
full_struct_abstract_objectt::write_location_context
abstract_object_pointert write_location_context(const locationt &location) const override
Update the location context for an abstract object.
Definition: full_struct_abstract_object.cpp:282
full_struct_abstract_objectt::full_struct_abstract_objectt
full_struct_abstract_objectt(const full_struct_abstract_objectt &ao)
Explicit copy-constructor to make it clear that the shared_map used to store the values of fields is ...
Definition: full_struct_abstract_object.cpp:24
CLONE
#define CLONE
Definition: abstract_object.h:41
full_struct_abstract_objectt
Definition: full_struct_abstract_object.h:18
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
full_struct_abstract_objectt::statistics
void statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns) const override
Definition: full_struct_abstract_object.cpp:328
abstract_object_statisticst
Definition: abstract_object_statistics.h:18
full_struct_abstract_objectt::output
void output(std::ostream &out, const class ai_baset &ai, const class namespacet &ns) const override
To provide a human readable string to the out representing the current known value about this object.
Definition: full_struct_abstract_object.cpp:206
abstract_aggregate_objectt
Definition: abstract_aggregate_object.h:26
full_struct_abstract_objectt::shared_struct_mapt
sharing_mapt< irep_idt, abstract_object_pointert, false, irep_id_hash > shared_struct_mapt
Definition: full_struct_abstract_object.h:105
full_struct_abstract_objectt::merge
abstract_object_pointert merge(const abstract_object_pointert &other, const widen_modet &widen_mode) const override
To merge an abstract object into this abstract object.
Definition: full_struct_abstract_object.cpp:244
struct_aggregate_typet
Definition: abstract_aggregate_object.h:180
abstract_object_visitedt
std::set< abstract_object_pointert > abstract_object_visitedt
Definition: abstract_object.h:70
abstract_objectt::bottom
bool bottom
Definition: abstract_object.h:386
abstract_objectt::abstract_object_visitort
Pure virtual interface required of a client that can apply a copy-on-write operation to a given abstr...
Definition: abstract_object.h:345
abstract_aggregate_object.h
full_struct_abstract_objectt::merge_location_context
abstract_object_pointert merge_location_context(const locationt &location) const override
Update the merge location context for an abstract object.
Definition: full_struct_abstract_object.cpp:288
ai_baset
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition: ai.h:118
full_struct_abstract_objectt::write_component
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 override
A helper function to evaluate writing to a component of a struct.
Definition: full_struct_abstract_object.cpp:111
abstract_objectt::top
bool top
Definition: abstract_object.h:387
full_struct_abstract_objectt::to_predicate_internal
exprt to_predicate_internal(const exprt &name) const override
to_predicate implementation - derived classes will override
Definition: full_struct_abstract_object.cpp:305
full_struct_abstract_objectt::verify
bool verify() const override
Function: full_struct_abstract_objectt::verify.
Definition: full_struct_abstract_object.cpp:237
sharing_map.h
full_struct_abstract_objectt::abstract_aggregate_baset
abstract_aggregate_objectt< full_struct_abstract_objectt, struct_aggregate_typet > abstract_aggregate_baset
Definition: full_struct_abstract_object.h:27