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 
20 
22 {
27 
29 
31 
32 public:
33  typedef std::set<irep_idt> recursion_sett;
34 
36  symbol_table_baset &_symbol_table,
37  const source_locationt &loc,
38  const irep_idt &name_prefix,
40  const lifetimet lifetime)
41  : symbol_table(_symbol_table),
42  loc(loc),
43  ns(_symbol_table),
45  allocate_objects(ID_C, loc, name_prefix, symbol_table),
47  {
48  }
49 
50  void gen_nondet_init(
51  code_blockt &assignments,
52  const exprt &expr,
53  const std::size_t depth = 0,
54  recursion_sett recursion_set = recursion_sett(),
55  const bool assign_const = true);
56 
57  void add_created_symbol(const symbolt &symbol)
58  {
60  }
61 
63  {
65  }
66 
68  {
70  }
71 
72 private:
80  code_blockt &assignments,
81  const exprt &expr,
82  std::size_t depth,
83  const recursion_sett &recursion_set);
84 };
85 
87  code_blockt &init_code,
88  symbol_table_baset &symbol_table,
89  const irep_idt base_name,
90  const typet &type,
91  const source_locationt &,
92  const c_object_factory_parameterst &object_factory_parameters,
93  const lifetimet lifetime);
94 
95 #endif // CPROVER_ANSI_C_C_NONDET_SYMBOL_FACTORY_H
lifetimet
Selects the kind of objects allocated.
symbol_exprt c_nondet_symbol_factory(code_blockt &init_code, symbol_table_baset &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.
void add_created_symbol(const symbolt &symbol)
Add a pointer to a symbol to the list of pointers to symbols created so far.
void mark_created_symbols_as_input(code_blockt &init_code)
Adds code to mark the created symbols as input.
void declare_created_symbols(code_blockt &init_code)
Adds declarations for all non-static symbols created.
A codet representing sequential composition of program statements.
Definition: std_code.h:130
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Definition: dstring.h:38
Base class for all expressions.
Definition: expr.h:56
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
Definition: namespace.h:94
Expression to hold a symbol (variable)
Definition: std_expr.h:131
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.
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 ...
allocate_objectst allocate_objects
void add_created_symbol(const symbolt &symbol)
std::set< irep_idt > recursion_sett
void mark_created_symbols_as_input(code_blockt &init_code)
const c_object_factory_parameterst & object_factory_params
symbol_table_baset & symbol_table
void declare_created_symbols(code_blockt &init_code)
const source_locationt & loc
symbol_factoryt(symbol_table_baset &_symbol_table, const source_locationt &loc, const irep_idt &name_prefix, const c_object_factory_parameterst &object_factory_params, const lifetimet lifetime)
const lifetimet lifetime
The symbol table base class interface.
Symbol table entry.
Definition: symbol.h:28
The type of an expression, extends irept.
Definition: type.h:29