Example #1
0
void symex_slicet::collect_open_variables(
  const symex_target_equationt &equation, 
  symbol_sett &open_variables)
{
  symbol_sett lhs;

  for(symex_target_equationt::SSA_stepst::const_iterator
      it=equation.SSA_steps.begin();
      it!=equation.SSA_steps.end();
      it++)
  {
    const symex_target_equationt::SSA_stept &SSA_step=*it;

    get_symbols(SSA_step.guard_expr);

    switch(SSA_step.type)
    {
    case goto_trace_stept::ASSERT:
      get_symbols(SSA_step.cond_expr);
      break;

    case goto_trace_stept::ASSUME:
      get_symbols(SSA_step.cond_expr);
      break;

    case goto_trace_stept::LOCATION:
      // ignore
      break;

    case goto_trace_stept::ASSIGNMENT:
      get_symbols(SSA_step.rhs);
      lhs.insert(SSA_step.lhs.get(ID_identifier));
      break;

    case goto_trace_stept::OUTPUT:
      break;

    default:
      assert(false);  
    }
  }
  
  open_variables=depends;
  
  // remove the ones that are defined
  open_variables.erase(lhs.begin(), lhs.end());
}
Example #2
0
void symex_slicet::collect_open_variables(
  const symex_target_equationt &equation, 
  symbol_sett &open_variables)
{
  symbol_sett lhs;

  for(symex_target_equationt::SSA_stepst::const_iterator
      it=equation.SSA_steps.begin();
      it!=equation.SSA_steps.end();
      it++)
  {
    const symex_target_equationt::SSA_stept &SSA_step=*it;

    get_symbols(SSA_step.guard);

    switch(SSA_step.type)
    {
    case goto_trace_stept::ASSERT:
      get_symbols(SSA_step.cond_expr);
      break;

    case goto_trace_stept::ASSUME:
      get_symbols(SSA_step.cond_expr);
      break;

    case goto_trace_stept::LOCATION:
      // ignore
      break;

    case goto_trace_stept::ASSIGNMENT:
      get_symbols(SSA_step.ssa_rhs);
      lhs.insert(SSA_step.ssa_lhs.get_identifier());
      break;

    case goto_trace_stept::OUTPUT:
    case goto_trace_stept::INPUT:
    case goto_trace_stept::DEAD:
    case goto_trace_stept::NONE:
      break;

    case goto_trace_stept::DECL:
    case goto_trace_stept::FUNCTION_CALL:
    case goto_trace_stept::FUNCTION_RETURN:
    case goto_trace_stept::CONSTRAINT:
    case goto_trace_stept::SHARED_READ:
    case goto_trace_stept::SHARED_WRITE:
    case goto_trace_stept::ATOMIC_BEGIN:
    case goto_trace_stept::ATOMIC_END:
    case goto_trace_stept::SPAWN:
    case goto_trace_stept::MEMORY_BARRIER:
      // ignore for now
      break;

    default:
      assert(false);  
    }
  }
  
  open_variables=depends;
  
  // remove the ones that are defined
  open_variables.erase(lhs.begin(), lhs.end());
}