Go to the documentation of this file.
9 #ifndef CPROVER_GOTO_HARNESS_RECURSIVE_INITIALIZATION_H
10 #define CPROVER_GOTO_HARNESS_RECURSIVE_INITIALIZATION_H
14 #include <unordered_set>
25 #define GOTO_HARNESS_PREFIX "__GOTO_HARNESS"
56 const std::string &option,
57 const std::list<std::string> &values);
147 const std::string &symbol_name,
148 const exprt &initial_value)
const;
165 const std::string &symbol_name,
166 const typet &type)
const;
180 const std::string ¶m_name,
181 const typet ¶m_type);
202 const exprt &depth_symbol,
206 const bool is_nullable);
276 const std::vector<irep_idt> &selection_spec);
279 #endif // CPROVER_GOTO_HARNESS_RECURSIVE_INITIALIZATION_H
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
std::set< irep_idt > pointers_to_treat_as_cstrings
std::string array_name(const namespacet &ns, const exprt &expr)
A codet representing sequential composition of program statements.
symbol_exprt get_fresh_local_typed_symexpr(const std::string &symbol_name, const typet &type) const
Construct a new local symbol of type type initialised to init_value.
irep_idt min_depth_var_name
code_blockt build_array_constructor(const exprt &depth, const symbol_exprt &result)
Constructor for arrays: simply iterates over elements and initialise each one.
bool operator==(const constructor_keyt &other) const
symbol_exprt get_symbol_expr(const irep_idt &symbol_name) const
Recover the symbol expression from symbol table.
The type of an expression, extends irept.
irep_idt build_constructor(const exprt &expr)
Check if a constructor for the type of expr already exists and create it if not.
void initialize_selected_member(const exprt &lhs, const exprt &depth, code_blockt &body, const std::vector< irep_idt > &selection_spec)
Select the specified struct-member to be non-deterministically initialized.
typet type
Type of symbol.
Class for generating initialisation code for compound structures.
symbol_exprt get_malloc_function()
Get the malloc function as symbol exprt, and inserts it into the goto-model if it doesn't exist alrea...
optionalt< irep_idt > get_associated_size_variable(const irep_idt &array_name) const
symbol_exprt get_fresh_local_symexpr(const std::string &symbol_name) const
Construct a new local symbol of type int initialised to 0.
std::map< constructor_keyt, irep_idt > type_constructor_namest
std::map< irep_idt, irep_idt > array_name_to_associated_array_size_variable
Base class for all expressions.
std::vector< std::vector< irep_idt > > selection_specs
Expression to hold a symbol (variable)
void free_cluster_origins(code_blockt &body)
bool is_array_size_parameter(const irep_idt &cmdline_arg) const
void initialize(const exprt &lhs, const exprt &depth, code_blockt &body)
Generate initialisation code for lhs into body.
optionalt< equal_cluster_idt > find_equal_cluster(const irep_idt &name) const
std::set< irep_idt > recursion_sett
code_blockt build_function_pointer_constructor(const symbol_exprt &result, bool is_nullable)
Constructor for function pointers.
std::set< irep_idt > pointers_to_treat_as_arrays
bool should_be_treated_as_array(const irep_idt &pointer_name) const
bool needs_freeing(const exprt &expr) const
std::size_t max_nondet_tree_depth
symbolt & get_fresh_param_symbol(const std::string ¶m_name, const typet ¶m_type)
Construct a new parameter symbol of type param_type.
std::size_t max_dynamic_array_size
static symbolt result_symbol(const irep_idt &identifier, const typet &type, const source_locationt &source_location, symbol_tablet &symbol_table)
bool has_prefix(const std::string &s, const std::string &prefix)
code_blockt build_pointer_constructor(const exprt &depth, const symbol_exprt &result)
Generic constructor for all pointers: only builds one pointee (not an array) but may recourse in case...
bool arguments_may_be_equal
const std::string & id2string(const irep_idt &d)
std::unordered_set< irep_idt > potential_null_function_pointers
symbol_exprt get_fresh_global_symexpr(const std::string &symbol_name) const
Construct a new global symbol of type int initialised to 0.
type_constructor_namest type_constructor_names
code_blockt build_dynamic_array_constructor(const exprt &depth, const symbol_exprt &result, const exprt &size, const optionalt< irep_idt > &lhs_name)
Constructor for dynamic arrays: allocate memory for n elements (n is random but bounded) and initiali...
const irep_idt & id() const
recursive_initializationt(recursive_initialization_configt initialization_config, goto_modelt &goto_model)
#define GOTO_HARNESS_PREFIX
const symbolt & get_fresh_fun_symbol(const std::string &fun_name, const typet &fun_type)
Construct a new function symbol of type fun_type.
irep_idt get_fresh_global_name(const std::string &symbol_name, const exprt &initial_value) const
Construct a new global symbol of type int and set it's value to initial_value.
nonstd::optional< T > optionalt
std::vector< optionalt< exprt > > common_arguments_origins
bool handle_option(const std::string &option, const std::list< std::string > &values)
Parse the options specific for recursive initialisation.
code_blockt build_constructor_body(const exprt &depth_symbol, const symbol_exprt &result_symbol, const optionalt< exprt > &size_symbol, const optionalt< irep_idt > &lhs_name, const bool is_nullable)
Case analysis for which constructor should be used.
void free_if_possible(const exprt &expr, code_blockt &body)
bool operator<(const constructor_keyt &other) const
std::set< irep_idt > variables_that_hold_array_sizes
bool should_be_treated_as_cstring(const irep_idt &pointer_name) const
std::string type2id(const typet &type) const
Simple pretty-printer for typet.
std::size_t min_dynamic_array_size
symbol_exprt get_free_function()
Get the free function as symbol expression, and inserts it into the goto-model if it doesn't exist al...
std::size_t min_null_tree_depth
std::size_t equal_cluster_idt
code_blockt build_nondet_constructor(const symbol_exprt &result) const
Default constructor: assigns non-deterministic value of the right type.
std::string to_string() const
static bool is_initialization_allowed(const symbolt &symbol)
const recursive_initialization_configt initialization_config
irep_idt name
The unique identifier.
irep_idt max_depth_var_name
bool get_bool(const irep_idt &name) const
std::vector< std::set< irep_idt > > pointers_to_treat_equal
code_blockt build_struct_constructor(const exprt &depth, const symbol_exprt &result)
Constructor for structures: simply iterates over members and initialise each one.