Add virtual destructors on base classes.

This commit is contained in:
Alexander Arlt 2018-05-02 13:29:16 +02:00
parent 5cce2e552b
commit f94b793472
11 changed files with 19 additions and 0 deletions

View File

@ -67,6 +67,7 @@ public:
explicit ConstantOptimisationMethod(Params const& _params, u256 const& _value):
m_params(_params), m_value(_value) {}
virtual ~ConstantOptimisationMethod() = default;
virtual bigint gasNeeded() const = 0;
/// Executes the method, potentially appending to the assembly and returns a vector of
/// assembly items the constant should be relpaced with in one sweep.

View File

@ -34,6 +34,7 @@ using AssemblyItems = std::vector<AssemblyItem>;
class PeepholeOptimisationMethod
{
public:
virtual ~PeepholeOptimisationMethod() = default;
virtual size_t windowSize() const;
virtual bool apply(AssemblyItems::const_iterator _in, std::back_insert_iterator<AssemblyItems> _out);
};
@ -42,6 +43,7 @@ class PeepholeOptimiser
{
public:
explicit PeepholeOptimiser(AssemblyItems& _items): m_items(_items) {}
virtual ~PeepholeOptimiser() = default;
bool optimise();

View File

@ -37,6 +37,7 @@ namespace julia
class ExpressionCopier: public boost::static_visitor<Expression>
{
public:
virtual ~ExpressionCopier() = default;
virtual Expression operator()(Literal const& _literal) = 0;
virtual Expression operator()(Identifier const& _identifier) = 0;
virtual Expression operator()(FunctionalInstruction const& _instr) = 0;
@ -46,6 +47,7 @@ public:
class StatementCopier: public boost::static_visitor<Statement>
{
public:
virtual ~StatementCopier() = default;
virtual Statement operator()(ExpressionStatement const& _statement) = 0;
virtual Statement operator()(Instruction const& _instruction) = 0;
virtual Statement operator()(Label const& _label) = 0;
@ -66,6 +68,7 @@ public:
class ASTCopier: public ExpressionCopier, public StatementCopier
{
public:
virtual ~ASTCopier() = default;
virtual Expression operator()(Literal const& _literal) override;
virtual Statement operator()(Instruction const& _instruction) override;
virtual Expression operator()(Identifier const& _identifier) override;

View File

@ -42,6 +42,7 @@ namespace julia
class ASTWalker: public boost::static_visitor<>
{
public:
virtual ~ASTWalker() = default;
virtual void operator()(Literal const&) {}
virtual void operator()(Instruction const&) { solAssert(false, ""); }
virtual void operator()(Identifier const&) {}
@ -82,6 +83,7 @@ protected:
class ASTModifier: public boost::static_visitor<>
{
public:
virtual ~ASTModifier() = default;
virtual void operator()(Literal&) {}
virtual void operator()(Instruction&) { solAssert(false, ""); }
virtual void operator()(Identifier&) {}

View File

@ -146,6 +146,7 @@ private:
class Scopable
{
public:
virtual ~Scopable() = default;
/// @returns the scope this declaration resides in. Can be nullptr if it is the global scope.
/// Available only after name and type resolution step.
ASTNode const* scope() const { return m_scope; }
@ -307,6 +308,7 @@ private:
class VariableScope
{
public:
virtual ~VariableScope() = default;
void addLocalVariable(VariableDeclaration const& _localVariable) { m_localVariables.push_back(&_localVariable); }
std::vector<VariableDeclaration const*> const& localVariables() const { return m_localVariables; }
@ -320,6 +322,7 @@ private:
class Documented
{
public:
virtual ~Documented() = default;
explicit Documented(ASTPointer<ASTString> const& _documentation): m_documentation(_documentation) {}
/// @return A shared pointer of an ASTString.
@ -336,6 +339,7 @@ protected:
class ImplementationOptional
{
public:
virtual ~ImplementationOptional() = default;
explicit ImplementationOptional(bool _implemented): m_implemented(_implemented) {}
/// @return whether this node is fully implemented or not

View File

@ -43,6 +43,7 @@ namespace solidity
class ASTVisitor
{
public:
virtual ~ASTVisitor() = default;
virtual bool visit(SourceUnit& _node) { return visitNode(_node); }
virtual bool visit(PragmaDirective& _node) { return visitNode(_node); }
virtual bool visit(ImportDirective& _node) { return visitNode(_node); }
@ -147,6 +148,7 @@ protected:
class ASTConstVisitor
{
public:
virtual ~ASTConstVisitor() = default;
virtual bool visit(SourceUnit const& _node) { return visitNode(_node); }
virtual bool visit(PragmaDirective const& _node) { return visitNode(_node); }
virtual bool visit(ImportDirective const& _node) { return visitNode(_node); }

View File

@ -138,6 +138,7 @@ private:
class Type: private boost::noncopyable, public std::enable_shared_from_this<Type>
{
public:
virtual ~Type() = default;
enum class Category
{
Integer, RationalNumber, StringLiteral, Bool, FixedPoint, Array,

View File

@ -193,6 +193,7 @@ DEV_SIMPLE_EXCEPTION(SolverError);
class SolverInterface
{
public:
virtual ~SolverInterface() = default;
virtual void reset() = 0;
virtual void push() = 0;

View File

@ -40,6 +40,7 @@ public:
Declaration const& _decl,
smt::SolverInterface& _interface
);
virtual ~SymbolicVariable() = default;
smt::Expression operator()(int _seq) const
{

View File

@ -53,6 +53,7 @@ class ExecutionFramework
public:
ExecutionFramework();
virtual ~ExecutionFramework() = default;
virtual bytes const& compileAndRunWithoutCheck(
std::string const& _sourceCode,

View File

@ -52,6 +52,7 @@ protected:
bool _insertVersionPragma = true,
bool _allowMultipleErrors = false
);
virtual ~AnalysisFramework() = default;
SourceUnit const* parseAndAnalyse(std::string const& _source);
bool success(std::string const& _source);