Go to the documentation of this file.
34 assert(symbol.
type.
id()==ID_struct ||
35 symbol.
type.
id()==ID_union);
39 decl.
type().
id(ID_function_type);
47 dtor.
add(ID_storage_spec).
id(ID_cpp_storage_spec);
54 assert(symbol.
type.
id()==ID_struct ||
55 symbol.
type.
id()==ID_union);
69 for(
const auto &c : components)
71 if(c.get_bool(ID_is_vtptr))
73 const cpp_namet cppname(c.get_base_name());
75 const symbolt &virtual_table_symbol_type =
84 assert(address.
type() == c.type());
88 exprt ptrmember(ID_ptrmember);
89 ptrmember.
set(ID_component_name, c.get_name());
90 ptrmember.
operands().push_back(this_expr);
99 for(struct_union_typet::componentst::const_reverse_iterator
100 cit=components.rbegin();
101 cit!=components.rend();
104 const typet &type=cit->type();
106 if(cit->get_bool(ID_from_base) ||
107 cit->get_bool(ID_is_type) ||
108 cit->get_bool(ID_is_static) ||
109 type.
id()==ID_code ||
114 const cpp_namet cppname(cit->get_base_name(), source_location);
116 exprt member(ID_ptrmember, type);
117 member.
set(ID_component_cpp_name, cppname);
118 member.
operands().push_back(this_expr);
126 if(dtor_code.has_value())
127 block.
add(dtor_code.value());
130 if(symbol.
type.
id() == ID_union)
131 return std::move(block);
136 for(class_typet::basest::const_reverse_iterator bit = bases.rbegin();
140 DATA_INVARIANT(bit->id() == ID_base,
"base class expression expected");
151 if(dtor_code.has_value())
152 block.
add(dtor_code.value());
155 return std::move(block);
const componentst & components() const
A codet representing sequential composition of program statements.
void set_function(const irep_idt &function)
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
The type of an expression, extends irept.
typet type
Type of symbol.
Operator to dereference a pointer.
Base class for all expressions.
std::vector< componentt > componentst
irep_idt base_name
Base (non-scoped) name.
codet dtor(const symbolt &symb, const symbol_exprt &this_expr)
produces destructor code for a class object
Expression to hold a symbol (variable)
const irep_idt & get(const irep_idt &name) const
void default_dtor(const symbolt &symb, cpp_declarationt &dtor)
Note:
bool cpp_is_pod(const typet &type) const
typet & type()
Return the type of the expression.
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
static void make_already_typechecked(exprt &expr)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const std::string & id2string(const irep_idt &d)
void set(const irep_idt &name, const irep_idt &value)
const source_locationt & source_location() const
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const basest & bases() const
Get the collection of base classes/structs.
A codet representing an assignment in the program.
const irep_idt & id() const
void add(const codet &code)
source_locationt & add_source_location()
bool find_dtor(const symbolt &symbol) const
bool is_reference(const typet &type)
Returns true if the type is a reference.
irept & add(const irep_idt &name)
source_locationt location
Source code location of definition of symbol.
const typet & base_type() const
The type of the data what we point to.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
Operator to return the address of an object.
source_locationt & add_source_location()
optionalt< codet > cpp_destructor(const source_locationt &source_location, const exprt &object)
bool disable_access_control
irep_idt name
The unique identifier.
Data structure for representing an arbitrary statement in a program.