cprover
value_set_dereference.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: Pointer Dereferencing
4 
5 Author: Daniel Kroening, kroening@kroening.com
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_POINTER_ANALYSIS_VALUE_SET_DEREFERENCE_H
13 #define CPROVER_POINTER_ANALYSIS_VALUE_SET_DEREFERENCE_H
14 
15 #include <unordered_set>
16 
17 #include <util/std_expr.h>
18 
19 #include "dereference_callback.h"
20 
21 class symbol_tablet;
22 class guardt;
23 class optionst;
24 class symbolt;
25 
28 {
29 public:
39  const namespacet &_ns,
40  symbol_tablet &_new_symbol_table,
41  dereference_callbackt &_dereference_callback,
42  const irep_idt _language_mode,
43  bool _exclude_null_derefs):
44  ns(_ns),
45  new_symbol_table(_new_symbol_table),
46  dereference_callback(_dereference_callback),
47  language_mode(_language_mode),
48  exclude_null_derefs(_exclude_null_derefs)
49  { }
50 
52 
53  enum class modet { READ, WRITE };
54 
63  virtual exprt dereference(
64  const exprt &pointer,
65  const guardt &guard,
66  const modet mode);
67 
68 private:
69  const namespacet &ns;
77  const bool exclude_null_derefs;
78 
80  const typet &object_type,
81  const typet &dereference_type) const;
82 
84  class valuet
85  {
86  public:
89  bool ignore;
90 
92  {
93  }
94  };
95 
96  valuet build_reference_to(const exprt &what, const exprt &pointer);
97 
98  bool memory_model(exprt &value, const typet &type, const exprt &offset);
99 
100  bool memory_model_bytes(
101  exprt &value,
102  const typet &type,
103  const exprt &offset);
104 };
105 
106 #endif // CPROVER_POINTER_ANALYSIS_VALUE_SET_DEREFERENCE_H
The type of an expression, extends irept.
Definition: type.h:27
Base class for pointer value set analysis.
Pointer Dereferencing.
virtual exprt dereference(const exprt &pointer, const guardt &guard, const modet mode)
Dereference the given pointer-expression.
dereference_callbackt & dereference_callback
Definition: guard.h:19
Symbol table entry.
Definition: symbol.h:27
The NIL expression.
Definition: std_expr.h:4461
API to expression classes.
The symbol table.
Definition: symbol_table.h:19
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:93
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
Definition: dstring.h:35
The Boolean constant false.
Definition: std_expr.h:4452
bool memory_model_bytes(exprt &value, const typet &type, const exprt &offset)
Replace value by an expression of type to_type corresponding to the value at memory address value + o...
Base class for all expressions.
Definition: expr.h:54
symbol_tablet & new_symbol_table
bool memory_model(exprt &value, const typet &type, const exprt &offset)
Replace value by an expression of type to_type corresponding to the value at memory address value + o...
value_set_dereferencet(const namespacet &_ns, symbol_tablet &_new_symbol_table, dereference_callbackt &_dereference_callback, const irep_idt _language_mode, bool _exclude_null_derefs)
valuet build_reference_to(const exprt &what, const exprt &pointer)
const irep_idt language_mode
language_mode: ID_java, ID_C or another language identifier if we know the source language in use...
Wrapper for a function dereferencing pointer expressions using a value set.
const bool exclude_null_derefs
Flag indicating whether value_set_dereferencet::dereference should disregard an apparent attempt to d...
bool dereference_type_compare(const typet &object_type, const typet &dereference_type) const
Check if the two types have matching number of ID_pointer levels, with the dereference type eventuall...
Return value for build_reference_to; see that method for documentation.