16 const irept &components=
33 assert(symbol.
type.
id()==ID_struct ||
34 symbol.
type.
id()==ID_union);
39 name.set(ID_C_source_location, symbol.
location);
42 decl.
name().
id(ID_cpp_name);
44 decl.
type().
id(ID_function_type);
49 decl.
value().
set(ID_statement, ID_block);
54 dtor.
add(ID_storage_spec).
id(ID_cpp_storage_spec);
63 assert(symbol.
type.
id()==ID_struct ||
64 symbol.
type.
id()==ID_union);
78 for(struct_union_typet::componentst::const_iterator
79 cit=components.begin();
80 cit!=components.end();
83 if(cit->get_bool(
"is_vtptr"))
86 name.
set(ID_identifier, cit->get(ID_base_name));
91 const symbolt &virtual_table_symbol_type =
93 cit->type().subtype().get(ID_identifier));
95 const symbolt &virtual_table_symbol_var =
101 assert(address.
type()==cit->type());
105 exprt ptrmember(ID_ptrmember);
106 ptrmember.
set(ID_component_name, cit->get(ID_name));
116 for(struct_union_typet::componentst::const_reverse_iterator
117 cit=components.rbegin();
118 cit!=components.rend();
121 const typet &type=cit->type();
123 if(cit->get_bool(ID_from_base) ||
124 cit->get_bool(ID_is_type) ||
125 cit->get_bool(ID_is_static) ||
126 type.
id()==ID_code ||
132 name.
set(ID_identifier, cit->get(ID_base_name));
133 name.
set(ID_C_source_location, source_location);
136 cppname.
get_sub().push_back(name);
138 exprt member(ID_ptrmember);
139 member.
set(ID_component_cpp_name, cppname);
153 for(irept::subt::const_reverse_iterator
158 assert(bit->id()==ID_base);
159 assert(bit->find(ID_type).id()==ID_symbol);
160 const symbolt &psymb =
lookup(bit->find(ID_type).get(ID_identifier));
162 exprt object(ID_dereference);
163 object.operands().push_back(
exprt(
"cpp-this"));
164 object.add_source_location() = source_location;
The type of an expression.
irep_idt name
The unique identifier.
void set_function(const irep_idt &function)
virtual bool lookup(const irep_idt &name, const symbolt *&symbol) const
codet dtor(const symbolt &symb)
produces destructor code for a class object
const std::string & id2string(const irep_idt &d)
std::vector< irept > subt
void move_to_sub(irept &irep)
std::vector< componentt > componentst
void move_to_operands(exprt &expr)
void already_typechecked(irept &irep)
const componentst & components() const
void default_dtor(const symbolt &symb, cpp_declarationt &dtor)
Note:
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
symbol_tablet & symbol_table
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a generic typet to a struct_union_typet.
const irep_idt & id() const
class symbol_exprt symbol_expr() const
produces a symbol_exprt for a symbol
bool cpp_is_pod(const typet &type) const
bool is_reference(const typet &type)
TO_BE_DOCUMENTED.
codet cpp_destructor(const source_locationt &source_location, const typet &type, const exprt &object)
namespacet(const symbol_tablet &_symbol_table)
Base class for tree-like data structures with sharing.
C++ Language Type Checking.
Operator to return the address of an object.
bool find_dtor(const symbolt &symbol) const
const source_locationt & source_location() const
typet type
Type of symbol.
source_locationt location
Source code location of definition of symbol.
Base class for all expressions.
irep_idt base_name
Base (non-scoped) name.
irept & add(const irep_namet &name)
source_locationt & add_source_location()
A statement in a programming language.
const typet & subtype() const
const irept & find(const irep_namet &name) const
void set(const irep_namet &name, const irep_idt &value)
#define forall_irep(it, irep)