46 error() <<
"failed to produce integer for enum constant" <<
eom;
52 value_expr.
type()=enum_tag_type;
58 symbol.base_name=name;
59 symbol.value=value_expr;
64 symbol.is_file_local =
true;
65 symbol.is_thread_local =
true;
71 error() <<
"cpp_typecheckt::typecheck_enum_body: "
72 <<
"symbol_table.move() failed" <<
eom;
89 qualifiers.
read(type);
92 bool anonymous=!enum_type.
has_tag();
117 tag_scope(base_name, has_body, tag_only_declaration);
124 symbol_table_baset::symbolst::const_iterator previous_symbol =
131 const symbolt &symbol=previous_symbol->second;
136 error() <<
"enum symbol '" << base_name <<
"' declared previously\n"
137 <<
"location of previous definition: " << symbol.
location <<
eom;
145 std::string pretty_name=
162 error() <<
"underlying type must be integral" <<
eom;
168 symbol.base_name=base_name;
169 symbol.value.make_nil();
172 symbol.pretty_name=pretty_name;
179 error() <<
"cpp_typecheckt::typecheck_enum_type: "
180 <<
"symbol_table.move() failed" <<
eom;
202 error() <<
"use of enum '" << base_name <<
"' without previous declaration"
209 qualifiers.
write(type);
signedbv_typet signed_int_type()
const c_enum_typet & to_c_enum_type(const typet &type)
Cast a typet to a c_enum_typet.
C enum tag type, i.e., c_enum_typet with an identifier.
const typet & underlying_type() const
virtual void write(typet &src) const
virtual void read(const typet &src)
symbol_table_baset & symbol_table
virtual void make_constant(exprt &expr)
struct configt::ansi_ct ansi_c
const cpp_namet & tag() const
irep_idt generate_anon_tag() const
bool get_tag_only_declaration() const
cpp_scopet & current_scope()
cpp_idt & put_into_scope(const symbolt &symbol, cpp_scopet &scope, bool is_friend=false)
cpp_scopet & resolve_scope(const cpp_namet &cpp_name, irep_idt &base_name, cpp_template_args_non_tct &template_args)
void typecheck_type(typet &) override
void typecheck_enum_type(typet &type)
void implicit_typecast(exprt &expr, const typet &type) override
cpp_scopet & tag_scope(const irep_idt &_base_name, bool has_body, bool tag_only_declaration)
void typecheck_expr(exprt &) override
void typecheck_enum_body(symbolt &symbol)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
typet & type()
Return the type of the expression.
bool get_bool(const irep_idt &name) const
irept & add(const irep_idt &name)
source_locationt source_location
virtual bool move(symbolt &symbol, symbolt *&new_symbol)=0
const symbolst & symbols
Read-only field, used to look up symbols given their names.
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
irep_idt name
The unique identifier.
irep_idt mode
Language mode.
Symbol table entry describing a data typeThis is a symbol generated as part of type checking.
The type of an expression, extends irept.
const source_locationt & source_location() const
C++ Language Type Checking.
const cpp_enum_typet & to_cpp_enum_type(const irept &irep)
C++ Language Type Checking.
const std::string & id2string(const irep_idt &d)
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
const constant_exprt & to_constant_expr(const exprt &expr)
Cast an exprt to a constant_exprt.
const type_with_subtypet & to_type_with_subtype(const typet &type)