34 error() <<
"expected type as initializer for `" 52 <<
"' is declared as reference but is not initialized" 78 if(symbol.
type.
id() == ID_pointer &&
80 symbol.
value.
id() == ID_address_of &&
92 for(code_typet::parameterst::const_iterator
97 exprt new_object(ID_new_object,
ait->type());
98 new_object.
set(ID_C_lvalue,
true);
100 if(
ait->get(ID_C_base_name)==ID_this)
103 new_object.type() =
ait->type().subtype();
106 fargs.
operands.push_back(new_object);
115 if(resolved_expr.
id()==ID_symbol)
120 else if(resolved_expr.
id()==ID_member)
124 lookup(resolved_expr.
get(ID_component_name)).symbol_expr());
134 error() <<
"conversion from `" 148 if(symbol.
value.
id()==ID_initializer_list ||
149 symbol.
value.
id()==ID_string_constant)
180 ops.push_back(symbol.
value);
185 if(constructor.has_value())
186 symbol.
value = constructor.value();
200 if(final_type.
id()==ID_struct)
219 else if(final_type.
id()==ID_array &&
223 const exprt &size_expr=array_type.
size();
225 if(size_expr.
id()==ID_infinity)
228 const mp_integer size = numeric_cast_v<mp_integer>(size_expr);
239 else if(final_type.
id()==ID_union)
258 if(size_int>max_comp_size)
260 max_comp_size=size_int;
270 exprt member(ID_member);
271 member.copy_to_operands(
object);
272 member.set(ID_component_cpp_name, cpp_name);
276 else if(final_type.
id()==ID_c_enum)
282 zero.make_typecast(type);
291 assign.
lhs().
type().
set(ID_C_constant,
false);
295 ops.push_back(assign);
297 else if(final_type.
id()==ID_incomplete_struct ||
298 final_type.
id()==ID_incomplete_union)
301 error() <<
"cannot zero-initialize incomplete compound" <<
eom;
307 if(!value.has_value())
310 error() <<
"cannot zero-initialize `" <<
to_string(final_type) <<
"'" 319 assign.
lhs().
type().
set(ID_C_constant,
false);
323 ops.push_back(assign);
The type of an expression, extends irept.
irep_idt name
The unique identifier.
exprt size_of_expr(const typet &type, const namespacet &ns)
Fixed-width bit-vector with unsigned binary interpretation.
static bool has_auto(const typet &type)
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
optionalt< codet > cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
exprt::operandst operands
auto component(T &struct_expr, const irep_idt &name, const namespacet &ns) -> decltype(struct_expr.op0())
cpp_namet & to_cpp_name(irept &cpp_name)
void typecheck_expr(exprt &) override
void already_typechecked(irept &irep)
exprt value
Initial value of symbol.
const componentst & components() const
typet & type()
Return the type of the expression.
void typecheck_code(codet &) override
#define CHECK_RETURN(CONDITION)
Extract member of struct or union.
const irep_idt & get_base_name() const
Expression Initialization.
const irep_idt & id() const
void cpp_convert_auto(typet &dest, const typet &src)
source_locationt source_location
bool cpp_is_pod(const typet &type) const
void typecheck_type(typet &) override
bool is_reference(const typet &type)
Returns true if the type is a reference.
void implicit_typecast(exprt &expr, const typet &type) override
const irep_idt & get(const irep_namet &name) const
void convert_initializer(symbolt &symbol)
Initialize an object with a value.
const exprt & size() const
C++ Language Type Checking.
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
bitvector_typet index_type()
const struct_typet & to_struct_type(const typet &type)
Cast a typet to a struct_typet.
Operator to return the address of an object.
void zero_initializer(const exprt &object, const typet &type, const source_locationt &source_location, exprt::operandst &ops)
exprt resolve(const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
std::vector< exprt > operandst
typet type
Type of symbol.
source_locationt location
Source code location of definition of symbol.
const array_typet & to_array_type(const typet &type)
Cast a typet to an array_typet.
Base class for all expressions.
const parameterst & parameters() const
irep_idt base_name
Base (non-scoped) name.
const union_typet & to_union_type(const typet &type)
Cast a typet to a union_typet.
const source_locationt & source_location() const
#define UNREACHABLE
This should be used to mark dead code.
irept & add(const irep_namet &name)
source_locationt & add_source_location()
Expression to hold a symbol (variable)
virtual void do_initializer(exprt &initializer, const typet &type, bool force_constant)
const typet & subtype() const
std::string to_string(const typet &) override
const irept & find(const irep_namet &name) const
bool lookup(const irep_idt &name, const symbolt *&symbol) const override
See documentation for namespace_baset::lookup().
A codet representing an assignment in the program.
void set(const irep_namet &name, const irep_idt &value)
void reference_initializer(exprt &expr, const typet &type)
A reference to type "cv1 T1" is initialized by an expression of type "cv2 T2" as follows: ...
bool simplify(exprt &expr, const namespacet &ns)