36 new_symbol.
value=expr;
42 result.add_source_location()=source_location;
50 convert(code_assign, dest, mode);
64 if(expr.
id()==ID_dereference ||
65 expr.
id()==ID_side_effect ||
66 expr.
id()==ID_compound_literal ||
70 if(expr.
id()==ID_index)
96 if(expr.
id()==ID_forall || expr.
id()==ID_exists)
109 assert(expr.
id()==ID_and || expr.
id()==ID_or);
114 error() <<
"`" << expr.
id() <<
"' must be Boolean, but got " 124 if(expr.
id()==ID_and)
132 for(exprt::operandst::reverse_iterator
142 error() <<
"`" << expr.
id() <<
"' takes Boolean " 143 <<
"operands only, but got " << op.
pretty() <<
eom;
147 if(expr.
id()==ID_and)
179 if(expr.
id()==ID_and || expr.
id()==ID_or)
188 else if(expr.
id()==ID_if)
204 error() <<
"first argument of `if' must be boolean, but got " 245 assignment_true.rhs()=if_expr.
true_case();
247 convert(assignment_true, tmp_true, mode);
253 convert(assignment_false, tmp_false, mode);
267 convert(code_expression, tmp_true, mode);
276 convert(code_expression, tmp_false, mode);
284 if_expr.
cond(), tmp_true, tmp_false, source_location, dest, mode);
288 else if(expr.
id()==ID_comma)
296 bool last=(it==--expr.
operands().end());
332 else if(expr.
id()==ID_typecast)
337 error() <<
"typecast takes one argument" <<
eom;
349 else if(expr.
id()==ID_side_effect)
354 if(statement==ID_gcc_conditional_expression)
360 else if(statement==ID_statement_expression)
368 else if(statement==ID_assign)
373 if(expr.
op1().
id()==ID_side_effect &&
381 assignment.
lhs()=lhs;
382 assignment.
rhs()=expr.
op1();
393 else if(statement==ID_function_call)
398 function()).get_identifier()==
"__noop")
406 else if(expr.
id()==ID_forall || expr.
id()==ID_exists)
412 if(tmp.instructions.empty())
415 error() <<
"no side-effects in quantified expressions allowed" 421 else if(expr.
id()==ID_address_of)
433 if(expr.
id()==ID_side_effect)
437 else if(expr.
id()==ID_compound_literal)
453 if(expr.
id()==ID_compound_literal)
459 else if(expr.
id()==ID_string_constant)
464 else if(expr.
id()==ID_index)
470 else if(expr.
id()==ID_dereference)
475 else if(expr.
id()==ID_comma)
484 bool last=(it==--expr.
operands().end());
517 error() <<
"conditional_expression takes two operands" <<
eom;
528 if_expr.true_case()=expr.
op0();
529 if_expr.false_case()=expr.
op1();
const if_exprt & to_if_expr(const exprt &expr)
Cast a generic exprt to an if_exprt.
side_effect_expr_function_callt & to_side_effect_expr_function_call(exprt &expr)
std::string pretty(unsigned indent=0, unsigned max_indent=0) const
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'
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.
exprt value
Initial value of symbol.
The trinary if-then-else operator.
void clean_expr_address_of(exprt &expr, goto_programt &dest, const irep_idt &mode)
Symbol table entry.This is a symbol in the symbol table, stored in an object of type symbol_tablet...
static mstreamt & eom(mstreamt &m)
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 declaration of a local variable.
const source_locationt & find_source_location() const
source_locationt source_location
API to expression classes.
void convert_assign(const code_assignt &code, goto_programt &dest, const irep_idt &mode)
#define forall_operands(it, expr)
const symbol_exprt & to_symbol_expr(const exprt &expr)
Cast a generic exprt to a symbol_exprt.
dstringt has one field, an unsigned integer no which is an index into a static table of strings...
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)
exprt::operandst & arguments()
symbol_table_baset & symbol_table
A removal of a local variable.
#define Forall_operands(it, expr)
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)
void rewrite_boolean(exprt &dest)
re-write boolean operators into ?:
const index_exprt & to_index_expr(const exprt &expr)
Cast a generic exprt to an index_exprt.
const irep_idt & get_statement() const
bool simplify(exprt &expr, const namespacet &ns)