Go to the documentation of this file.
32 assert(symbol.
type.
id()==ID_struct ||
33 symbol.
type.
id()==ID_union);
37 decl.
type().
id(ID_function_type);
42 decl.
value().
set(ID_statement, ID_block);
47 dtor.
add(ID_storage_spec).
id(ID_cpp_storage_spec);
56 assert(symbol.
type.
id()==ID_struct ||
57 symbol.
type.
id()==ID_union);
71 for(
const auto &c : components)
73 if(c.get_bool(ID_is_vtptr))
75 const cpp_namet cppname(c.get_base_name());
77 const symbolt &virtual_table_symbol_type =
78 lookup(c.type().subtype().get(ID_identifier));
86 assert(address.
type() == c.type());
90 exprt ptrmember(ID_ptrmember);
91 ptrmember.
set(ID_component_name, c.get_name());
101 for(struct_union_typet::componentst::const_reverse_iterator
102 cit=components.rbegin();
103 cit!=components.rend();
106 const typet &type=cit->type();
108 if(cit->get_bool(ID_from_base) ||
109 cit->get_bool(ID_is_type) ||
110 cit->get_bool(ID_is_static) ||
111 type.
id()==ID_code ||
116 const cpp_namet cppname(cit->get_base_name(), source_location);
118 exprt member(ID_ptrmember, type);
119 member.
set(ID_component_cpp_name, cppname);
129 if(dtor_code.has_value())
130 block.
add(dtor_code.value());
133 if(symbol.
type.
id() == ID_union)
134 return std::move(block);
139 for(class_typet::basest::const_reverse_iterator bit = bases.rbegin();
143 DATA_INVARIANT(bit->id() == ID_base,
"base class expression expected");
148 object.add_source_location() = source_location;
155 if(dtor_code.has_value())
156 block.
add(dtor_code.value());
159 return std::move(block);
const componentst & components() const
A codet representing sequential composition of program statements.
void move_to_operands(exprt &expr)
Move the given argument to the end of exprt's operands.
const typet & subtype() const
void set_function(const irep_idt &function)
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
void already_typechecked(irept &irep)
The type of an expression, extends irept.
typet type
Type of symbol.
Operator to dereference a pointer.
irept & add(const irep_namet &name)
Base class for all expressions.
std::vector< componentt > componentst
irep_idt base_name
Base (non-scoped) name.
Expression to hold a symbol (variable)
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().
const std::string & id2string(const irep_idt &d)
const source_locationt & source_location() const
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
codet dtor(const symbolt &symb)
produces destructor code for a class object
const basest & bases() const
Get the collection of base classes/structs.
pointer_typet pointer_type(const typet &subtype)
const irep_idt & id() const
void add(const codet &code)
bool find_dtor(const symbolt &symbol) const
bool is_reference(const typet &type)
Returns true if the type is a reference.
source_locationt location
Source code location of definition of symbol.
void set(const irep_namet &name, const irep_idt &value)
Operator to return the address of an object.
source_locationt & add_source_location()
A codet representing an assignment in the program.
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.