38 codet new_code(ID_decl_block);
46 declarator.
name()=cpp_name;
51 cpp_declarator_converter.
convert(declaration, declarator);
55 const typet &followed =
56 declaration.
type().
id() == ID_struct_tag
57 ?
static_cast<const typet &
>(
59 : declaration.
type().
id() == ID_union_tag
60 ?
static_cast<const typet &
>(
62 : declaration.
type().
id() == ID_c_enum_tag
63 ?
static_cast<const typet &
>(
67 error() <<
"anonymous union is not POD" <<
eom;
79 if(c.type().id() == ID_code)
83 <<
"' shall not have function members" <<
eom;
87 const irep_idt &base_name = c.get_base_name();
92 error() <<
"identifier '" << base_name <<
"' already in scope" <<
eom;
98 id.identifier = c.get_name();
99 id.class_identifier=union_symbol.
name;
114 typet &declaration_type=declaration.
type();
136 ((declaration.
type().
id() == ID_struct_tag &&
139 (declaration.
type().
id() == ID_union_tag &&
144 if(declaration.
type().
id() != ID_union_tag)
147 error() <<
"top-level declaration does not declare anything"
163 cpp_declarator_converter.
is_typedef=is_typedef;
172 error() <<
"void-typed symbol not permitted" <<
eom;
179 symbol.
type.
set(ID_C_template, declaration.
find(ID_C_template));
181 ID_C_template_arguments,
182 declaration.
find(ID_C_template_arguments));
198 if(constructor.has_value())
199 symbol.
value = constructor.value();
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const c_enum_tag_typet & to_c_enum_tag_type(const typet &type)
Cast a typet to a c_enum_tag_typet.
static void make_already_typechecked(typet &type)
symbol_table_baset & symbol_table
A codet representing the declaration of a local variable.
Data structure for representing an arbitrary statement in a program.
const declaratorst & declarators() const
const cpp_storage_spect & storage_spec() const
const cpp_member_spect & member_spec() const
void name_anon_struct_union()
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
cpp_scopet & current_scope()
cpp_idt & insert(const irep_idt &_base_name)
bool contains(const irep_idt &base_name_to_lookup)
void typecheck_type(typet &) override
void convert_template_declaration(cpp_declarationt &declaration)
void convert_non_template_declaration(cpp_declarationt &declaration)
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 &)
void elaborate_class_template(const typet &type)
elaborate class template instances
static bool has_auto(const typet &type)
codet convert_anonymous_union(cpp_declarationt &declaration)
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
bool has_operands() const
Return true if there is at least one operand.
const source_locationt & source_location() const
void reserve_operands(operandst::size_type n)
typet & type()
Return the type of the expression.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
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
source_locationt source_location
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
const componentst & components() const
symbolt & get_writeable_ref(const irep_idt &name)
Find a symbol in the symbol table for read-write access.
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.
const source_locationt & source_location() const
C++ Language Type Checking.
C++ Language Type Checking.
symbol_exprt cpp_symbol_expr(const symbolt &symbol)
#define PRECONDITION(CONDITION)
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.