28 const std::string &_module,
31 cpp_parse_tree(_cpp_parse_tree),
34 disable_access_control(false),
35 support_float16_type(false)
40 gcc_version.
get(
"gcc");
54 const std::string &_module,
57 cpp_parse_tree(_cpp_parse_tree),
60 disable_access_control(false),
61 support_float16_type(false)
66 gcc_version.
get(
"gcc");
91 error() <<
"unknown parse-tree element: " << item.
id() <<
eom;
116 const exprt &this_expr=
140 const std::string &module,
144 cpp_parse_tree, symbol_table, module, message_handler);
153 const unsigned errors_before=
177 catch(
const std::string &e)
184 cpp_typecheck.error().source_location = e.get_source_location();
247 init_block.
add(call.value());
277 const symbolt &symbol = it->second;
280 symbol.
value.
id() == ID_cpp_not_typechecked &&
303 symbolt &writable_symbol = it.get_writeable_symbol();
313 if(it->second.value.id() == ID_cpp_not_typechecked)
314 it.get_writeable_symbol().value.make_nil();
327 const symbolt &symbol=cur_it->second;
337 else if(symbol.
type.
id()==ID_struct ||
338 symbol.
type.
id()==ID_union)
348 data_members.reserve(components.size());
352 (struct_union_type.
add(ID_methods).
get_sub());
354 function_members.reserve(components.size());
356 for(
const auto &compo_it : components)
358 if(compo_it.get_bool(ID_is_static) ||
359 compo_it.get_bool(ID_is_type))
363 else if(compo_it.type().id()==ID_code)
365 function_members.push_back(compo_it);
369 data_members.push_back(compo_it);
373 struct_union_type.
components().swap(data_members);
386 if(expr.
id() == ID_cpp_name || expr.
id() == ID_cpp_declaration)
bool builtin_factory(const irep_idt &identifier, bool support_float16_type, symbol_table_baset &symbol_table, message_handlert &mh)
Check whether given identifier is a compiler built-in.
symbol_table_baset & symbol_table
A codet representing sequential composition of program statements.
void add(const codet &code)
struct configt::ansi_ct ansi_c
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
std::optional< codet > cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
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.
bool support_float16_type
cpp_typecheckt(cpp_parse_treet &_cpp_parse_tree, symbol_table_baset &_symbol_table, const std::string &_module, message_handlert &message_handler)
bool builtin_factory(const irep_idt &) override
void typecheck_method_bodies()
void typecheck() override
typechecking main method
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 is_at_least(unsigned v_major, unsigned v_minor=0, unsigned v_patchlevel=0) const
void get(const std::string &executable)
enum gcc_versiont::flavort flavor
Thrown when we can't handle something in an input source file.
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 union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
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
The symbol table base class interface.
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
virtual void erase(const symbolst::const_iterator &entry)=0
Remove a symbol from the symbol table.
virtual iteratort begin()=0
virtual iteratort end()=0
virtual std::pair< symbolt &, bool > insert(symbolt symbol)=0
Move or copy a new symbol to the symbol table.
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_table_baset &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 CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
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_union_typet & to_struct_union_type(const typet &type)
Cast a typet to a struct_union_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
preprocessort preprocessor