Commit 5d272fd2 authored by Alexandre Duret-Lutz's avatar Alexandre Duret-Lutz
Browse files

use more override and final keywords

This patch is mostly focused on tagging most virtual methods that
override as such.  I found a few methods that where not meant to be
virtual this way, and tagged a few classes "final" along the way.

* bin/common_output.cc, spot/kripke/fairkripke.hh,
spot/kripke/kripke.hh, spot/kripke/kripkegraph.hh,
spot/ltsmin/ltsmin.cc, spot/misc/formater.hh, spot/priv/bddalloc.hh,
spot/ta/ta.hh, spot/ta/taexplicit.hh, spot/ta/taproduct.hh,
spot/ta/tgta.hh, spot/ta/tgtaexplicit.cc, spot/ta/tgtaexplicit.hh,
spot/ta/tgtaproduct.hh, spot/taalgos/emptinessta.hh, spot/tl/declenv.hh,
spot/tl/defaultenv.hh, spot/tl/randomltl.hh, spot/tl/relabel.cc,
spot/twa/bdddict.cc, spot/twa/taatgba.hh, spot/twa/twagraph.hh,
spot/twa/twaproduct.hh, spot/twaalgos/gtec/ce.cc,
spot/twaalgos/gtec/ce.hh, spot/twaalgos/gtec/gtec.hh,
spot/twaalgos/gv04.cc, spot/twaalgos/ltl2taa.cc, spot/twaalgos/magic.cc,
spot/twaalgos/minimize.cc, spot/twaalgos/ndfs_result.hxx,
spot/twaalgos/reachiter.hh, spot/twaalgos/se05.cc,
spot/twaalgos/stutter.cc, spot/twaalgos/tau03.cc: Add more override and
final keywords.
parent 1ae0600c
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013, 2014, 2015 Laboratoire de Recherche et
// Copyright (C) 2012, 2013, 2014, 2015, 2016 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
......@@ -165,7 +165,7 @@ namespace
}
virtual void
print(std::ostream& os, const char*) const
print(std::ostream& os, const char*) const override
{
stream_escapable_formula(os, val_->f, val_->filename, val_->line);
}
......
......@@ -54,8 +54,8 @@ namespace spot
fair_kripke_succ_iterator(const bdd& cond, acc_cond::mark_t acc_cond);
virtual ~fair_kripke_succ_iterator();
virtual bdd cond() const;
virtual acc_cond::mark_t acc() const;
virtual bdd cond() const override;
virtual acc_cond::mark_t acc() const override;
protected:
bdd cond_;
acc_cond::mark_t acc_cond_;
......
......@@ -59,8 +59,8 @@ namespace spot
virtual ~kripke_succ_iterator();
virtual bdd cond() const;
virtual acc_cond::mark_t acc() const;
virtual bdd cond() const override;
virtual acc_cond::mark_t acc() const override;
protected:
bdd cond_;
};
......
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013, 2014, 2015 Laboratoire de Recherche
// et Développement de l'Epita (LRDE)
// Copyright (C) 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire de
// Recherche et Développement de l'Epita (LRDE)
//
// This file is part of Spot, a model checking library.
//
......@@ -39,7 +39,7 @@ namespace spot
{
}
virtual int compare(const spot::state* other) const
virtual int compare(const spot::state* other) const override
{
auto o = down_cast<const kripke_graph_state*>(other);
assert(o);
......@@ -52,19 +52,19 @@ namespace spot
return 0;
}
virtual size_t hash() const
virtual size_t hash() const override
{
return
reinterpret_cast<const char*>(this) - static_cast<const char*>(nullptr);
}
virtual kripke_graph_state*
clone() const
clone() const override
{
return const_cast<kripke_graph_state*>(this);
}
virtual void destroy() const
virtual void destroy() const override
{
}
......@@ -104,30 +104,30 @@ namespace spot
{
}
virtual void recycle(const typename Graph::state_storage_t* s)
void recycle(const typename Graph::state_storage_t* s)
{
cond_ = s->cond();
t_ = s->succ;
}
virtual bool first()
virtual bool first() override
{
p_ = t_;
return p_;
}
virtual bool next()
virtual bool next() override
{
p_ = g_->edge_storage(p_).next_succ;
return p_;
}
virtual bool done() const
virtual bool done() const override
{
return !p_;
}
virtual kripke_graph_state* dst() const
virtual kripke_graph_state* dst() const override
{
assert(!done());
return const_cast<kripke_graph_state*>
......@@ -138,7 +138,7 @@ namespace spot
/// \class kripke_graph
/// \brief Kripke Structure.
class SPOT_API kripke_graph : public kripke
class SPOT_API kripke_graph final : public kripke
{
public:
typedef digraph<kripke_graph_state, void> graph_t;
......@@ -180,7 +180,7 @@ namespace spot
return init_number_;
}
virtual const kripke_graph_state* get_init_state() const
virtual const kripke_graph_state* get_init_state() const override
{
if (num_states() == 0)
const_cast<graph_t&>(g_).new_state();
......@@ -190,7 +190,7 @@ namespace spot
/// \brief Allow to get an iterator on the state we passed in
/// parameter.
virtual kripke_graph_succ_iterator<graph_t>*
succ_iter(const spot::state* st) const
succ_iter(const spot::state* st) const override
{
auto s = down_cast<const typename graph_t::state_storage_t*>(st);
assert(s);
......@@ -235,13 +235,13 @@ namespace spot
return ss.str();
}
virtual std::string format_state(const state* st) const
virtual std::string format_state(const state* st) const override
{
return format_state(state_number(st));
}
/// \brief Get the condition on the state
virtual bdd state_condition(const state* s) const
virtual bdd state_condition(const state* s) const override
{
return down_cast<const kripke_graph_state*>(s)->cond();
}
......
......@@ -258,7 +258,7 @@ namespace spot
////////////////////////////////////////////////////////////////////////
// SUCC_ITERATOR
class spins_succ_iterator: public kripke_succ_iterator
class spins_succ_iterator final: public kripke_succ_iterator
{
public:
......@@ -280,28 +280,24 @@ namespace spot
delete cc_;
}
virtual
bool first()
virtual bool first() override
{
it_ = cc_->transitions.begin();
return it_ != cc_->transitions.end();
}
virtual
bool next()
virtual bool next() override
{
++it_;
return it_ != cc_->transitions.end();
}
virtual
bool done() const
virtual bool done() const override
{
return it_ == cc_->transitions.end();
}
virtual
state* dst() const
virtual state* dst() const override
{
return (*it_)->clone();
}
......@@ -605,7 +601,7 @@ namespace spot
////////////////////////////////////////////////////////////////////////
// KRIPKE
class spins_kripke: public kripke
class spins_kripke final: public kripke
{
public:
......@@ -615,7 +611,7 @@ namespace spot
: kripke(dict),
d_(d),
state_size_(d_->get_state_size()),
dict_(dict), ps_(ps),
ps_(ps),
compress_(compress == 0 ? nullptr
: compress == 1 ? int_array_array_compress
: int_array_array_compress2),
......@@ -696,8 +692,7 @@ namespace spot
delete state_condition_last_cc_; // Might be 0 already.
}
virtual
state* get_init_state() const
virtual state* get_init_state() const override
{
if (compress_)
{
......@@ -848,8 +843,7 @@ namespace spot
virtual
spins_succ_iterator*
succ_iter(const state* st) const
spins_succ_iterator* succ_iter(const state* st) const override
{
// This may also compute successors in state_condition_last_cc
bdd scond = compute_state_condition(st);
......@@ -882,14 +876,13 @@ namespace spot
}
virtual
bdd
state_condition(const state* st) const
bdd state_condition(const state* st) const override
{
return compute_state_condition(st);
}
virtual
std::string format_state(const state *st) const
std::string format_state(const state *st) const override
{
const int* vars = get_vars(st);
......@@ -917,16 +910,9 @@ namespace spot
return res.str();
}
virtual
spot::bdd_dict_ptr get_dict() const
{
return dict_;
}
private:
spins_interface_ptr d_;
int state_size_;
bdd_dict_ptr dict_;
const char** vname_;
bool* format_filter_;
const spot::prop_set* ps_;
......
// -*- coding: utf-8 -*-
// Copyright (C) 2012, 2013 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2012, 2013, 2016 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
......@@ -72,7 +72,7 @@ namespace spot
}
virtual void
print(std::ostream& os, const char*) const
print(std::ostream& os, const char*) const override
{
os << val_;
}
......@@ -83,7 +83,7 @@ namespace spot
{
public:
virtual void
print(std::ostream& os, const char* x) const
print(std::ostream& os, const char* x) const override
{
os << '%' << *x;
}
......@@ -94,7 +94,7 @@ namespace spot
{
public:
virtual void
print(std::ostream& os, const char*) const
print(std::ostream& os, const char*) const override
{
os << '%';
}
......
// -*- coding: utf-8 -*-
// Copyright (C) 2013 Laboratoire de Recherche et Développement
// Copyright (C) 2013, 2016 Laboratoire de Recherche et Développement
// de l'Epita (LRDE).
// Copyright (C) 2003, 2004 Laboratoire d'Informatique de Paris 6 (LIP6),
// département Systèmes Répartis Coopératifs (SRC), Université Pierre
......@@ -49,6 +49,6 @@ namespace spot
private:
/// Require more variables.
void extvarnum(int more);
virtual int extend(int n);
virtual int extend(int n) override;
};
}
......@@ -201,20 +201,10 @@ namespace spot
~ta_succ_iterator()
{
}
virtual bool first() = 0;
virtual bool next() = 0;
virtual bool done() const = 0;
virtual const state* dst() const = 0;
/// \brief Get the changeset on the transition leading to current successor.
///
/// This is a boolean function of atomic propositions.
virtual bdd cond() const = 0;
acc_cond::mark_t acc() const = 0;
};
#ifndef SWIG
......
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire
// de Recherche et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
......@@ -64,38 +64,35 @@ namespace spot
// ta interface
virtual
~ta_explicit();
virtual const_states_set_t
get_initial_states_set() const;
virtual const_states_set_t get_initial_states_set() const override;
virtual ta_succ_iterator*
succ_iter(const spot::state* s) const;
virtual ta_succ_iterator* succ_iter(const spot::state* s) const override;
virtual ta_succ_iterator*
succ_iter(const spot::state* s, bdd condition) const;
succ_iter(const spot::state* s, bdd condition) const override;
virtual bdd_dict_ptr
get_dict() const;
bdd_dict_ptr get_dict() const;
virtual std::string
format_state(const spot::state* s) const;
format_state(const spot::state* s) const override;
virtual bool
is_accepting_state(const spot::state* s) const;
is_accepting_state(const spot::state* s) const override;
virtual bool
is_livelock_accepting_state(const spot::state* s) const;
is_livelock_accepting_state(const spot::state* s) const override;
virtual bool
is_initial_state(const spot::state* s) const;
is_initial_state(const spot::state* s) const override;
virtual bdd
get_state_condition(const spot::state* s) const;
get_state_condition(const spot::state* s) const override;
virtual void
free_state(const spot::state* s) const;
free_state(const spot::state* s) const override;
spot::state*
get_artificial_initial_state() const
virtual spot::state*
get_artificial_initial_state() const override
{
return (spot::state*) artificial_initial_state_;
}
......@@ -107,7 +104,7 @@ namespace spot
}
virtual void
void
delete_stuttering_and_hole_successors(const spot::state* s);
ta::states_set_t
......@@ -129,7 +126,7 @@ namespace spot
/// states used by spot::ta_explicit.
/// \ingroup ta_representation
class SPOT_API state_ta_explicit : public spot::state
class SPOT_API state_ta_explicit final: public spot::state
{
#ifndef SWIG
public:
......@@ -156,15 +153,11 @@ namespace spot
{
}
virtual int
compare(const spot::state* other) const;
virtual size_t
hash() const;
virtual state_ta_explicit*
clone() const;
virtual int compare(const spot::state* other) const override;
virtual size_t hash() const override;
virtual state_ta_explicit* clone() const override;
virtual void
destroy() const
virtual void destroy() const override
{
}
......@@ -227,21 +220,21 @@ namespace spot
};
/// Successor iterators used by spot::ta_explicit.
class SPOT_API ta_explicit_succ_iterator : public ta_succ_iterator
class SPOT_API ta_explicit_succ_iterator final: public ta_succ_iterator
{
public:
ta_explicit_succ_iterator(const state_ta_explicit* s);
ta_explicit_succ_iterator(const state_ta_explicit* s, bdd condition);
virtual bool first();
virtual bool next();
virtual bool done() const;
virtual bool first() override;
virtual bool next() override;
virtual bool done() const override;
virtual const state* dst() const;
virtual bdd cond() const;
virtual const state* dst() const override;
virtual bdd cond() const override;
virtual acc_cond::mark_t acc() const;
virtual acc_cond::mark_t acc() const override;
private:
state_ta_explicit::transitions* transitions_;
......
// -*- coding: utf-8 -*-
// Copyright (C) 2011, 2012, 2013, 2014 Laboratoire de Recherche et
// Développement de l'Epita (LRDE).
// Copyright (C) 2011, 2012, 2013, 2014, 2016 Laboratoire de Recherche
// et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
......@@ -60,11 +60,11 @@ namespace spot
}
virtual int
compare(const state* other) const;
compare(const state* other) const override;
virtual size_t
hash() const;
hash() const override;
virtual state_ta_product*
clone() const;
clone() const override;
private:
const state* ta_state_; ///< State from the ta automaton.
......@@ -82,22 +82,17 @@ namespace spot
~ta_succ_iterator_product();
// iteration
bool first();
bool next();
bool done() const;
virtual bool first() override;
virtual bool next() override;
virtual bool done() const override;
// inspection
state_ta_product*
dst() const;
bdd
cond() const;
acc_cond::mark_t
acc() const;
virtual state_ta_product* dst() const override;
virtual bdd cond() const override;
virtual acc_cond::mark_t acc() const override;
/// \brief Return true if the changeset of the current transition is empty
bool
is_stuttering_transition() const;
bool is_stuttering_transition() const;
protected:
//@{
......@@ -129,7 +124,7 @@ namespace spot
/// \ingroup ta_emptiness_check
/// \brief A lazy product between a Testing automaton and a Kripke structure.
/// (States are computed on the fly.)
class SPOT_API ta_product: public ta
class SPOT_API ta_product final: public ta
{
public:
/// \brief Constructor.
......@@ -142,39 +137,39 @@ namespace spot
~ta_product();
virtual ta::const_states_set_t
get_initial_states_set() const;
get_initial_states_set() const override;
virtual ta_succ_iterator_product*
succ_iter(const spot::state* s) const;
succ_iter(const spot::state* s) const override;
virtual ta_succ_iterator_product*
succ_iter(const spot::state* s, bdd changeset) const;
succ_iter(const spot::state* s, bdd changeset) const override;
virtual bdd_dict_ptr
bdd_dict_ptr
get_dict() const;
virtual std::string
format_state(const spot::state* s) const;
format_state(const spot::state* s) const override;
virtual bool
is_accepting_state(const spot::state* s) const;
is_accepting_state(const spot::state* s) const override;
virtual bool
is_livelock_accepting_state(const spot::state* s) const;
is_livelock_accepting_state(const spot::state* s) const override;
virtual bool
is_initial_state(const spot::state* s) const;
is_initial_state(const spot::state* s) const override;
/// \brief Return true if the state \a s has no succeseurs
/// in the TA automaton (the TA component of the product automaton)
virtual bool
bool
is_hole_state_in_ta_component(const spot::state* s) const;
virtual bdd
get_state_condition(const spot::state* s) const;
get_state_condition(const spot::state* s) const override;
virtual void
free_state(const spot::state* s) const;
free_state(const spot::state* s) const override;
const const_ta_ptr&
get_ta() const
......
// -*- coding: utf-8 -*-
// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015 Laboratoire de
// Recherche et Développement de l'Epita (LRDE).
// Copyright (C) 2010, 2011, 2012, 2013, 2014, 2015, 2016 Laboratoire
// de Recherche et Développement de l'Epita (LRDE).
//
// This file is part of Spot, a model checking library.
//
......@@ -79,7 +79,7 @@ namespace spot
/// longer needed.
///
virtual twa_succ_iterator*
succ_iter_by_changeset(const spot::state* s, bdd change_set) const =0;
succ_iter_by_changeset(const spot::state* s, bdd change_set) const = 0;
};
typedef std::shared_ptr<tgta> tgta_ptr;
......
......@@ -44,12 +44,6 @@ namespace spot
return ta_->succ_iter(state);
}
bdd_dict_ptr
tgta_explicit::get_dict() const
{
return ta_->get_dict();
}
std::string
tgta_explicit::format_state(const spot::state* s) const
{
......
......@@ -34,7 +34,7 @@ namespace spot
/// Explicit representation of a spot::tgta.
/// \ingroup ta_representation
class SPOT_API tgta_explicit : public tgta
class SPOT_API tgta_explicit final : public tgta
{
public:
tgta_explicit(const const_twa_ptr& tgba,
......@@ -42,21 +42,18 @@ namespace spot
state_ta_explicit* artificial_initial_state);
// tgba interface
virtual spot::state* get_init_state() const;
virtual spot::state* get_init_state() const override;
virtual twa_succ_iterator*
succ_iter(const spot::state* local_state) const;
virtual bdd_dict_ptr
get_dict() const;
succ_iter(const spot::state* local_state) const override;
const_ta_explicit_ptr get_ta() const { return ta_; }
ta_explicit_ptr get_ta() {<