26 if(statement==ID_try_catch)
31 else if(statement==ID_member_initializer)
36 else if(statement==ID_msc_if_exists ||
37 statement==ID_msc_if_not_exists)
40 else if(statement==ID_decl_block)
52 for(codet::operandst::iterator
57 if(it==operands.begin())
70 if(
to_code(code.
op0()).get_statement()==ID_ellipsis)
81 assert(
to_code(code.
op0()).get_statement()==ID_decl);
85 assert(cpp_declaration.declarators().size()==1);
98 assert(
to_code(code.
op0()).get_statement()==ID_decl_block);
105 const typet &type=code_decl.op0().type();
120 if(code.
cond().
id()==ID_code)
134 if(code.
cond().
id()==ID_code)
160 assert(decl.
op0().
op0().
id()==ID_symbol);
167 code.
swap(code_block);
181 const bool has_array_ini = it->get_bool(
"#array_ini");
184 it->set(
"#array_ini",
true);
202 if(symbol_expr.
type().
id()==ID_code)
211 function_call.
function()=symbol_expr;
213 function_call.arguments().reserve(code.
operands().size()+1);
223 function_call.arguments().push_back(this_expr);
226 function_call.arguments().push_back(*it);
231 if(symbol_expr.
get_bool(
"#not_accessible"))
235 assert(access==ID_private ||
236 access==ID_protected ||
239 if(access==ID_private || access==
"noaccess")
243 str <<
"error: constructor of `" 245 <<
"' is not accessible";
254 code.
swap(code_expression);
259 if(symbol_expr.
id() == ID_dereference &&
260 symbol_expr.
op0().
id() == ID_member &&
261 symbol_expr.
get_bool(ID_C_implicit) ==
true)
265 symbol_expr.
swap(tmp);
268 if(symbol_expr.
id() == ID_symbol &&
269 symbol_expr.
type().
id()!=ID_code)
287 if(symbol_expr.
id() == ID_dereference &&
288 symbol_expr.
op0().
id() == ID_member &&
289 symbol_expr.
get_bool(ID_C_implicit) ==
true)
293 symbol_expr.
swap(tmp);
297 if(symbol_expr.
id() == ID_member &&
298 symbol_expr.
op0().
id() == ID_dereference &&
308 <<
"' expects one initializer" <<
eom;
316 symbol_expr.
set(
"#lvalue",
true);
346 error() <<
"invalid member initializer `" 358 error() <<
"declaration expected to have one operand" <<
eom;
362 assert(code.
op0().
id()==ID_cpp_declaration);
367 typet &type=declaration.type();
369 bool is_typedef=declaration.is_typedef();
371 if(declaration.declarators().empty() || !
has_auto(type))
374 assert(type.is_not_nil());
376 if(declaration.declarators().empty() &&
382 error() <<
"declaration statement does not declare anything" 394 codet new_code(ID_decl_block);
398 for(
auto &declarator : declaration.declarators())
401 cpp_declarator_converter.
is_typedef=is_typedef;
404 cpp_declarator_converter.
convert(declaration, declarator);
420 "declarator type should match symbol type");
428 assert(declarator.find(
"init_args").is_nil());
438 exprt constructor_call=
C++ Language Type Checking.
const irep_idt & get_statement() const
The type of an expression.
const code_declt & to_code_decl(const codet &code)
void typecheck_type(typet &type)
static bool has_auto(const typet &type)
const exprt & cond() const
virtual void typecheck_while(code_whilet &code)
virtual void typecheck_switch(code_switcht &code)
const exprt & cond() const
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
exprt::operandst operands
void copy_to_operands(const exprt &expr)
cpp_namet & to_cpp_name(irept &cpp_name)
void move_to_operands(exprt &expr)
void already_typechecked(irept &irep)
virtual void typecheck_code(codet &code)
exprt value
Initial value of symbol.
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
static mstreamt & eom(mstreamt &m)
virtual void typecheck_block(codet &code)
bool get_bool(const irep_namet &name) const
virtual void typecheck_expr(exprt &expr)
const irep_idt & id() const
virtual void typecheck_try_catch(codet &code)
void typecheck_function_call_arguments(side_effect_expr_function_callt &expr)
exprt dereference(const exprt &pointer, const namespacet &ns)
A declaration of a local variable.
virtual void typecheck_ifthenelse(code_ifthenelset &code)
const source_locationt & find_source_location() const
void make_already_typechecked(typet &dest)
source_locationt source_location
C++ Language Type Checking.
bool is_reference(const typet &type)
TO_BE_DOCUMENTED.
const irep_idt & get(const irep_namet &name) const
#define forall_operands(it, expr)
irep_idt class_identifier
void add_object(const exprt &expr)
C++ Language Type Checking.
const typet & follow(const typet &) const
void typecheck_side_effect_assignment(side_effect_exprt &expr)
irep_idt cpp_exception_id(const typet &src, const namespacet &ns)
turns a type into an exception ID
exprt resolve(const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
virtual void typecheck_switch(code_switcht &code)
virtual void typecheck_block(codet &code)
void make_ptr_typecast(exprt &expr, const typet &dest_type)
std::vector< exprt > operandst
A function call side effect.
const exprt & value() const
virtual void typecheck_decl(codet &code)
typet type
Type of symbol.
source_locationt location
Source code location of definition of symbol.
cpp_declarationt & to_cpp_declaration(irept &irep)
void convert_anonymous_union(cpp_declarationt &declaration, codet &new_code)
Base class for all expressions.
const parameterst & parameters() const
cpp_scopet & current_scope()
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
const source_locationt & source_location() const
virtual void typecheck_while(code_whilet &code)
const exprt & expression() const
virtual std::string to_string(const typet &type)
cpp_scopet & new_block_scope()
#define Forall_operands(it, expr)
source_locationt & add_source_location()
const codet & to_code(const exprt &expr)
const code_blockt & to_code_block(const codet &code)
virtual void typecheck_ifthenelse(code_ifthenelset &code)
A statement in a programming language.
exprt cpp_symbol_expr(const symbolt &symbol)
void remove(const irep_namet &name)
const typet & subtype() const
#define DATA_INVARIANT(CONDITION, REASON)
An expression containing a side effect.
virtual void typecheck_member_initializer(codet &code)
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 reserve_operands(operandst::size_type n)
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: ...
virtual void typecheck_code(codet &code)