33 INVARIANT(!components.empty(),
"class structs cannot be empty");
35 const auto &first_member_name=components.front().get_name();
39 components.front().
type());
41 if(first_member_name==
"@class_identifier")
44 return std::move(member_expr);
57 const exprt &this_expr_in,
66 exprt this_expr=this_expr_in;
90 if(components.empty())
95 if(components.front().get_name()==
"@class_identifier")
98 expr.
op0().
id()==ID_constant,
"@class_identifier must be a constant");
105 expr.
op0().
id()==ID_struct,
"Non @class_identifier must be a structure");
The type of an expression, extends irept.
Semantic type conversion.
const irep_idt & get_identifier() const
pointer_typet pointer_type(const typet &subtype)
std::vector< componentt > componentst
const componentst & components() const
A struct tag type, i.e., struct_typet with an identifier.
typet & type()
Return the type of the expression.
exprt get_class_identifier_field(const exprt &this_expr_in, const struct_tag_typet &suggested_type, const namespacet &ns)
A constant literal expression.
Structure type, corresponds to C style structs.
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
Extract member of struct or union.
void set_class_identifier(struct_exprt &expr, const namespacet &ns, const struct_tag_typet &class_type)
If expr has its components filled in then sets the @class_identifier member of the struct...
const irep_idt & id() const
Operator to dereference a pointer.
API to expression classes.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
#define PRECONDITION(CONDITION)
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
static exprt build_class_identifier(const exprt &src, const namespacet &ns)
const struct_exprt & to_struct_expr(const exprt &expr)
Cast an exprt to a struct_exprt.
Base class for all expressions.
Extract class identifier.
const typet & subtype() const
Struct constructor from list of elements.