Go to the documentation of this file.
27 if(statement==ID_try_catch)
32 else if(statement==ID_member_initializer)
37 else if(statement==ID_msc_if_exists ||
38 statement==ID_msc_if_not_exists)
41 else if(statement==ID_decl_block)
45 else if(statement == ID_expression)
63 if(binary_expr.op0().id() == ID_index)
69 array.
type().
id() == ID_signedbv ||
70 array.
type().
id() == ID_unsignedbv)
79 binary_expr.
op1() = rhs;
111 if(statements.front().get_statement() == ID_ellipsis)
113 statements.erase(statements.begin());
138 catch_block.
statements().front().get_statement() == ID_decl_block);
160 if(code.
cond().
id()==ID_code)
174 if(code.
cond().
id()==ID_code)
189 if(value.
id() == ID_code)
206 code.
swap(code_block);
220 const bool has_array_ini = it->get_bool(ID_C_array_ini);
223 it->set(ID_C_array_ini,
true);
241 if(symbol_expr.
type().
id()==ID_code)
260 function_call.
arguments().push_back(this_expr);
263 function_call.
arguments().push_back(*it);
268 if(symbol_expr.
get_bool(ID_C_not_accessible))
270 const irep_idt &access = symbol_expr.
get(ID_C_access);
272 access == ID_private || access == ID_protected ||
273 access == ID_noaccess);
275 if(access == ID_private || access == ID_noaccess)
279 str <<
"error: constructor of '"
281 <<
"' is not accessible";
289 code.
swap(code_expression);
295 symbol_expr.
id() == ID_dereference &&
297 symbol_expr.
get_bool(ID_C_implicit))
301 symbol_expr.
swap(tmp);
304 if(symbol_expr.
id() == ID_symbol &&
305 symbol_expr.
type().
id()!=ID_code)
324 symbol_expr.
id() == ID_dereference &&
326 symbol_expr.
get_bool(ID_C_implicit))
330 symbol_expr.
swap(tmp);
335 symbol_expr.
id() == ID_member &&
347 <<
"' expects one initializer" <<
eom;
355 symbol_expr.
set(ID_C_lvalue,
true);
360 {symbol_expr, code.
op0()},
376 code.
swap(call.value());
388 error() <<
"invalid member initializer '" <<
to_string(symbol_expr) <<
"'"
400 error() <<
"declaration expected to have one operand" <<
eom;
404 assert(code.
op0().
id()==ID_cpp_declaration);
419 follow(type).get_bool(ID_C_is_anonymous))
421 if(type.
id() != ID_union_tag)
424 error() <<
"declaration statement does not declare anything"
436 codet new_code(ID_decl_block);
443 cpp_declarator_converter.
is_typedef=is_typedef;
446 cpp_declarator_converter.
convert(declaration, declarator);
462 "declarator type should match symbol type");
471 declarator.find(ID_init_args).is_nil(),
472 "declarator should not have init_args");
485 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.
const typet & subtype() const
void typecheck_switch(codet &) override
#define Forall_operands(it, expr)
codet representing a while statement.
const code_declt & to_code_decl(const codet &code)
virtual void typecheck_while(code_whilet &code)
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.
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
const irept & find(const irep_namet &name) const
A codet representing the declaration of a local variable.
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
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
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
C++ Language Type Checking.
const codet & to_code(const exprt &expr)
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
code_operandst & statements()
typet & type()
Return the type of the expression.
void typecheck_type(typet &) override
bool get_bool(const irep_namet &name) const
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)
#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)
void typecheck_ifthenelse(code_ifthenelset &) override
virtual void typecheck_code(codet &code)
const exprt & cond() const
const irep_idt & id() const
void remove(const irep_namet &name)
void add_object(const exprt &expr)
virtual void typecheck_switch(codet &code)
const parameterst & parameters() const
C++ Language Type Checking.
const irep_idt & get_statement() const
Bit-wise negation of bit-vectors.
cpp_scopet & new_block_scope()
const exprt & value() const
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
void typecheck_expr(exprt &) override
exprt value
Initial value of symbol.
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.
bool is_reference(const typet &type)
Returns true if the type is a reference.
const irep_idt & get(const irep_namet &name) const
source_locationt location
Source code location of definition of symbol.
void set(const irep_namet &name, const irep_idt &value)
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)
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...
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
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.
C++ Language Type Checking.
Data structure for representing an arbitrary statement in a program.