void goto_program_dereferencet::dereference_instruction( goto_programt::targett target, bool checks_only) { current_target=target; #if 0 valid_local_variables=&target->local_variables; #endif goto_programt::instructiont &i=*target; dereference_expr(i.guard, checks_only, value_set_dereferencet::READ); if(i.is_assign()) { if(i.code.operands().size()!=2) throw "assignment expects two operands"; dereference_expr(i.code.op0(), checks_only, value_set_dereferencet::WRITE); dereference_expr(i.code.op1(), checks_only, value_set_dereferencet::READ); } else if(i.is_function_call()) { code_function_callt &function_call=to_code_function_call(to_code(i.code)); if(function_call.lhs().is_not_nil()) dereference_expr(function_call.lhs(), checks_only, value_set_dereferencet::WRITE); dereference_expr(function_call.function(), checks_only, value_set_dereferencet::READ); dereference_expr(function_call.op2(), checks_only, value_set_dereferencet::READ); } else if(i.is_return()) { Forall_operands(it, i.code) dereference_expr(*it, checks_only, value_set_dereferencet::READ); } else if(i.is_other()) { const irep_idt &statement=i.code.get(ID_statement); if(statement==ID_expression) { if(i.code.operands().size()!=1) throw "expression expects one operand"; dereference_expr(i.code.op0(), checks_only, value_set_dereferencet::READ); } else if(statement==ID_printf) { Forall_operands(it, i.code) dereference_expr(*it, checks_only, value_set_dereferencet::READ); } } }
void goto_program_dereferencet::dereference_expression( goto_programt::const_targett target, exprt &expr) { current_target=target; #if 0 valid_local_variables=&target->local_variables; #endif dereference_expr(expr, false, value_set_dereferencet::modet::READ); }