43 error() <<
"unknown parse-tree element: " << item.
id() <<
eom;
68 const exprt &this_expr=
72 assert(this_expr.
type().
id()==ID_pointer);
75 assert(t.id()==ID_struct);
92 const std::string &module,
105 const unsigned errors_before=
129 catch(
const std::string &e)
170 assert(symbol.
type.
id()!=ID_code);
179 assert(symbol.
value.
id()==ID_code);
209 init_symbol.
mode=ID_cpp;
212 init_symbol.
type.
add(ID_return_type)=
typet(ID_constructor);
231 const symbolt &symbol=named_symbol.second;
233 if(symbol.
value.
id()==
"cpp_not_typechecked" &&
236 assert(symbol.
type.
id()==ID_code);
239 if(symbol.base_name==
"operator=")
244 lookup(symbol.type.get(ID_C_member_name)), declarator);
245 symbol.value.swap(declarator.
value());
249 else if(symbol.value.operands().size()==1)
252 symbol.value.
swap(tmp);
265 if(named_symbol.second.value.id()==
"cpp_not_typechecked")
276 symbol_tablet::symbolst::const_iterator cur_it = it;
279 const symbolt &symbol=cur_it->second;
292 else if(symbol.
type.
id()==ID_struct ||
293 symbol.
type.
id()==ID_union)
303 data_members.reserve(components.size());
307 (struct_union_type.
add(ID_methods).
get_sub());
309 function_members.reserve(components.size());
311 for(
const auto &compo_it : components)
313 if(compo_it.get_bool(ID_is_static) ||
314 compo_it.get_bool(ID_is_type))
318 else if(compo_it.type().id()==ID_code)
320 function_members.push_back(compo_it);
324 data_members.push_back(compo_it);
328 struct_union_type.
components().swap(data_members);
340 if(expr.
id() == ID_cpp_name || expr.
id() == ID_cpp_declaration)
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
bool contains_cpp_name(const exprt &expr)
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 typecheck_method_bodies()
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()
#define forall_operands(it, expr)
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.
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
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