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);
197 if(symbol_expr.
type().
id()==ID_code)
206 function_call.
function()=symbol_expr;
208 function_call.arguments().reserve(code.
operands().size()+1);
218 function_call.arguments().push_back(this_expr);
221 function_call.arguments().push_back(*it);
226 if(symbol_expr.
get_bool(
"#not_accessible"))
230 assert(access==ID_private ||
231 access==ID_protected ||
234 if(access==ID_private || access==
"noaccess")
238 str <<
"error: constructor of `" 240 <<
"' is not accessible";
249 code.
swap(code_expression);
254 if(symbol_expr.
id() == ID_dereference &&
255 symbol_expr.
op0().
id() == ID_member &&
256 symbol_expr.
get_bool(ID_C_implicit) ==
true)
260 symbol_expr.
swap(tmp);
263 if(symbol_expr.
id() == ID_symbol &&
264 symbol_expr.
type().
id()!=ID_code)
282 if(symbol_expr.
id() == ID_dereference &&
283 symbol_expr.
op0().
id() == ID_member &&
284 symbol_expr.
get_bool(ID_C_implicit) ==
true)
288 symbol_expr.
swap(tmp);
292 if(symbol_expr.
id() == ID_member &&
293 symbol_expr.
op0().
id() == ID_dereference &&
303 <<
"' expects one initializer" <<
eom;
311 symbol_expr.
set(
"#lvalue",
true);
345 error() <<
"invalid member initializer `" 357 error() <<
"declaration expected to have one operand" <<
eom;
361 assert(code.
op0().
id()==ID_cpp_declaration);
366 typet &type=declaration.type();
368 bool is_typedef=declaration.is_typedef();
371 assert(type.is_not_nil());
373 if(declaration.declarators().empty() &&
379 error() <<
"declaration statement does not declare anything" 388 codet new_code(ID_decl_block);
392 for(
auto &declarator : declaration.declarators())
395 cpp_declarator_converter.
is_typedef=is_typedef;
398 cpp_declarator_converter.
convert(declaration, declarator);
403 codet decl_statement(ID_decl);
421 assert(declarator.find(
"init_args").is_nil());
431 exprt constructor_call=
458 error() <<
"assignment statement expected to have two operands" 472 code.
swap(code_expr);
C++ Language Type Checking.
const irep_idt & get_statement() const
The type of an expression.
const typet & follow(const typet &src) const
const code_declt & to_code_decl(const codet &code)
void typecheck_type(typet &type)
const exprt & cond() const
virtual void typecheck_while(code_whilet &code)
virtual void typecheck_switch(code_switcht &code)
const exprt & cond() const
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.
void typecheck_assign(codet &code)
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
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.
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()
const code_typet & to_code_type(const typet &type)
Cast a generic typet to a code_typet.
#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
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)