CBMC
liveness_context.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3  Module: analyses variable-sensitivity liveness_contextt
4 
5  Author: Jez Higgins
6 
7 \*******************************************************************/
8 
15 #ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_LIVENESS_CONTEXT_H
16 #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_LIVENESS_CONTEXT_H
17 
19 #include <iostream>
20 #include <stack>
21 
34 {
35 public:
37  const abstract_object_pointert child,
38  const typet &type)
40  {
41  }
42 
44  const abstract_object_pointert child,
45  const typet &type,
46  bool top,
47  bool bottom)
49  {
50  }
51 
53  const abstract_object_pointert child,
54  const exprt &expr,
55  const abstract_environmentt &environment,
56  const namespacet &ns)
57  : write_location_contextt(child, expr, environment, ns)
58  {
59  }
60 
62  merge_location_context(const locationt &location) const override;
63 
64  void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns)
65  const override;
66 
67  locationt get_location() const;
68 
69 protected:
71 
73  const abstract_object_pointert &other,
74  const widen_modet &widen_mode) const override;
75 
77  const abstract_object_pointert &other) const override;
78 
80  abstract_environmentt &environment,
81  const namespacet &ns,
82  const std::stack<exprt> &stack,
83  const exprt &specifier,
84  const abstract_object_pointert &value,
85  bool merging_write) const override;
86 
87 private:
88  using liveness_context_ptrt = std::shared_ptr<const liveness_contextt>;
89 
92 
94 
96  update_location_context_internal(const locationst &locations) const override;
97 
98  bool has_location() const;
99 
100  void set_location(const locationt &location);
101 };
102 
103 #endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_LIVENESS_CONTEXT_H
liveness_contextt::reset_location_on_merge
abstract_object_pointert reset_location_on_merge(const liveness_context_ptrt &merged) const
Definition: liveness_context.cpp:96
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
liveness_contextt::set_location
void set_location(const locationt &location)
Definition: liveness_context.cpp:118
liveness_contextt::assign_location
optionalt< locationt > assign_location
Definition: liveness_context.h:93
abstract_objectt::locationt
goto_programt::const_targett locationt
Definition: abstract_object.h:220
typet
The type of an expression, extends irept.
Definition: type.h:28
liveness_contextt
General implementation of an abstract_objectt which tracks the last written locations for a given abs...
Definition: liveness_context.h:33
abstract_environmentt
Definition: abstract_environment.h:40
exprt
Base class for all expressions.
Definition: expr.h:55
write_location_context.h
CLONE
#define CLONE
Definition: abstract_object.h:41
liveness_contextt::abstract_object_merge_internal
abstract_object_pointert abstract_object_merge_internal(const abstract_object_pointert &other) const override
Helper function for abstract_objectt::abstract_object_merge to perform any additional actions after t...
Definition: liveness_context.cpp:88
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
liveness_contextt::get_location
locationt get_location() const
Definition: liveness_context.cpp:16
liveness_contextt::liveness_contextt
liveness_contextt(const abstract_object_pointert child, const typet &type)
Definition: liveness_context.h:36
liveness_contextt::update_location_context_internal
context_abstract_object_ptrt update_location_context_internal(const locationst &locations) const override
Definition: liveness_context.cpp:109
context_abstract_objectt::type
const typet & type() const override
Get the real type of the variable this abstract object is representing.
Definition: context_abstract_object.h:58
liveness_contextt::merge
abstract_object_pointert merge(const abstract_object_pointert &other, const widen_modet &widen_mode) const override
Create a new abstract object that is the result of merging this abstract object with a given abstract...
Definition: liveness_context.cpp:72
write_location_contextt
General implementation of an abstract_objectt which tracks the last written locations for a given abs...
Definition: write_location_context.h:34
context_abstract_objectt::context_abstract_object_ptrt
std::shared_ptr< context_abstract_objectt > context_abstract_object_ptrt
Definition: context_abstract_object.h:111
abstract_objectt::bottom
bool bottom
Definition: abstract_object.h:386
optionalt
nonstd::optional< T > optionalt
Definition: optional.h:35
context_abstract_objectt::locationst
std::set< locationt > locationst
Definition: context_abstract_object.h:135
liveness_contextt::liveness_context_ptrt
std::shared_ptr< const liveness_contextt > liveness_context_ptrt
Definition: liveness_context.h:88
ai_baset
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition: ai.h:118
liveness_contextt::liveness_contextt
liveness_contextt(const abstract_object_pointert child, const typet &type, bool top, bool bottom)
Definition: liveness_context.h:43
liveness_contextt::write
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.
Definition: liveness_context.cpp:37
abstract_objectt::top
bool top
Definition: abstract_object.h:387
liveness_contextt::has_location
bool has_location() const
Definition: liveness_context.cpp:11
liveness_contextt::merge_location_context
abstract_object_pointert merge_location_context(const locationt &location) const override
Update the merge location context for an abstract object.
Definition: liveness_context.cpp:145
liveness_contextt::output
void output(std::ostream &out, const class ai_baset &ai, const namespacet &ns) const override
Output a representation of the value of this abstract object.
Definition: liveness_context.cpp:131
liveness_contextt::liveness_contextt
liveness_contextt(const abstract_object_pointert child, const exprt &expr, const abstract_environmentt &environment, const namespacet &ns)
Definition: liveness_context.h:52