38 new_symbol.
value=expr;
44 result.add_source_location()=source_location;
52 convert(code_assign, dest, mode);
66 if(expr.
id()==ID_dereference ||
67 expr.
id()==ID_side_effect ||
68 expr.
id()==ID_compound_literal ||
72 if(expr.
id()==ID_index)
98 if(expr.
id()==ID_forall || expr.
id()==ID_exists)
117 "' must be Boolean, but got ",
125 if(expr.
id()==ID_and)
133 for(exprt::operandst::reverse_iterator
142 "boolean operators must have only boolean operands",
145 if(expr.
id()==ID_and)
177 if(expr.
id()==ID_and || expr.
id()==ID_or)
186 else if(expr.
id()==ID_if)
201 "condition for an 'if' must be boolean",
240 assignment_true.rhs()=if_expr.
true_case();
242 convert(assignment_true, tmp_true, mode);
248 convert(assignment_false, tmp_false, mode);
262 convert(code_expression, tmp_true, mode);
271 convert(code_expression, tmp_false, mode);
279 if_expr.
cond(), tmp_true, tmp_false, source_location, dest, mode);
283 else if(expr.
id()==ID_comma)
291 bool last=(it==--expr.
operands().end());
327 else if(expr.
id()==ID_typecast)
339 else if(expr.
id()==ID_side_effect)
344 if(statement==ID_gcc_conditional_expression)
350 else if(statement==ID_statement_expression)
358 else if(statement==ID_assign)
363 "side-effect assignment expressions must have two operands");
365 if(expr.
op1().
id()==ID_side_effect &&
373 assignment.
lhs()=lhs;
374 assignment.
rhs()=expr.
op1();
385 else if(statement==ID_function_call)
390 function()).get_identifier()==
"__noop")
398 else if(expr.
id()==ID_forall || expr.
id()==ID_exists)
402 "the front-end should check quantified expressions for side-effects");
404 else if(expr.
id()==ID_address_of)
416 if(expr.
id()==ID_side_effect)
420 else if(expr.
id()==ID_compound_literal)
424 expr.
operands().size() == 1,
"ID_compound_literal has a single operand");
437 if(expr.
id()==ID_compound_literal)
440 expr.
operands().size() == 1,
"ID_compound_literal has a single operand");
444 else if(expr.
id()==ID_string_constant)
449 else if(expr.
id()==ID_index)
455 else if(expr.
id()==ID_dereference)
460 else if(expr.
id()==ID_comma)
469 bool last=(it==--expr.
operands().end());
501 "gcc conditional expressions must have two operands");
510 if_expr.true_case()=expr.
op0();
511 if_expr.false_case()=expr.
op1();
const if_exprt & to_if_expr(const exprt &expr)
Cast an exprt to an if_exprt.
side_effect_expr_function_callt & to_side_effect_expr_function_call(exprt &expr)
Semantic type conversion.
bool is_boolean() const
Return whether the expression represents a Boolean.
struct goto_convertt::targetst targets
void convert(const codet &code, goto_programt &dest, const irep_idt &mode)
converts 'code' and appends the result to 'dest'
Deprecated expression utility functions.
void generate_ifthenelse(const exprt &cond, goto_programt &true_case, goto_programt &false_case, const source_locationt &, goto_programt &dest, const irep_idt &mode)
if(guard) true_case; else false_case;
Fresh auxiliary symbol creation.
bool is_false() const
Return whether the expression is a constant representing false.
#define PRECONDITION_WITH_DIAGNOSTICS(CONDITION,...)
exprt value
Initial value of symbol.
The trinary if-then-else operator.
bool is_true() const
Return whether the expression is a constant representing true.
typet & type()
Return the type of the expression.
const address_of_exprt & to_address_of_expr(const exprt &expr)
Cast an exprt to an address_of_exprt.
void clean_expr_address_of(exprt &expr, goto_programt &dest, const irep_idt &mode)
codet representation of an expression statement.
const dereference_exprt & to_dereference_expr(const exprt &expr)
Cast an exprt to a dereference_exprt.
side_effect_exprt & to_side_effect_expr(exprt &expr)
destructor_stackt destructor_stack
const irep_idt & id() const
class symbol_exprt symbol_expr() const
Produces a symbol_exprt for a symbol.
The Boolean constant true.
void clean_expr(exprt &expr, goto_programt &dest, const irep_idt &mode, bool result_is_used=true)
std::string tmp_symbol_prefix
A codet representing the declaration of a local variable.
bool has_subexpr(const exprt &expr, const std::function< bool(const exprt &)> &pred)
returns true if the expression has a subexpression that satisfies pred
#define DATA_INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
Operator to dereference a pointer.
API to expression classes.
void convert_assign(const code_assignt &code, goto_programt &dest, const irep_idt &mode)
#define PRECONDITION(CONDITION)
#define forall_operands(it, expr)
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast an exprt to a symbol_exprt.
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Operator to return the address of an object.
The Boolean constant false.
std::vector< exprt > operandst
A generic container class for the GOTO intermediate representation of one function.
void remove_statement_expression(side_effect_exprt &expr, goto_programt &dest, const irep_idt &mode, bool result_is_used)
static bool needs_cleaning(const exprt &expr)
mstreamt & result() const
void remove_gcc_conditional_expression(exprt &expr, goto_programt &dest, const irep_idt &mode)
symbolt & get_fresh_aux_symbol(const typet &type, const std::string &name_prefix, const std::string &basename_prefix, const source_locationt &source_location, const irep_idt &symbol_mode, symbol_table_baset &symbol_table)
Installs a fresh-named symbol with the requested name pattern.
Base class for all expressions.
symbol_exprt make_compound_literal(const exprt &expr, goto_programt &dest, const irep_idt &mode)
source_locationt & add_source_location()
const source_locationt & source_location() const
symbolt & new_tmp_symbol(const typet &type, const std::string &suffix, goto_programt &dest, const source_locationt &, const irep_idt &mode)
const typecast_exprt & to_typecast_expr(const exprt &expr)
Cast an exprt to a typecast_exprt.
exprt::operandst & arguments()
symbol_table_baset & symbol_table
A codet representing the removal of a local variable going out of scope.
#define Forall_operands(it, expr)
bool is_zero() const
Return whether the expression is a constant representing 0.
source_locationt & add_source_location()
void remove_side_effect(side_effect_exprt &expr, goto_programt &dest, const irep_idt &mode, bool result_is_used)
Expression to hold a symbol (variable)
void copy(const codet &code, goto_program_instruction_typet type, goto_programt &dest)
#define DATA_INVARIANT(CONDITION, REASON)
This condition should be used to document that assumptions that are made on goto_functions,...
void rewrite_boolean(exprt &dest)
re-write boolean operators into ?:
const index_exprt & to_index_expr(const exprt &expr)
Cast an exprt to an index_exprt.
A codet representing an assignment in the program.
const irep_idt & get_statement() const
bool simplify(exprt &expr, const namespacet &ns)