43 error() <<
"unknown parse-tree element: " << item.
id() <<
eom;
66 const exprt &this_expr=
70 assert(this_expr.
type().
id()==ID_pointer);
73 assert(t.id()==ID_struct);
90 const std::string &module,
103 const unsigned errors_before=
127 catch(
const std::string &e)
168 assert(symbol.
type.
id()!=ID_code);
177 assert(symbol.
value.
id()==ID_code);
207 init_symbol.
mode=ID_cpp;
210 init_symbol.
type.
add(ID_return_type)=
typet(ID_constructor);
229 const symbolt &symbol=named_symbol.second;
231 if(symbol.
value.
id()==
"cpp_not_typechecked" &&
234 assert(symbol.
type.
id()==ID_code);
237 if(symbol.base_name==
"operator=")
242 lookup(symbol.type.get(ID_C_member_name)), declarator);
243 symbol.value.swap(declarator.
value());
247 else if(symbol.value.operands().size()==1)
250 symbol.value.
swap(tmp);
263 if(named_symbol.second.value.id()==
"cpp_not_typechecked")
274 symbol_tablet::symbolst::const_iterator cur_it = it;
277 const symbolt &symbol=cur_it->second;
285 else if(symbol.
type.
id()==ID_struct ||
286 symbol.
type.
id()==ID_union)
296 data_members.reserve(components.size());
300 (struct_union_type.
add(ID_methods).
get_sub());
302 function_members.reserve(components.size());
304 for(
const auto &compo_it : components)
306 if(compo_it.get_bool(ID_is_static) ||
307 compo_it.get_bool(ID_is_type))
311 else if(compo_it.type().id()==ID_code)
313 function_members.push_back(compo_it);
317 data_members.push_back(compo_it);
321 struct_union_type.
components().swap(data_members);
The type of an expression.
irep_idt name
The unique identifier.
void convert_function(symbolt &symbol)
const std::string & id2string(const irep_idt &d)
const symbol_tablet & get_symbol_table() const
irep_idt mode
Language mode.
bool is_static_assert() const
void copy_to_operands(const exprt &expr)
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
std::vector< componentt > componentst
void move_to_operands(exprt &expr)
exprt value
Initial value of symbol.
const componentst & components() const
void static_and_dynamic_initialization()
Initialization of static objects:
irep_idt module
Name of module the symbol belongs to.
bool cpp_typecheck(cpp_parse_treet &cpp_parse_tree, symbol_tablet &symbol_table, const std::string &module, message_handlert &message_handler)
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
C++ Language Type Checking.
void convert(cpp_linkage_spect &)
bool builtin_factory(const irep_idt &identifier, symbol_tablet &symbol_table, message_handlert &mh)
Check whether given identifier is a compiler built-in.
symbol_tablet & symbol_table
virtual symbolt * get_writeable(const irep_idt &name) override
Find a symbol in the symbol table for read-write access.
void default_assignop_value(const symbolt &symbol, cpp_declaratort &declarator)
Generate code for the implicit default assignment operator.
bool is_declaration() const
bool is_namespace_spec() const
Expression Initialization.
const irep_idt & id() const
cpp_namespace_spect & get_namespace_spec()
virtual void typecheck()
typechecking main method
std::string expr2cpp(const exprt &expr, const namespacet &ns)
source_locationt source_location
bool cpp_is_pod(const typet &type) const
cpp_parse_treet & cpp_parse_tree
cpp_static_assertt & get_static_assert()
C++ Language Type Checking.
const typet & follow(const typet &) const
const struct_typet & to_struct_type(const typet &type)
Cast a generic typet to a struct_typet.
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
std::vector< exprt > operandst
typet type
Type of symbol.
source_locationt location
Source code location of definition of symbol.
cpp_declarationt & to_cpp_declaration(irept &irep)
message_handlert & get_message_handler()
Base type of C structs and unions, and C++ classes.
bool builtin_factory(const irep_idt &)
void do_not_typechecked()
irep_idt current_linkage_spec
std::string type2cpp(const typet &type, const namespacet &ns)
Base class for all expressions.
irep_idt base_name
Base (non-scoped) name.
cpp_scopet & current_scope()
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a generic typet to a struct_union_typet.
const source_locationt & source_location() const
irept & add(const irep_namet &name)
virtual std::string to_string(const typet &type)
cpp_linkage_spect & get_linkage_spec()
const struct_typet & this_struct_type()
dynamic_initializationst dynamic_initializations
bool disable_access_control
source_locationt & add_source_location()
goto_programt coverage_criteriont message_handlert & message_handler
A statement in a programming language.
exprt cpp_symbol_expr(const symbolt &symbol)
const typet & subtype() const
const symbolt * lookup(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See namespace_baset::lookup().
codet cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.
bool is_linkage_spec() const