Go to the documentation of this file.
28 if(statement==ID_try_catch)
33 else if(statement==ID_member_initializer)
38 else if(statement==ID_msc_if_exists ||
39 statement==ID_msc_if_not_exists)
42 else if(statement==ID_decl_block)
46 else if(statement == ID_expression)
64 if(binary_expr.op0().id() == ID_index)
70 array.
type().
id() == ID_signedbv ||
71 array.
type().
id() == ID_unsignedbv)
81 binary_expr.
op1() = rhs;
113 if(statements.front().get_statement() == ID_ellipsis)
115 statements.erase(statements.begin());
141 catch_block.
statements().front().get_statement() == ID_decl_block);
163 if(code.
cond().
id()==ID_code)
177 if(code.
cond().
id()==ID_code)
192 if(value.
id() == ID_code)
209 code.
swap(code_block);
223 const bool has_array_ini = it->get_bool(ID_C_array_ini);
226 it->set(ID_C_array_ini,
true);
244 if(symbol_expr.
type().
id()==ID_code)
263 function_call.
arguments().push_back(this_expr);
266 function_call.
arguments().push_back(*it);
271 if(symbol_expr.
get_bool(ID_C_not_accessible))
273 const irep_idt &access = symbol_expr.
get(ID_C_access);
275 access == ID_private || access == ID_protected ||
276 access == ID_noaccess);
278 if(access == ID_private || access == ID_noaccess)
282 str <<
"error: constructor of '"
284 <<
"' is not accessible";
292 code.
swap(code_expression);
298 symbol_expr.
id() == ID_dereference &&
300 symbol_expr.
get_bool(ID_C_implicit))
304 symbol_expr.
swap(tmp);
307 if(symbol_expr.
id() == ID_symbol &&
308 symbol_expr.
type().
id()!=ID_code)
329 symbol_expr.
id() == ID_dereference &&
331 symbol_expr.
get_bool(ID_C_implicit))
335 symbol_expr.
swap(tmp);
340 symbol_expr.
id() == ID_member &&
352 <<
"' expects one initializer" <<
eom;
360 symbol_expr.
set(ID_C_lvalue,
true);
365 {symbol_expr, code.
op0()},
381 code.
swap(call.value());
393 error() <<
"invalid member initializer '" <<
to_string(symbol_expr) <<
"'"
405 error() <<
"declaration expected to have one operand" <<
eom;
409 assert(code.
op0().
id()==ID_cpp_declaration);
424 follow(type).get_bool(ID_C_is_anonymous))
426 if(type.
id() != ID_union_tag)
429 error() <<
"declaration statement does not declare anything"
441 codet new_code(ID_decl_block);
448 cpp_declarator_converter.
is_typedef=is_typedef;
451 cpp_declarator_converter.
convert(declaration, declarator);
459 error() <<
"void-typed symbol not permitted" <<
eom;
474 "declarator type should match symbol type");
483 declarator.find(ID_init_args).is_nil(),
484 "declarator should not have init_args");
497 if(constructor_call.has_value())
void copy_to_operands(const exprt &expr)
Copy the given argument to the end of exprt's operands.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
irep_idt class_identifier
A codet representing sequential composition of program statements.
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
void typecheck_switch(codet &) override
#define Forall_operands(it, expr)
codet representing a while statement.
virtual void typecheck_while(code_whilet &code)
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
irep_idt cpp_exception_id(const typet &src, const namespacet &ns)
turns a type into an exception ID
#define CHECK_RETURN(CONDITION)
The type of an expression, extends irept.
void typecheck_while(code_whilet &) override
cpp_declarationt & to_cpp_declaration(irept &irep)
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const irept & find(const irep_idt &name) const
typet type
Type of symbol.
void typecheck_side_effect_assignment(side_effect_exprt &) override
A side_effect_exprt representation of a function call side effect.
The trinary if-then-else operator.
void typecheck_block(code_blockt &) override
exprt::operandst operands
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
A codet representing the declaration of a local variable.
Base class for all expressions.
optionalt< codet > cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
void typecheck_decl(codet &) override
const exprt & cond() const
const code_frontend_declt & to_code_frontend_decl(const codet &code)
void typecheck_try_catch(codet &)
side_effect_exprt & to_side_effect_expr(exprt &expr)
codet representation of an if-then-else statement.
const declaratorst & declarators() const
const irep_idt & get(const irep_idt &name) const
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
code_operandst & statements()
const codet & to_code(const exprt &expr)
typet & type()
Return the type of the expression.
void typecheck_type(typet &) override
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
static void make_already_typechecked(exprt &expr)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
bool has_operands() const
Return true if there is at least one operand.
cpp_scopet & current_scope()
source_locationt source_location
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:
#define forall_operands(it, expr)
void set(const irep_idt &name, const irep_idt &value)
#define PRECONDITION(CONDITION)
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
symbol_exprt cpp_symbol_expr(const symbolt &symbol)
void typecheck_function_call_arguments(side_effect_expr_function_callt &) override
void make_ptr_typecast(exprt &expr, const typet &dest_type)
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
void typecheck_ifthenelse(code_ifthenelset &) override
const reference_typet & to_reference_type(const typet &type)
Cast a typet to a reference_typet.
virtual void typecheck_code(codet &code)
const exprt & cond() const
const irep_idt & id() const
void add_object(const exprt &expr)
virtual void typecheck_switch(codet &code)
const parameterst & parameters() const
const irep_idt & get_statement() const
Bit-wise negation of bit-vectors.
cpp_scopet & new_block_scope()
const exprt & value() const
void typecheck_expr(exprt &) override
exprt value
Initial value of symbol.
bool is_reference(const typet &type)
Returns true if the type is a reference.
A codet representing a skip statement.
void typecheck_code(codet &) override
void typecheck_member_initializer(codet &)
const typet & follow(const typet &) const
Resolve type symbol to the type it points to.
source_locationt location
Source code location of definition of symbol.
exprt::operandst & arguments()
static bool has_auto(const typet &type)
const code_switcht & to_code_switch(const codet &code)
codet convert_anonymous_union(cpp_declarationt &declaration)
const typet & base_type() const
The type of the data what we point to.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
static void make_already_typechecked(typet &type)
virtual void typecheck_ifthenelse(code_ifthenelset &code)
const code_blockt & to_code_block(const codet &code)
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
std::string to_string(const typet &) override
void dereference(const irep_idt &function_id, goto_programt::const_targett target, exprt &expr, const namespacet &ns, value_setst &value_sets)
Remove dereferences in expr using value_sets to determine to what objects the pointers may be pointin...
void remove(const irep_idt &name)
source_locationt & add_source_location()
const irep_idt & get_statement() const
exprt resolve(const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
void reserve_operands(operandst::size_type n)
const source_locationt & source_location() const
bool get_bool(const irep_idt &name) const
An expression containing a side effect.
cpp_namet & to_cpp_name(irept &cpp_name)
virtual void typecheck_block(code_blockt &code)
codet representation of an expression statement.
Data structure for representing an arbitrary statement in a program.