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);
45 dtor.
add(ID_storage_spec).
id(ID_cpp_storage_spec);
52 assert(symbol.
type.
id()==ID_struct ||
53 symbol.
type.
id()==ID_union);
67 for(
const auto &c : components)
69 if(c.get_bool(ID_is_vtptr))
71 const cpp_namet cppname(c.get_base_name());
73 const symbolt &virtual_table_symbol_type =
74 lookup(c.type().subtype().get(ID_identifier));
82 assert(address.
type() == c.type());
86 exprt ptrmember(ID_ptrmember);
87 ptrmember.
set(ID_component_name, c.get_name());
88 ptrmember.
operands().push_back(this_expr);
97 for(struct_union_typet::componentst::const_reverse_iterator
98 cit=components.rbegin();
99 cit!=components.rend();
102 const typet &type=cit->type();
104 if(cit->get_bool(ID_from_base) ||
105 cit->get_bool(ID_is_type) ||
106 cit->get_bool(ID_is_static) ||
107 type.
id()==ID_code ||
112 const cpp_namet cppname(cit->get_base_name(), source_location);
114 exprt member(ID_ptrmember, type);
115 member.
set(ID_component_cpp_name, cppname);
116 member.
operands().push_back(this_expr);
124 if(dtor_code.has_value())
125 block.
add(dtor_code.value());
128 if(symbol.
type.
id() == ID_union)
129 return std::move(block);
134 for(class_typet::basest::const_reverse_iterator bit = bases.rbegin();
138 DATA_INVARIANT(bit->id() == ID_base,
"base class expression expected");
149 if(dtor_code.has_value())
150 block.
add(dtor_code.value());
153 return std::move(block);
const componentst & components() const
A codet representing sequential composition of program statements.
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.
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.
irept & add(const irep_namet &name)
const symbolt & lookup(const irep_idt &name) const
Lookup a symbol in the namespace.
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)
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.
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)
const source_locationt & source_location() const
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
const basest & bases() const
Get the collection of base classes/structs.
const irep_idt & id() const
void add(const codet &code)
source_locationt & add_source_location()
C++ Language Type Checking.
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)
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()
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.