Go to the documentation of this file.
41 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,
94 cpp_parse_tree, symbol_table, module, message_handler);
103 const unsigned errors_before=
127 catch(
const std::string &e)
174 assert(symbol.
type.
id()!=ID_code);
197 init_block.
add(call.value());
230 const symbolt &symbol=named_symbol.second;
233 symbol.
value.
id() == ID_cpp_not_typechecked &&
236 assert(symbol.
type.
id()==ID_code);
267 if(named_symbol.second.value.id() == ID_cpp_not_typechecked)
278 symbol_tablet::symbolst::const_iterator cur_it = it;
281 const symbolt &symbol=cur_it->second;
291 else if(symbol.
type.
id()==ID_struct ||
292 symbol.
type.
id()==ID_union)
302 data_members.reserve(components.size());
306 (struct_union_type.
add(ID_methods).
get_sub());
308 function_members.reserve(components.size());
310 for(
const auto &compo_it : components)
312 if(compo_it.get_bool(ID_is_static) ||
313 compo_it.get_bool(ID_is_type))
317 else if(compo_it.type().id()==ID_code)
319 function_members.push_back(compo_it);
323 data_members.push_back(compo_it);
327 struct_union_type.
components().swap(data_members);
339 if(expr.
id() == ID_cpp_name || expr.
id() == ID_cpp_declaration)
void convert(cpp_linkage_spect &)
#define UNREACHABLE
This should be used to mark dead code.
const componentst & components() const
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
A codet representing sequential composition of program statements.
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
void convert_function(symbolt &symbol)
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
void typecheck_method_bodies()
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
The type of an expression, extends irept.
const struct_typet & this_struct_type()
cpp_declarationt & to_cpp_declaration(irept &irep)
Base type for structs and unions.
typet type
Type of symbol.
bool builtin_factory(const irep_idt &identifier, symbol_tablet &symbol_table, message_handlert &mh)
Check whether given identifier is a compiler built-in.
bool builtin_factory(const irep_idt &)
void default_assignop_value(const symbolt &symbol, cpp_declaratort &declarator)
Generate code for the implicit default assignment operator.
irep_idt current_linkage_spec
Base class for all expressions.
std::vector< componentt > componentst
optionalt< codet > cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
irep_idt base_name
Base (non-scoped) name.
Thrown when we can't handle something in an input source file.
std::string expr2cpp(const exprt &expr, const namespacet &ns)
void static_and_dynamic_initialization()
Initialization of static objects:
bool contains_cpp_name(const exprt &)
const source_locationt & get_source_location() const
const source_locationt & source_location() const
bool cpp_typecheck(cpp_parse_treet &cpp_parse_tree, symbol_tablet &symbol_table, const std::string &module, message_handlert &message_handler)
const irep_idt & get(const irep_idt &name) const
cpp_linkage_spect & get_linkage_spec()
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
bool cpp_is_pod(const typet &type) const
const codet & to_code(const exprt &expr)
typet & type()
Return the type of the expression.
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
static std::unordered_set< irep_idt > init_symbol(const symbolt &sym, code_blockt &code_block, symbol_table_baset &symbol_table, const source_locationt &source_location, bool assume_init_pointers_not_null, const java_object_factory_parameterst &object_factory_parameters, const select_pointer_typet &pointer_type_selector, bool string_refinement_enabled, message_handlert &message_handler)
bool is_linkage_spec() const
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
const std::string & id2string(const irep_idt &d)
cpp_scopet & current_scope()
source_locationt source_location
std::string type2cpp(const typet &type, const namespacet &ns)
symbol_exprt cpp_symbol_expr(const symbolt &symbol)
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.
symbol_tablet & symbol_table
std::unordered_set< irep_idt > deferred_typechecking
const irep_idt & id() const
cpp_parse_treet & cpp_parse_tree
std::vector< exprt > operandst
void add(const codet &code)
bool is_static_assert() const
exprt value
Initial value of symbol.
message_handlert & get_message_handler()
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
Structure type, corresponds to C style structs.
irept & add(const irep_idt &name)
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
source_locationt location
Source code location of definition of symbol.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
const typet & base_type() const
The type of the data what we point to.
void do_not_typechecked()
bool is_namespace_spec() const
const std::string & get_reason() const
cpp_static_assertt & get_static_assert()
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
std::string to_string(const typet &) override
source_locationt & add_source_location()
cpp_namespace_spect & get_namespace_spec()
dynamic_initializationst dynamic_initializations
bool disable_access_control
irep_idt name
The unique identifier.
bool get_bool(const irep_idt &name) const
std::size_t get_message_count(unsigned level) const
void typecheck() override
typechecking main method
bool is_declaration() const