Пример #1
0
void Pickler::toPickle(Expr e, Pickle& p)
{
  Assert(NodeManager::fromExprManager(e.getExprManager()) == d_private->d_nm);
  Assert(d_private->atDefaultState());

  try{
    d_private->d_current.swap(*p.d_data);
    d_private->toCaseNode(e.getTNode());
    d_private->d_current.swap(*p.d_data);
  }catch(PicklingException& pe){
    d_private->d_current = PickleData();
    Assert(d_private->atDefaultState());
    throw pe;
  }

  Assert(d_private->atDefaultState());
}
Пример #2
0
void Pickler::debugPickleTest(Expr e) {

  //ExprManager *em = e.getExprManager();
  //Expr e1 = mkVar("x", makeType());
  //return ;

  Pickler pickler(e.getExprManager());

  Pickle p;
  pickler.toPickle(e, p);

  uint32_t size = p.d_data->size();
  std::string str = p.d_data->toString();

  Expr from = pickler.fromPickle(p);
  ExprManagerScope ems(e);

  Debug("pickle") << "before: " << e << std::endl;
  Debug("pickle") << "after: " << from.getNode() << std::endl;
  Debug("pickle") << "pickle: (oct) "<< size << " " << str.length() << " " << str << std::endl;

  Assert(p.d_data->empty());
  Assert(e == from);
}