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)
168 assert(symbol.
type.
id()!=ID_code);
191 init_block.
add(call.value());
224 const symbolt &symbol=named_symbol.second;
227 symbol.
value.
id() == ID_cpp_not_typechecked &&
230 assert(symbol.
type.
id()==ID_code);
261 if(named_symbol.second.value.id() == ID_cpp_not_typechecked)
272 symbol_tablet::symbolst::const_iterator cur_it = it;
275 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);
333 if(expr.
id() == ID_cpp_name || expr.
id() == ID_cpp_declaration)
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
A codet representing sequential composition of program statements.
void add(const codet &code)
bool is_namespace_spec() const
const source_locationt & source_location() const
cpp_static_assertt & get_static_assert()
cpp_linkage_spect & get_linkage_spec()
bool is_static_assert() const
bool is_declaration() const
bool is_linkage_spec() const
cpp_namespace_spect & get_namespace_spec()
cpp_scopet & current_scope()
void static_and_dynamic_initialization()
Initialization of static objects:
bool contains_cpp_name(const exprt &)
void do_not_typechecked()
dynamic_initializationst dynamic_initializations
void convert_function(symbolt &symbol)
irep_idt current_linkage_spec
bool cpp_is_pod(const typet &type) const
void convert(cpp_linkage_spect &)
std::unordered_set< irep_idt > deferred_typechecking
void default_assignop_value(const symbolt &symbol, cpp_declaratort &declarator)
Generate code for the implicit default assignment operator.
optionalt< codet > cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
void typecheck_method_bodies()
void typecheck() override
typechecking main method
bool builtin_factory(const irep_idt &)
std::string to_string(const typet &) override
bool disable_access_control
const struct_typet & this_struct_type()
cpp_parse_treet & cpp_parse_tree
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
std::vector< exprt > operandst
source_locationt & add_source_location()
typet & type()
Return the type of the expression.
bool get_bool(const irep_idt &name) const
const irep_idt & get(const irep_idt &name) const
const irep_idt & id() const
irept & add(const irep_idt &name)
std::size_t get_message_count(unsigned level) const
source_locationt source_location
message_handlert & get_message_handler()
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
const symbolt & lookup(const irep_idt &name) const
Lookup a symbol in the namespace.
const symbol_table_baset & get_symbol_table() const
Return first symbol table registered with the namespace.
const typet & base_type() const
The type of the data what we point to.
Structure type, corresponds to C style structs.
Base type for structs and unions.
const componentst & components() const
std::vector< componentt > componentst
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
const symbolst & symbols
Read-only field, used to look up symbols given their names.
const symbolt & lookup_ref(const irep_idt &name) const
Find a symbol in the symbol table for read-only access.
virtual void erase(const symbolst::const_iterator &entry) override
Remove a symbol from the symbol table.
virtual std::pair< symbolt &, bool > insert(symbolt symbol) override
Author: Diffblue Ltd.
irep_idt base_name
Base (non-scoped) name.
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
exprt value
Initial value of symbol.
The type of an expression, extends irept.
cpp_declarationt & to_cpp_declaration(irept &irep)
C++ Language Type Checking.
bool cpp_typecheck(cpp_parse_treet &cpp_parse_tree, symbol_tablet &symbol_table, const std::string &module, message_handlert &message_handler)
C++ Language Type Checking.
symbol_exprt cpp_symbol_expr(const symbolt &symbol)
std::string type2cpp(const typet &type, const namespacet &ns)
std::string expr2cpp(const exprt &expr, const namespacet &ns)
const std::string & id2string(const irep_idt &d)
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)
API to expression classes for Pointers.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
#define UNREACHABLE
This should be used to mark dead code.
const codet & to_code(const exprt &expr)
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const struct_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.