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)
249 code_type.
parameters().size() >= 1,
"at least one parameter");
263 function_call.
arguments().push_back(this_expr);
265 for(
const auto &op :
as_const(code).operands())
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 error() <<
"constructor of '"
284 <<
"' is not accessible" <<
eom;
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;
361 symbol_expr.
set(ID_C_lvalue,
true);
366 {symbol_expr, code.
op0()},
382 code.
swap(call.value());
394 error() <<
"invalid member initializer '" <<
to_string(symbol_expr) <<
"'"
406 error() <<
"declaration expected to have one operand" <<
eom;
426 ((type.
id() == ID_struct_tag &&
428 (type.
id() == ID_union_tag &&
432 if(type.
id() != ID_union_tag)
435 error() <<
"declaration statement does not declare anything"
447 codet new_code(ID_decl_block);
454 cpp_declarator_converter.
is_typedef=is_typedef;
457 cpp_declarator_converter.
convert(declaration, declarator);
465 error() <<
"void-typed symbol not permitted" <<
eom;
479 "declarator type should match symbol type");
488 declarator.find(ID_init_args).is_nil(),
489 "declarator should not have init_args");
502 if(constructor_call.has_value())
const T & as_const(T &value)
Return a reference to the same object but ensures the type is const.
API to expression classes for bitvectors.
const union_tag_typet & to_union_tag_type(const typet &type)
Cast a typet to a union_tag_typet.
static void make_already_typechecked(exprt &expr)
static void make_already_typechecked(typet &type)
Bit-wise negation of bit-vectors.
virtual void typecheck_block(code_blockt &code)
virtual void typecheck_code(codet &code)
virtual void typecheck_while(code_whilet &code)
virtual void typecheck_switch(codet &code)
virtual void typecheck_ifthenelse(code_ifthenelset &code)
A codet representing sequential composition of program statements.
code_operandst & statements()
codet representation of an expression statement.
A codet representing the declaration of a local variable.
codet representation of an if-then-else statement.
const exprt & cond() const
A codet representing a skip statement.
const exprt & value() const
const parameterst & parameters() const
codet representing a while statement.
const exprt & cond() const
Data structure for representing an arbitrary statement in a program.
const irep_idt & get_statement() const
const declaratorst & declarators() const
symbolt & convert(const typet &type, const cpp_storage_spect &storage_spec, const cpp_member_spect &member_spec, cpp_declaratort &declarator)
irep_idt class_identifier
cpp_scopet & new_block_scope()
cpp_scopet & current_scope()
exprt::operandst operands
void add_object(const exprt &expr)
void typecheck_side_effect_assignment(side_effect_exprt &) override
void typecheck_type(typet &) override
void typecheck_switch(codet &) override
void typecheck_decl(codet &) override
void typecheck_code(codet &) override
void typecheck_member_initializer(codet &)
std::optional< codet > cpp_constructor(const source_locationt &source_location, const exprt &object, const exprt::operandst &operands)
void typecheck_try_catch(codet &)
void typecheck_ifthenelse(code_ifthenelset &) override
static bool has_auto(const typet &type)
codet convert_anonymous_union(cpp_declarationt &declaration)
void typecheck_expr(exprt &) override
void make_ptr_typecast(exprt &expr, const pointer_typet &dest_type)
std::string to_string(const typet &) override
void typecheck_block(code_blockt &) override
void typecheck_while(code_whilet &) override
void typecheck_function_call_arguments(side_effect_expr_function_callt &) override
exprt resolve(const cpp_namet &cpp_name, const cpp_typecheck_resolvet::wantt want, const cpp_typecheck_fargst &fargs, bool fail_with_exception=true)
void reference_initializer(exprt &expr, const reference_typet &type)
A reference to type "cv1 T1" is initialized by an expression of type "cv2 T2" as follows:
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
bool has_operands() const
Return true if there is at least one operand.
void copy_to_operands(const exprt &expr)
Copy the given argument to the end of exprt's operands.
source_locationt & add_source_location()
const source_locationt & source_location() const
void reserve_operands(operandst::size_type n)
typet & type()
Return the type of the expression.
void add_to_operands(const exprt &expr)
Add the given argument to the end of exprt's operands.
The trinary if-then-else operator.
bool get_bool(const irep_idt &name) const
const irept & find(const irep_idt &name) const
const irep_idt & get(const irep_idt &name) const
void remove(const irep_idt &name)
void set(const irep_idt &name, const irep_idt &value)
const irep_idt & id() const
source_locationt source_location
const union_typet & follow_tag(const union_tag_typet &) const
Follow type tag of union type.
const typet & base_type() const
The type of the data what we point to.
A side_effect_exprt representation of a function call side effect.
exprt::operandst & arguments()
An expression containing a side effect.
const irep_idt & get_statement() const
source_locationt location
Source code location of definition of symbol.
typet type
Type of symbol.
exprt value
Initial value of symbol.
The type of an expression, extends irept.
cpp_declarationt & to_cpp_declaration(irept &irep)
C++ Language Type Checking.
irep_idt cpp_exception_id(const typet &src, const namespacet &ns)
turns a type into an exception ID
C++ Language Type Checking.
cpp_namet & to_cpp_name(irept &cpp_name)
C++ Language Type Checking.
C++ Language Type Checking.
symbol_exprt cpp_symbol_expr(const symbolt &symbol)
#define Forall_operands(it, expr)
void dereference(const irep_idt &function_id, goto_programt::const_targett target, exprt &expr, const namespacet &ns, value_setst &value_sets, message_handlert &message_handler)
Remove dereferences in expr using value_sets to determine to what objects the pointers may be pointin...
API to expression classes for Pointers.
bool is_reference(const typet &type)
Returns true if the type is a reference.
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
const pointer_typet & to_pointer_type(const typet &type)
Cast a typet to a pointer_typet.
const reference_typet & to_reference_type(const typet &type)
Cast a typet to a reference_typet.
#define CHECK_RETURN(CONDITION)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
#define PRECONDITION(CONDITION)
side_effect_exprt & to_side_effect_expr(exprt &expr)
const code_switcht & to_code_switch(const codet &code)
const code_frontend_declt & to_code_frontend_decl(const codet &code)
const code_blockt & to_code_block(const codet &code)
const codet & to_code(const exprt &expr)
const binary_exprt & to_binary_expr(const exprt &expr)
Cast an exprt to a binary_exprt.
const member_exprt & to_member_expr(const exprt &expr)
Cast an exprt to a member_exprt.
const unary_exprt & to_unary_expr(const exprt &expr)
Cast an exprt to a unary_exprt.
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
const code_typet & to_code_type(const typet &type)
Cast a typet to a code_typet.
const struct_tag_typet & to_struct_tag_type(const typet &type)
Cast a typet to a struct_tag_typet.