CBMC
interval_abstract_value.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3  Module: analyses variable-sensitivity intervals
4 
5  Author: Diffblue Ltd.
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_ANALYSES_VARIABLE_SENSITIVITY_INTERVAL_ABSTRACT_VALUE_H
13 #define CPROVER_ANALYSES_VARIABLE_SENSITIVITY_INTERVAL_ABSTRACT_VALUE_H
14 
15 #include <iosfwd>
16 
17 #include <util/interval.h>
18 
20 
22 {
23 public:
24  interval_abstract_valuet(const typet &t, bool tp, bool bttm);
25 
27  interval_abstract_valuet(const exprt &lower, const exprt &upper);
28 
30  const exprt &e,
31  const abstract_environmentt &environment,
32  const namespacet &ns);
33 
34  template <typename... Args>
35  static std::shared_ptr<interval_abstract_valuet>
36  make_interval(Args &&... args)
37  {
38  return std::make_shared<interval_abstract_valuet>(
39  std::forward<Args>(args)...);
40  }
41 
42  ~interval_abstract_valuet() override = default;
43 
45  index_range_implementation(const namespacet &ns) const override;
46 
48 
49  exprt to_constant() const override;
51  {
52  return interval;
53  }
54 
56  constrain(const exprt &lower, const exprt &upper) const override;
57 
58  size_t internal_hash() const override;
59  bool internal_equality(const abstract_object_pointert &other) const override;
60 
61  void output(
62  std::ostream &out,
63  const class ai_baset &ai,
64  const class namespacet &ns) const override;
65 
66  void get_statistics(
67  abstract_object_statisticst &statistics,
68  abstract_object_visitedt &visited,
69  const abstract_environmentt &env,
70  const namespacet &ns) const override;
71 
72 protected:
74 
84  const abstract_value_pointert &other,
85  const widen_modet &widen_mode) const override;
86 
94  meet_with_value(const abstract_value_pointert &other) const override;
95 
96  exprt to_predicate_internal(const exprt &name) const override;
97 
98 private:
100 
101  void set_top_internal() override;
102 };
103 
104 #endif // CPROVER_ANALYSES_VARIABLE_SENSITIVITY_INTERVAL_ABSTRACT_VALUE_H
#define CLONE
std::set< abstract_object_pointert > abstract_object_visitedt
sharing_ptrt< class abstract_objectt > abstract_object_pointert
Common behaviour for abstract objects modelling values - constants, intervals, etc.
std::unique_ptr< index_range_implementationt > index_range_implementation_ptrt
sharing_ptrt< const abstract_value_objectt > abstract_value_pointert
std::unique_ptr< value_range_implementationt > value_range_implementation_ptrt
typet t
To enforce copy-on-write these are private and have read-only accessors.
sharing_ptrt< const abstract_value_objectt > abstract_value_pointert
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition: ai.h:117
Represents an interval of values.
Definition: interval.h:52
Base class for all expressions.
Definition: expr.h:56
abstract_object_pointert merge_with_value(const abstract_value_pointert &other, const widen_modet &widen_mode) const override
Merge another interval abstract object with this one.
interval_abstract_valuet(const typet &t, bool tp, bool bttm)
bool internal_equality(const abstract_object_pointert &other) const override
constant_interval_exprt to_interval() const override
void output(std::ostream &out, const class ai_baset &ai, const class namespacet &ns) const override
void get_statistics(abstract_object_statisticst &statistics, abstract_object_visitedt &visited, const abstract_environmentt &env, const namespacet &ns) const override
index_range_implementation_ptrt index_range_implementation(const namespacet &ns) const override
exprt to_constant() const override
Converts to a constant expression if possible.
abstract_value_pointert constrain(const exprt &lower, const exprt &upper) const override
exprt to_predicate_internal(const exprt &name) const override
to_predicate implementation - derived classes will override
abstract_object_pointert meet_with_value(const abstract_value_pointert &other) const override
Meet another interval abstract object with this one.
value_range_implementation_ptrt value_range_implementation() const override
size_t internal_hash() const override
static std::shared_ptr< interval_abstract_valuet > make_interval(Args &&... args)
~interval_abstract_valuet() override=default
constant_interval_exprt interval
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
The type of an expression, extends irept.
Definition: type.h:29