Deprecate ltl::clone(f) in favor of f->clone().

* src/ltlvisit/clone.hh (clone): Document and declare as deprecated.
* src/ltlast/formula_tree.cc, src/ltlvisit/basicreduce.cc,
src/ltlvisit/clone.cc, src/ltlvisit/contain.cc,
src/ltlvisit/lunabbrev.cc, src/ltlvisit/reduce.cc,
src/ltlvisit/syntimpl.cc, src/tgba/bdddict.cc,
src/tgba/formula2bdd.cc, src/tgba/tgbabddconcretefactory.cc,
src/tgbaalgos/ltl2taa.cc, src/tgbaalgos/ltl2tgba_fm.cc,
src/tgbatest/complementation.cc, wrap/python/tests/ltlsimple.py:
Adjust clone() usage, and remove the #include "clone.hh" when
appropriate.
This commit is contained in:
Alexandre Duret-Lutz 2009-11-08 19:41:40 +01:00
parent e44f1b8997
commit 48fb19ea44
16 changed files with 103 additions and 91 deletions

View file

@ -24,7 +24,6 @@
#include "ltlast/allnodes.hh"
#include <cassert>
#include "clone.hh"
#include "destroy.hh"
namespace spot
@ -95,9 +94,9 @@ namespace spot
unsigned mos = mo->size();
for (unsigned i = 0; i < mos; ++i)
if (is_GF(mo->nth(i)))
resGF->push_back(clone(mo->nth(i)));
resGF->push_back(mo->nth(i)->clone());
else
res1->push_back(clone(mo->nth(i)));
res1->push_back(mo->nth(i)->clone());
destroy(mo);
multop::vec* res3 = new multop::vec;
if (!res1->empty())
@ -330,17 +329,17 @@ namespace spot
if (uo && uo->op() == unop::X)
{
// Xa & Xb = X(a & b)
tmpX->push_back(clone(uo->child()));
tmpX->push_back(uo->child()->clone());
}
else if (is_FG(*i))
{
// FG(a) & FG(b) = FG(a & b)
unop* uo2 = dynamic_cast<unop*>(uo->child());
tmpFG->push_back(clone(uo2->child()));
tmpFG->push_back(uo2->child()->clone());
}
else
{
tmpOther->push_back(clone(*i));
tmpOther->push_back((*i)->clone());
}
}
else if (bo)
@ -360,7 +359,7 @@ namespace spot
&& ftmp == bo2->second())
{
tmpUright
->push_back(clone(bo2->first()));
->push_back(bo2->first()->clone());
if (j != i)
{
destroy(*j);
@ -374,7 +373,7 @@ namespace spot
instance(multop::
And,
tmpUright),
clone(ftmp)));
ftmp->clone()));
}
else if (bo->op() == binop::R)
{
@ -391,7 +390,7 @@ namespace spot
&& ftmp == bo2->first())
{
tmpRright
->push_back(clone(bo2->second()));
->push_back(bo2->second()->clone());
if (j != i)
{
destroy(*j);
@ -401,19 +400,19 @@ namespace spot
}
tmpR
->push_back(binop::instance(binop::R,
clone(ftmp),
ftmp->clone(),
multop::
instance(multop::And,
tmpRright)));
}
else
{
tmpOther->push_back(clone(*i));
tmpOther->push_back((*i)->clone());
}
}
else
{
tmpOther->push_back(clone(*i));
tmpOther->push_back((*i)->clone());
}
destroy(*i);
}
@ -436,22 +435,22 @@ namespace spot
if (uo && uo->op() == unop::X)
{
// Xa | Xb = X(a | b)
tmpX->push_back(clone(uo->child()));
tmpX->push_back(uo->child()->clone());
}
else if (is_GF(*i))
{
// GF(a) | GF(b) = GF(a | b)
unop* uo2 = dynamic_cast<unop*>(uo->child());
tmpGF->push_back(clone(uo2->child()));
tmpGF->push_back(uo2->child()->clone());
}
else if (is_FG(*i))
{
// FG(a) | FG(b) = F(Ga | Gb)
tmpFG->push_back(clone(uo->child()));
tmpFG->push_back(uo->child()->clone());
}
else
{
tmpOther->push_back(clone(*i));
tmpOther->push_back((*i)->clone());
}
}
else if (bo)
@ -471,7 +470,7 @@ namespace spot
&& ftmp == bo2->first())
{
tmpUright
->push_back(clone(bo2->second()));
->push_back(bo2->second()->clone());
if (j != i)
{
destroy(*j);
@ -480,7 +479,7 @@ namespace spot
}
}
tmpU->push_back(binop::instance(binop::U,
clone(ftmp),
ftmp->clone(),
multop::
instance(multop::Or,
tmpUright)));
@ -500,7 +499,7 @@ namespace spot
&& ftmp == bo2->second())
{
tmpRright
->push_back(clone(bo2->first()));
->push_back(bo2->first()->clone());
if (j != i)
{
destroy(*j);
@ -513,16 +512,16 @@ namespace spot
multop::
instance(multop::Or,
tmpRright),
clone(ftmp)));
ftmp->clone()));
}
else
{
tmpOther->push_back(clone(*i));
tmpOther->push_back((*i)->clone());
}
}
else
{
tmpOther->push_back(clone(*i));
tmpOther->push_back((*i)->clone());
}
destroy(*i);
}

