/*******************************************************************\

Module: Invariant Set Domain

Author: Daniel Kroening, kroening@kroening.com

\*******************************************************************/

#include <simplify_expr.h>

#include "invariant_set_domain.h"

/*******************************************************************\

Function: invariant_set_domaint::transform

  Inputs:

 Outputs:

 Purpose:

\*******************************************************************/

void invariant_set_domaint::transform(
  const namespacet &ns,
  locationt from_l,
  locationt to_l)
{
  switch(from_l->type)
  {
  case GOTO:
    {
      exprt tmp(get_guard(from_l, to_l));
      simplify(tmp);
      invariant_set.strengthen(tmp);
    }
    break;
    
  case ASSERT:
  case ASSUME:
    {
      exprt tmp(from_l->guard);
      simplify(tmp);
      invariant_set.strengthen(tmp);
    }
    break;
    
  case RETURN:
    // ignore
    break;
  
  case OTHER:
    if(from_l->code.is_not_nil())
      invariant_set.apply_code(to_code(from_l->code));
    break;
  
  case START_THREAD:
    invariant_set.make_threaded(); 
    break;
  
  default:;
    // do nothing
  }
}
