36 error() <<
"expected type as initializer for `" 54 <<
"' is declared as reference but is not initialized" 72 if(symbol.
type.
id() == ID_pointer &&
74 symbol.
value.
id() == ID_address_of &&
86 for(code_typet::parameterst::const_iterator
91 exprt new_object(
"new_object");
92 new_object.
set(ID_C_lvalue,
true);
93 new_object.
type() =
ait->type();
95 if(
ait->get(ID_C_base_name)==ID_this)
98 new_object.
type() =
ait->type().subtype();
101 fargs.
operands.push_back(new_object);
110 if(resolved_expr.
id()==ID_symbol)
115 else if(resolved_expr.
id()==ID_member)
119 lookup(resolved_expr.
get(ID_component_name)).symbol_expr());
129 error() <<
"conversion from `" 140 if(symbol.
value.
id()==ID_initializer_list ||
141 symbol.
value.
id()==ID_string_constant)
166 ops.push_back(symbol.
value);
183 if(final_type.
id()==ID_struct)
187 const exprt &component=
static_cast<const exprt &
>(*cit);
189 if(component.
type().
id()==ID_code)
195 if(component.
get_bool(ID_is_static))
198 exprt member(ID_member);
200 member.
set(ID_component_name, component.
get(ID_name));
206 else if(final_type.
id()==ID_array &&
210 const exprt &size_expr=array_type.
size();
212 if(size_expr.
id()==ID_infinity)
224 exprt index(ID_index);
229 else if(final_type.
id()==ID_union)
240 const exprt &component=
static_cast<const exprt &
>(*it);
244 if(component.
type().
id()==ID_code)
252 if(size_int>max_comp_size)
254 max_comp_size=size_int;
263 name.
set(ID_identifier, comp.
get(ID_base_name));
264 name.
set(ID_C_source_location, source_location);
269 exprt member(ID_member);
271 member.
set(ID_component_cpp_name, cpp_name);
275 else if(final_type.
id()==ID_c_enum)
277 typet enum_type(ID_unsignedbv);
278 enum_type.
add(ID_width)=final_type.
find(ID_width);
290 assign.
lhs().
type().
set(ID_C_constant,
false);
294 ops.push_back(assign);
296 else if(final_type.
id()==ID_incomplete_struct ||
297 final_type.
id()==ID_incomplete_union)
300 error() <<
"cannot zero-initialize incomplete compound" <<
eom;
315 assign.
lhs().
type().
set(ID_C_constant,
false);
319 ops.push_back(assign);
The type of an expression.
irep_idt name
The unique identifier.
const typet & follow(const typet &src) const
virtual bool lookup(const irep_idt &name, const symbolt *&symbol) const
Linking: Zero Initialization.
void typecheck_type(typet &type)
void move_to_sub(irept &irep)
exprt::operandst operands
void copy_to_operands(const exprt &expr)
cpp_namet & to_cpp_name(irept &cpp_name)
void already_typechecked(irept &irep)
virtual void typecheck_code(codet &code)
exprt value
Initial value of symbol.
virtual void implicit_typecast(exprt &expr, const typet &type)
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
static mstreamt & eom(mstreamt &m)
bool get_bool(const irep_namet &name) const
virtual void typecheck_expr(exprt &expr)
const irep_idt & id() const
exprt c_sizeof(const typet &src, const namespacet &ns)
const array_typet & to_array_type(const typet &type)
Cast a generic typet to an array_typet.
source_locationt source_location
bool cpp_is_pod(const typet &type) const
API to expression classes.
bool is_reference(const typet &type)
TO_BE_DOCUMENTED.
const irep_idt & get(const irep_namet &name) const
void convert_initializer(symbolt &symbol)
Initialize an object with a value.
const exprt & size() const
Base class for tree-like data structures with sharing.
C++ Language Type Checking.
bitvector_typet index_type()
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.
message_handlert & get_message_handler()
Base class for all expressions.
const parameterst & parameters() const
irep_idt base_name
Base (non-scoped) name.
const source_locationt & source_location() const
irept & add(const irep_namet &name)
virtual std::string to_string(const typet &type)
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
virtual bool simplify(exprt &expr)
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
void make_typecast(const typet &_type)
const irept & find(const irep_namet &name) const
codet cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
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)
#define forall_irep(it, irep)