36 const exprt &target_expr,
37 const typet &allocate_type,
45 assignments, target_expr, allocate_type, basename_prefix);
50 assignments, target_expr, allocate_type, basename_prefix);
74 const exprt &target_expr,
75 const typet &allocate_type,
79 assignments, target_expr, allocate_type,
false, basename_prefix);
95 const exprt &target_expr,
96 const typet &allocate_type,
100 assignments, target_expr, allocate_type,
true, basename_prefix);
110 const typet &allocate_type,
128 const exprt &target_expr,
129 const typet &allocate_type)
131 if(allocate_type.
id() == ID_empty)
138 output_code.
add(std::move(code));
162 output_code.
add(assign);
169 output_code.
add(code);
176 const exprt &target_expr,
177 const typet &allocate_type)
185 const exprt &target_expr,
186 const typet &allocate_type,
187 const bool static_lifetime,
206 assignments.
add(code);
208 if(aoe.
id() == ID_typecast)
code_frontend_assignt make_allocate_code(const symbol_exprt &lhs, const exprt &size)
Create code allocating an object of size size and assigning it to lhs
lifetimet
Selects the kind of objects allocated.
@ DYNAMIC
Allocate dynamic objects (using ALLOCATE)
@ STATIC_GLOBAL
Allocate global objects with static lifetime.
@ AUTOMATIC_LOCAL
Allocate local objects with automatic lifetime.
pointer_typet pointer_type(const typet &subtype)
Operator to return the address of an object.
void add_created_symbol(const symbolt &symbol)
Add a pointer to a symbol to the list of pointers to symbols created so far.
exprt allocate_non_dynamic_object(code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, const bool static_lifetime, const irep_idt &basename_prefix)
const irep_idt symbol_mode
std::vector< irep_idt > symbols_created
const irep_idt name_prefix
exprt allocate_object(code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, const lifetimet lifetime, const irep_idt &basename_prefix="tmp")
Allocates a new object, either by creating a local variable with automatic lifetime,...
symbol_table_baset & symbol_table
const source_locationt source_location
exprt allocate_dynamic_object_symbol(code_blockt &output_code, const exprt &target_expr, const typet &allocate_type)
Generates code for allocating a dynamic object.
exprt allocate_dynamic_object(code_blockt &output_code, const exprt &target_expr, const typet &allocate_type)
Generate the same code as allocate_dynamic_object_symbol, but return a dereference_exprt that derefer...
exprt allocate_static_global_object(code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, const irep_idt &basename_prefix="tmp")
Creates a global variable with static lifetime.
void mark_created_symbols_as_input(code_blockt &init_code)
Adds code to mark the created symbols as input.
exprt allocate_automatic_local_object(code_blockt &assignments, const exprt &target_expr, const typet &allocate_type, const irep_idt &basename_prefix="tmp")
Creates a local variable with automatic lifetime.
void declare_created_symbols(code_blockt &init_code)
Adds declarations for all non-static symbols created.
A codet representing sequential composition of program statements.
void add(const codet &code)
A codet representing an assignment in the program.
A codet representing the declaration of a local variable.
Operator to dereference a pointer.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
source_locationt & add_source_location()
const source_locationt & source_location() const
typet & type()
Return the type of the expression.
The Boolean constant false.
const irep_idt & id() const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
The null pointer constant.
An expression containing a side effect.
Expression to hold a symbol (variable)
irep_idt base_name
Base (non-scoped) name.
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
irep_idt name
The unique identifier.
static exprt conditional_cast(const exprt &expr, const typet &type)
The type of an expression, extends irept.
symbolt & get_fresh_aux_symbol(const typet &type, const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, const irep_idt &symbol_mode, const namespacet &ns, symbol_table_baset &symbol_table)
Installs a fresh-named symbol with respect to the given namespace ns with the requested name pattern ...
Fresh auxiliary symbol creation.
const std::string & id2string(const irep_idt &d)
API to expression classes for Pointers.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
std::optional< exprt > size_of_expr(const typet &type, const namespacet &ns)
exprt object_size(const exprt &pointer)
#define UNREACHABLE
This should be used to mark dead code.