33 assert(symbol.
type.
id()==ID_struct ||
34 symbol.
type.
id()==ID_union);
38 decl.
type().
id(ID_function_type);
46 dtor.
add(ID_storage_spec).
id(ID_cpp_storage_spec);
53 assert(symbol.
type.
id()==ID_struct ||
54 symbol.
type.
id()==ID_union);
68 for(
const auto &c : components)
70 if(c.get_bool(ID_is_vtptr))
72 const cpp_namet cppname(c.get_base_name());
74 const symbolt &virtual_table_symbol_type =
75 lookup(c.type().subtype().get(ID_identifier));
83 assert(address.
type() == c.type());
87 exprt ptrmember(ID_ptrmember);
88 ptrmember.
set(ID_component_name, c.get_name());
89 ptrmember.
operands().push_back(this_expr);
98 for(struct_union_typet::componentst::const_reverse_iterator
99 cit=components.rbegin();
100 cit!=components.rend();
103 const typet &type=cit->type();
105 if(cit->get_bool(ID_from_base) ||
106 cit->get_bool(ID_is_type) ||
107 cit->get_bool(ID_is_static) ||
108 type.
id()==ID_code ||
113 const cpp_namet cppname(cit->get_base_name(), source_location);
115 exprt member(ID_ptrmember, type);
116 member.
set(ID_component_cpp_name, cppname);
117 member.
operands().push_back(this_expr);
125 if(dtor_code.has_value())
126 block.
add(dtor_code.value());
129 if(symbol.
type.
id() == ID_union)
130 return std::move(block);
135 for(class_typet::basest::const_reverse_iterator bit = bases.rbegin();
139 DATA_INVARIANT(bit->id() == ID_base,
"base class expression expected");
150 if(dtor_code.has_value())
151 block.
add(dtor_code.value());
154 return std::move(block);
Operator to return the address of an object.
static void make_already_typechecked(exprt &expr)
A codet representing an assignment in the program.
A codet representing sequential composition of program statements.
void add(const codet &code)
Data structure for representing an arbitrary statement in a program.
optionalt< codet > cpp_destructor(const source_locationt &source_location, const exprt &object)
void default_dtor(const symbolt &symb, cpp_declarationt &dtor)
Note:
bool cpp_is_pod(const typet &type) const
codet dtor(const symbolt &symb, const symbol_exprt &this_expr)
produces destructor code for a class object
bool disable_access_control
bool find_dtor(const symbolt &symbol) const
Operator to dereference a pointer.
Base class for all expressions.
source_locationt & add_source_location()
typet & type()
Return the type of the expression.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
irept & add(const irep_namet &name)
void set(const irep_namet &name, const irep_idt &value)
const irep_idt & id() const
const symbolt & lookup(const irep_idt &name) const
Lookup a symbol in the namespace.
void set_function(const irep_idt &function)
const basest & bases() const
Get the collection of base classes/structs.
const componentst & components() const
std::vector< componentt > componentst
Expression to hold a symbol (variable)
irep_idt base_name
Base (non-scoped) name.
source_locationt location
Source code location of definition of symbol.
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
The type of an expression, extends irept.
const source_locationt & source_location() const
const typet & subtype() const
source_locationt & add_source_location()
C++ Language Type Checking.
const std::string & id2string(const irep_idt &d)
API to expression classes for Pointers.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bool is_reference(const typet &type)
Returns true if the type is a reference.
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.