View file

@ -87,7 +87,7 @@ namespace spot
formula*
clone_visitor::recurse(formula* f)
{
return clone(f);
return f->clone();
}
formula*

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2003, 2004, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
@ -35,7 +35,7 @@ namespace spot
/// This visitor is public, because it's convenient
/// to derive from it and override part of its methods.
/// But if you just want the functionality, consider using
/// spot::ltl::clone instead.
/// spot::ltl::formula::clone instead, it is way faster.
class clone_visitor : public visitor
{
public:
@ -57,9 +57,17 @@ namespace spot
formula* result_;
};
#if __GNUC__
/// \brief Clone a formula.
/// \ingroup ltl_essential
/// \deprecated Use f->clone() instead.
formula* clone(const formula* f) __attribute__ ((deprecated));
#else
/// \brief Clone a formula.
/// \ingroup ltl_essential
/// \deprecated Use f->clone() instead.
formula* clone(const formula* f);
#endif
}
}

View file

@ -21,7 +21,6 @@
#include "contain.hh"
#include "destroy.hh"
#include "clone.hh"
#include "tunabbrev.hh"
#include "ltlast/unop.hh"
#include "ltlast/binop.hh"
@ -88,7 +87,7 @@ namespace spot
language_containment_checker::contained(const formula* l, const formula* g)
{
record_* rl = register_formula_(l);
const formula* ng = unop::instance(unop::Not, clone(g));
const formula* ng = unop::instance(unop::Not, g->clone());
record_* rng = register_formula_(ng);
destroy(ng);
return incompatible_(rl, rng);
@ -99,9 +98,9 @@ namespace spot
language_containment_checker::neg_contained(const formula* l,
const formula* g)
{
const formula* nl = unop::instance(unop::Not, clone(l));
const formula* nl = unop::instance(unop::Not, l->clone());
record_* rnl = register_formula_(nl);
const formula* ng = unop::instance(unop::Not, clone(g));
const formula* ng = unop::instance(unop::Not, g->clone());
record_* rng = register_formula_(ng);
destroy(nl);
destroy(ng);
@ -135,7 +134,7 @@ namespace spot
const tgba_explicit* e = ltl_to_tgba_fm(f, dict_, exprop_, symb_merge_,
branching_postponement_,
fair_loop_approx_);
record_& r = translated_[clone(f)];
record_& r = translated_[f->clone()];
r.translation = e;
return &r;
}

View file

@ -1,4 +1,4 @@
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2003, 2004, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
@ -20,7 +20,6 @@
// 02111-1307, USA.
#include "ltlast/allnodes.hh"
#include "ltlvisit/clone.hh"
#include "lunabbrev.hh"
#include <cassert>
@ -48,10 +47,10 @@ namespace spot
/* f1 ^ f2 == (f1 & !f2) | (f2 & !f1) */
case binop::Xor:
result_ = multop::instance(multop::Or,
multop::instance(multop::And, clone(f1),
multop::instance(multop::And, f1->clone(),
unop::instance(unop::Not,
f2)),
multop::instance(multop::And, clone(f2),
multop::instance(multop::And, f2->clone(),
unop::instance(unop::Not,
f1)));
return;
@ -64,7 +63,7 @@ namespace spot
case binop::Equiv:
result_ = multop::instance(multop::Or,
multop::instance(multop::And,
clone(f1), clone(f2)),
f1->clone(), f2->clone()),
multop::instance(multop::And,
unop::instance(unop::Not,
f1),

View file

@ -314,7 +314,7 @@ namespace spot
}
else
{
prev = clone(f);
prev = f->clone();
}
f1 = unabbreviate_logic(f);
f2 = simplify_f_g(f1);

View file

@ -1,4 +1,4 @@
// Copyright (C) 2004, 2005 Laboratoire d'Informatique de Paris 6 (LIP6),
// Copyright (C) 2004, 2005, 2009 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
// et Marie Curie.
//
@ -404,7 +404,7 @@ namespace spot
/* F(a) = true U a */
const formula* tmp = binop::instance(binop::U,
constant::true_instance(),
clone(f1));
f1->clone());
if (special_case(tmp))
{
result_ = true;
@ -421,7 +421,7 @@ namespace spot
/* G(a) = false R a */
const formula* tmp = binop::instance(binop::R,
constant::false_instance(),
clone(f1));
f1->clone());
if (special_case(tmp))
{
result_ = true;
@ -573,8 +573,8 @@ namespace spot
bool
syntactic_implication_neg(const formula* f1, const formula* f2, bool right)
{
formula* l = clone(f1);
formula* r = clone(f2);
formula* l = f1->clone();
formula* r = f2->clone();
if (right)
r = unop::instance(unop::Not, r);
else