CBMC
c_nondet_symbol_factory.h
Go to the documentation of this file.
1 /*******************************************************************\
2 
3 Module: C Nondet Symbol Factory
4 
5 Author: Diffblue Ltd.
6 
7 \*******************************************************************/
8 
11 
12 #ifndef CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H
13 #define CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H
14 
15 #include <set>
16 
18 
19 #include <util/symbol_table.h>
20 
22 
24 {
29 
31 
33 
34 public:
35  typedef std::set<irep_idt> recursion_sett;
36 
38  symbol_tablet &_symbol_table,
39  const source_locationt &loc,
40  const irep_idt &name_prefix,
42  const lifetimet lifetime)
43  : symbol_table(_symbol_table),
44  loc(loc),
45  ns(_symbol_table),
47  allocate_objects(ID_C, loc, name_prefix, symbol_table),
49  {
50  }
51 
52  void gen_nondet_init(
53  code_blockt &assignments,
54  const exprt &expr,
55  const std::size_t depth = 0,
56  recursion_sett recursion_set = recursion_sett(),
57  const bool assign_const = true);
58 
59  void add_created_symbol(const symbolt &symbol)
60  {
62  }
63 
65  {
67  }
68 
70  {
72  }
73 
74 private:
82  code_blockt &assignments,
83  const exprt &expr,
84  std::size_t depth,
85  const recursion_sett &recursion_set);
86 };
87 
89  code_blockt &init_code,
90  symbol_tablet &symbol_table,
91  const irep_idt base_name,
92  const typet &type,
93  const source_locationt &,
94  const c_object_factory_parameterst &object_factory_parameters,
95  const lifetimet lifetime);
96 
97 #endif // CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H
dstringt
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:36
code_blockt
A codet representing sequential composition of program statements.
Definition: std_code.h:129
symbol_tablet
The symbol table.
Definition: symbol_table.h:13
typet
The type of an expression, extends irept.
Definition: type.h:28
symbol_factoryt::object_factory_params
const c_object_factory_parameterst & object_factory_params
Definition: c_nondet_symbol_factory.h:28
exprt
Base class for all expressions.
Definition: expr.h:55
symbol_factoryt::gen_nondet_array_init
void gen_nondet_array_init(code_blockt &assignments, const exprt &expr, std::size_t depth, const recursion_sett &recursion_set)
Generate initialisation code for each array element.
Definition: c_nondet_symbol_factory.cpp:166
symbol_exprt
Expression to hold a symbol (variable)
Definition: std_expr.h:112
symbol_factoryt::symbol_factoryt
symbol_factoryt(symbol_tablet &_symbol_table, const source_locationt &loc, const irep_idt &name_prefix, const c_object_factory_parameterst &object_factory_params, const lifetimet lifetime)
Definition: c_nondet_symbol_factory.h:37
c_nondet_symbol_factory
symbol_exprt c_nondet_symbol_factory(code_blockt &init_code, symbol_tablet &symbol_table, const irep_idt base_name, const typet &type, const source_locationt &, const c_object_factory_parameterst &object_factory_parameters, const lifetimet lifetime)
Creates a symbol and generates code so that it can vary over all possible values for its type.
Definition: c_nondet_symbol_factory.cpp:202
symbol_factoryt::ns
namespacet ns
Definition: c_nondet_symbol_factory.h:27
namespacet
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:90
allocate_objectst::add_created_symbol
void add_created_symbol(const symbolt &symbol)
Add a pointer to a symbol to the list of pointers to symbols created so far.
Definition: allocate_objects.cpp:221
c_object_factory_parameterst
Definition: c_object_factory_parameters.h:14
symbol_factoryt::add_created_symbol
void add_created_symbol(const symbolt &symbol)
Definition: c_nondet_symbol_factory.h:59
allocate_objectst::declare_created_symbols
void declare_created_symbols(code_blockt &init_code)
Adds declarations for all non-static symbols created.
Definition: allocate_objects.cpp:229
lifetimet
lifetimet
Selects the kind of objects allocated.
Definition: allocate_objects.h:16
source_locationt
Definition: source_location.h:18
symbol_factoryt::gen_nondet_init
void gen_nondet_init(code_blockt &assignments, const exprt &expr, const std::size_t depth=0, recursion_sett recursion_set=recursion_sett(), const bool assign_const=true)
Creates a nondet for expr, including calling itself recursively to make appropriate symbols to point ...
Definition: c_nondet_symbol_factory.cpp:36
symbol_factoryt::loc
const source_locationt & loc
Definition: c_nondet_symbol_factory.h:26
symbolt
Symbol table entry.
Definition: symbol.h:27
symbol_factoryt::allocate_objects
allocate_objectst allocate_objects
Definition: c_nondet_symbol_factory.h:30
symbol_factoryt::lifetime
const lifetimet lifetime
Definition: c_nondet_symbol_factory.h:32
symbol_factoryt::symbol_table
symbol_tablet & symbol_table
Definition: c_nondet_symbol_factory.h:25
allocate_objectst
Definition: allocate_objects.h:26
allocate_objectst::mark_created_symbols_as_input
void mark_created_symbols_as_input(code_blockt &init_code)
Adds code to mark the created symbols as input.
Definition: allocate_objects.cpp:248
symbol_factoryt
Definition: c_nondet_symbol_factory.h:23
symbol_factoryt::recursion_sett
std::set< irep_idt > recursion_sett
Definition: c_nondet_symbol_factory.h:35
symbol_table.h
Author: Diffblue Ltd.
symbol_factoryt::mark_created_symbols_as_input
void mark_created_symbols_as_input(code_blockt &init_code)
Definition: c_nondet_symbol_factory.h:69
allocate_objects.h
symbol_factoryt::declare_created_symbols
void declare_created_symbols(code_blockt &init_code)
Definition: c_nondet_symbol_factory.h:64