CBMC
invariant_set_domain.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Value Set
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_ANALYSES_INVARIANT_SET_DOMAIN_H
13 #define CPROVER_ANALYSES_INVARIANT_SET_DOMAIN_H
14 
15 #include <util/threeval.h>
16 
17 #include "ai_domain.h"
18 #include "invariant_set.h"
19 
21 {
22 public:
24  value_setst &value_sets,
25  inv_object_storet &object_store,
26  const namespacet &ns)
27  : has_values(false), invariant_set(value_sets, object_store, ns)
28  {
29  }
30 
33 
34  // overloading
35 
37  {
38  bool changed=invariant_set.make_union(other.invariant_set) ||
41 
42  return changed;
43  }
44 
45  void output(
46  std::ostream &out,
47  const ai_baset &,
48  const namespacet &) const final override
49  {
50  if(has_values.is_known())
51  out << has_values.to_string() << '\n';
52  else
53  invariant_set.output(out);
54  }
55 
56  virtual void transform(
57  const irep_idt &function_from,
58  trace_ptrt trace_from,
59  const irep_idt &function_to,
60  trace_ptrt trace_to,
61  ai_baset &ai,
62  const namespacet &ns) final override;
63 
64  void make_top() final override
65  {
67  has_values=tvt(true);
68  }
69 
70  void make_bottom() final override
71  {
73  has_values=tvt(false);
74  }
75 
76  void make_entry() final override
77  {
79  has_values=tvt(true);
80  }
81 
82  bool is_top() const override final
83  {
84  return has_values.is_true();
85  }
86 
87  bool is_bottom() const override final
88  {
89  return has_values.is_false();
90  }
91 };
92 
93 #endif // CPROVER_ANALYSES_INVARIANT_SET_DOMAIN_H
Abstract Interpretation Domain.
This is the basic interface of the abstract interpreter with default implementations of the core func...
Definition: ai.h:117
The interface offered by a domain, allows code to manipulate domains without knowing their exact type...
Definition: ai_domain.h:54
ai_history_baset::trace_ptrt trace_ptrt
Definition: ai_domain.h:73
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
void output(std::ostream &out, const ai_baset &, const namespacet &) const final override
void make_top() final override
all states – the analysis doesn't use this directly (see make_entry) and domains may refuse to implem...
bool is_bottom() const override final
void make_entry() final override
Make this domain a reasonable entry-point state For most domains top is sufficient.
bool is_top() const override final
void make_bottom() final override
no states
invariant_set_domaint(value_setst &value_sets, inv_object_storet &object_store, const namespacet &ns)
virtual void transform(const irep_idt &function_from, trace_ptrt trace_from, const irep_idt &function_to, trace_ptrt trace_to, ai_baset &ai, const namespacet &ns) final override
how function calls are treated: a) there is an edge from each call site to the function head b) there...
bool merge(const invariant_set_domaint &other, trace_ptrt, trace_ptrt)
void output(std::ostream &out) const
bool make_union(const invariant_sett &other_invariants)
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
Definition: threeval.h:20
bool is_known() const
Definition: threeval.h:28
const char * to_string() const
Definition: threeval.cpp:13
bool is_false() const
Definition: threeval.h:26
bool is_true() const
Definition: threeval.h:25
static tvt unknown()
Definition: threeval.h:33
Value Set.