37 const typet &declaration_type,
44 if(declaration_type.
id()==
"cpp-cast-operator")
93 if(
scope->is_global_scope())
106 typet &method_qualifier=
146 return friend_symbol;
148 else if(!maybe_symbol)
153 <<
"member '" <<
base_name <<
"' not found in scope '"
178 if(symbol_expr.
id() != ID_type)
189 if(declarator.
find(ID_member_initializers).
is_nil())
190 declarator.
set(ID_member_initializers, ID_member_initializers);
222 const auto maybe_symbol=
231 if(declarator.
get_bool(ID_C_template_case))
240 if(symbol.
type.
id()==
"cpp-template-type")
242 const auto id_set =
scope->lookup_identifier(
259 const typet &decl_type,
262 if(symbol.
type.
id()==decl_type.
id() &&
263 decl_type.
id()==ID_code)
276 for(std::size_t i=0; i<decl_code_type.
parameters().size(); i++)
284 if(decl_parameter.
type()!=symbol_parameter.
type())
287 if(i != 0 || !symbol_code_type.
get_bool(ID_C_is_virtual))
291 <<
"symbol '" << symbol.
display_name() <<
"': parameter "
292 << (i + 1) <<
" type mismatch\n"
316 else if(symbol.
type==decl_type)
319 symbol.
type.
id() == ID_array &&
324 symbol.
type = decl_type;
330 <<
"' already declared with different type:\n"
353 if(symbol.
type.
id() == ID_code)
419 symbol_table_baset::symbolst::const_iterator c_it =
423 c_it->second.type.id()==ID_code &&
477 parameter.set_identifier(
irep_idt());
488 (
cpp_typecheck.cpp_scopes.current_scope().is_global_scope() ||
497 (!
cpp_typecheck.cpp_scopes.current_scope().is_global_scope() &&
499 (
cpp_typecheck.cpp_scopes.current_scope().is_global_scope() &&
514 <<
"cpp_typecheckt::convert_declarator: symbol_table.move() failed"
521 const auto id_set =
cpp_typecheck.cpp_scopes.current_scope().lookup(
524 for(
const auto &id_ptr : id_set)
530 if(!
id.is_class() && !
id.is_enum())
577 for(
auto it = parameters.begin(); it != parameters.end(); ++it)
579 const typet ¶meter_type = ((
exprt &)*it).type();
581 if(it!=parameters.begin())
603 if(symbol.
name==ID_main)
605 if(symbol.
type.
id()!=ID_code)
612 const typet &return_type=
620 throw "main must return int";
signedbv_typet signed_int_type()
const irep_idt & get_base_name() const
void set_base_name(const irep_idt &name)
void set_identifier(const irep_idt &identifier)
void set_inlined(bool value)
const parameterst & parameters() const
const typet & return_type() const
void handle_initializer(symbolt &symbol, cpp_declaratort &declarator)
symbolt & convert_new_symbol(const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
bool is_code_type(const typet &type) const
irep_idt get_pretty_name()
void operator_overloading_rules(const symbolt &symbol)
cpp_declarator_convertert(class cpp_typecheckt &_cpp_typecheck)
void combine_types(const source_locationt &source_location, const typet &decl_type, symbolt &symbol)
irep_idt final_identifier
void main_function_rules(const symbolt &symbol)
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
class cpp_typecheckt & cpp_typecheck
void get_final_identifier()
bool is_template_parameter
void enforce_rules(const symbolt &symbol)
irept & member_initializers()
typet merge_type(const typet &declaration_type) const
irept & method_qualifier()
bool get_is_parameter() const
const source_locationt & source_location() const
bool is_thread_local() const
cpp_scopet & resolve_scope(const cpp_namet &cpp_name, irep_idt &base_name, cpp_template_args_non_tct &template_args)
Base class for all expressions.
bool is_constant() const
Return whether the expression is a constant.
typet & type()
Return the type of the expression.
const source_locationt & source_location() const
source_locationt & add_source_location()
bool get_bool(const irep_idt &name) const
const irept & find(const irep_idt &name) const
const irep_idt & get(const irep_idt &name) const
void set(const irep_idt &name, const irep_idt &value)
const irep_idt & id() const
Structure type, corresponds to C style structs.
const basest & bases() const
Get the collection of base classes/structs.
const componentst & components() const
irep_idt base_name
Base (non-scoped) name.
irep_idt module
Name of module the symbol belongs to.
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
irep_idt pretty_name
Language-specific display name.
const irep_idt & display_name() const
Return language specific display name if present.
exprt value
Initial value of symbol.
The type of an expression, extends irept.
C++ Language Type Checking.
template_typet & to_template_type(typet &type)
std::string cpp_type2name(const typet &type)
C++ Language Type Checking.
C++ Language Type Checking.
const std::string & id2string(const irep_idt &d)
bool is_number(const typet &type)
Returns true if the type is a rational, real, integer, natural, complex, unsignedbv,...
bool is_reference(const typet &type)
Returns true if the type is a reference.
#define CHECK_RETURN(CONDITION)
#define UNREACHABLE
This should be used to mark dead code.
#define PRECONDITION(CONDITION)
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.