18 std::set<irep_idt> bases;
19 std::set<irep_idt> vbases;
22 type.
get_bool(ID_C_class)?ID_private:ID_public;
31 exprt base_symbol_expr=
37 if(base_symbol_expr.id()!=ID_type)
40 error() <<
"expected type as struct/class base" <<
eom;
47 if(base_symbol_expr.type().id()!=ID_symbol)
50 error() <<
"expected type symbol as struct/class base" <<
eom;
57 if(base_symbol.
type.
id()==ID_incomplete_struct)
60 error() <<
"base type is incomplete" <<
eom;
63 else if(base_symbol.
type.
id()!=ID_struct)
66 error() <<
"expected struct or class as base, but got `" 71 bool virtual_base = base_it->get_bool(ID_virtual);
72 irep_idt class_access = base_it->get(ID_protection);
74 if(class_access.
empty())
75 class_access = default_class_access;
77 base_symbol_expr.id(ID_base);
78 base_symbol_expr.set(ID_access, class_access);
81 base_symbol_expr.set(ID_virtual,
true);
83 base_it->
swap(base_symbol_expr);
109 most_derived.
set(ID_base_name,
"@most_derived");
112 most_derived.
set(ID_pretty_name,
"@most_derived");
124 std::set<irep_idt> &bases,
125 std::set<irep_idt> &vbases,
130 if(is_virtual && vbases.find(from_name)!=vbases.end())
133 if(bases.find(from_name)!=bases.end())
136 error() <<
"error: non-virtual base class " << from_name
137 <<
" inherited multiple times" <<
eom;
141 bases.insert(from_name);
144 vbases.insert(from_name);
149 irep_idt sub_access=it->get(ID_access);
151 if(access==ID_private)
152 sub_access=ID_private;
153 else if(access==ID_protected && sub_access!=ID_private)
154 sub_access=ID_protected;
157 lookup(it->find(ID_type).get(ID_identifier));
159 bool is_virtual=it->get_bool(ID_virtual);
175 for(struct_typet::componentst::const_iterator
180 if(it->get_bool(ID_from_base))
184 dest_c.push_back(*it);
188 component.
set(ID_from_base,
true);
192 if(access==ID_public)
194 if(comp_access==ID_private)
197 else if(access == ID_protected)
199 if(comp_access==ID_private)
204 else if(access == ID_private)
206 if(comp_access ==
"noaccess" || comp_access == ID_private)
irep_idt name
The unique identifier.
std::vector< irept > subt
void set_name(const irep_idt &name)
cpp_namet & to_cpp_name(irept &cpp_name)
std::vector< componentt > componentst
const symbol_typet & to_symbol_type(const typet &type)
Cast a generic typet to a symbol_typet.
const componentst & components() const
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
static mstreamt & eom(mstreamt &m)
bool get_bool(const irep_namet &name) const
void add_secondary_scope(cpp_scopet &other)
const irep_idt & id() const
const source_locationt & source_location() const
void elaborate_class_template(const typet &type)
elaborate class template instances
source_locationt source_location
void set_access(const irep_idt &access)
const irep_idt & get(const irep_namet &name) const
C++ Language Type Checking.
#define Forall_irep(it, irep)
const struct_typet & to_struct_type(const typet &type)
Cast a generic typet to a struct_typet.
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
exprt resolve(const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
const source_locationt & source_location() const
typet type
Type of symbol.
const irep_idt & get_access() const
void typecheck_compound_bases(struct_typet &type)
Base class for all expressions.
cpp_scopet & current_scope()
void add_base_components(const struct_typet &from, const irep_idt &access, struct_typet &to, std::set< irep_idt > &bases, std::set< irep_idt > &vbases, bool is_virtual)
irept & add(const irep_namet &name)
virtual std::string to_string(const typet &type)
source_locationt & add_source_location()
void put_compound_into_scope(const struct_union_typet::componentt &component)
const irept & find(const irep_namet &name) const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See namespace_baset::lookup().
void set(const irep_namet &name, const irep_idt &value)
#define forall_irep(it, irep)