Go to the documentation of this file.
46 error() <<
"failed to produce integer for enum constant" <<
eom;
52 value_expr.
type()=enum_tag_type;
58 symbol.
value=value_expr;
63 symbol.
type=enum_tag_type;
73 error() <<
"cpp_typecheckt::typecheck_enum_body: "
74 <<
"symbol_table.move() failed" <<
eom;
91 qualifiers.
read(type);
94 bool anonymous=!enum_type.
has_tag();
119 tag_scope(base_name, has_body, tag_only_declaration);
126 symbol_tablet::symbolst::const_iterator previous_symbol=
133 const symbolt &symbol=previous_symbol->second;
138 error() <<
"error: enum symbol '" << base_name
139 <<
"' declared previously\n"
140 <<
"location of previous definition: " << symbol.
location <<
eom;
148 std::string pretty_name=
165 error() <<
"underlying type must be integral" <<
eom;
172 symbol.
name=symbol_name;
188 error() <<
"cpp_typecheckt::typecheck_enum_type: "
189 <<
"symbol_table.move() failed" <<
eom;
211 error() <<
"use of enum '" << base_name <<
"' without previous declaration"
218 qualifiers.
write(type);
virtual void read(const typet &src) override
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
cpp_scopet & tag_scope(const irep_idt &_base_name, bool has_body, bool tag_only_declaration)
const cpp_enum_typet & to_cpp_enum_type(const irept &irep)
The type of an expression, extends irept.
typet type
Type of symbol.
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
const type_with_subtypet & to_type_with_subtype(const typet &type)
Base class for all expressions.
irep_idt base_name
Base (non-scoped) name.
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
struct configt::ansi_ct ansi_c
cpp_idt & put_into_scope(const symbolt &symbol, cpp_scopet &scope, bool is_friend=false)
irep_idt pretty_name
Language-specific display name.
virtual void make_constant(exprt &expr)
bool get_tag_only_declaration() const
typet & type()
Return the type of the expression.
void typecheck_type(typet &) override
irep_idt generate_anon_tag() const
irep_idt mode
Language mode.
signedbv_typet signed_int_type()
const std::string & id2string(const irep_idt &d)
cpp_scopet & current_scope()
source_locationt source_location
const source_locationt & source_location() const
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
virtual void write(typet &src) const override
symbol_tablet & symbol_table
virtual bool move(symbolt &symbol, symbolt *&new_symbol) override
Move a symbol into the symbol table.
void typecheck_expr(exprt &) override
exprt value
Initial value of symbol.
irept & add(const irep_idt &name)
C enum tag type, i.e., c_enum_typet with an identifier.
void typecheck_enum_body(symbolt &symbol)
cpp_scopet & resolve_scope(const cpp_namet &cpp_name, irep_idt &base_name, cpp_template_args_non_tct &template_args)
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 cpp_namet & tag() const
void implicit_typecast(exprt &expr, const typet &type) override
void typecheck_enum_type(typet &type)
const typet & underlying_type() const
irep_idt module
Name of module the symbol belongs to.
irep_idt name
The unique identifier.
bool get_bool(const irep_idt &name) const
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.