aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-05-02 21:27:16 +0800
committerGitHub <noreply@github.com>2018-05-02 21:27:16 +0800
commitdc18cde66f9dca1cfe93f04a376e9c20a4614328 (patch)
treeb017d487890f286a05e5cfe97215f5e2a3985bb8
parent5cce2e552baf1f7431c99500da74cb929360c3b8 (diff)
parentf94b793472a8427e0507862cd5595cc92e70f53c (diff)
downloaddexon-solidity-dc18cde66f9dca1cfe93f04a376e9c20a4614328.tar
dexon-solidity-dc18cde66f9dca1cfe93f04a376e9c20a4614328.tar.gz
dexon-solidity-dc18cde66f9dca1cfe93f04a376e9c20a4614328.tar.bz2
dexon-solidity-dc18cde66f9dca1cfe93f04a376e9c20a4614328.tar.lz
dexon-solidity-dc18cde66f9dca1cfe93f04a376e9c20a4614328.tar.xz
dexon-solidity-dc18cde66f9dca1cfe93f04a376e9c20a4614328.tar.zst
dexon-solidity-dc18cde66f9dca1cfe93f04a376e9c20a4614328.zip
Merge pull request #4040 from aarlt/virtual-destructors
Add virtual destructors on base classes.
-rw-r--r--libevmasm/ConstantOptimiser.h1
-rw-r--r--libevmasm/PeepholeOptimiser.h2
-rw-r--r--libjulia/optimiser/ASTCopier.h3
-rw-r--r--libjulia/optimiser/ASTWalker.h2
-rw-r--r--libsolidity/ast/AST.h4
-rw-r--r--libsolidity/ast/ASTVisitor.h2
-rw-r--r--libsolidity/ast/Types.h1
-rw-r--r--libsolidity/formal/SolverInterface.h1
-rw-r--r--libsolidity/formal/SymbolicVariable.h1
-rw-r--r--test/ExecutionFramework.h1
-rw-r--r--test/libsolidity/AnalysisFramework.h1
11 files changed, 19 insertions, 0 deletions
diff --git a/libevmasm/ConstantOptimiser.h b/libevmasm/ConstantOptimiser.h
index 9b60b26b..f0deb387 100644
--- a/libevmasm/ConstantOptimiser.h
+++ b/libevmasm/ConstantOptimiser.h
@@ -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.
diff --git a/libevmasm/PeepholeOptimiser.h b/libevmasm/PeepholeOptimiser.h
index a74cc8b3..a651143d 100644
--- a/libevmasm/PeepholeOptimiser.h
+++ b/libevmasm/PeepholeOptimiser.h
@@ -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();
diff --git a/libjulia/optimiser/ASTCopier.h b/libjulia/optimiser/ASTCopier.h
index 36a1ced5..8681f2e0 100644
--- a/libjulia/optimiser/ASTCopier.h
+++ b/libjulia/optimiser/ASTCopier.h
@@ -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;
diff --git a/libjulia/optimiser/ASTWalker.h b/libjulia/optimiser/ASTWalker.h
index 97891381..f09c2ff1 100644
--- a/libjulia/optimiser/ASTWalker.h
+++ b/libjulia/optimiser/ASTWalker.h
@@ -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&) {}
diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h
index a53987bf..fa0d6921 100644
--- a/libsolidity/ast/AST.h
+++ b/libsolidity/ast/AST.h
@@ -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
diff --git a/libsolidity/ast/ASTVisitor.h b/libsolidity/ast/ASTVisitor.h
index b1389f0f..6c0ce6f8 100644
--- a/libsolidity/ast/ASTVisitor.h
+++ b/libsolidity/ast/ASTVisitor.h
@@ -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); }
diff --git a/libsolidity/ast/Types.h b/libsolidity/ast/Types.h
index a9536657..ca6822c9 100644
--- a/libsolidity/ast/Types.h
+++ b/libsolidity/ast/Types.h
@@ -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,
diff --git a/libsolidity/formal/SolverInterface.h b/libsolidity/formal/SolverInterface.h
index e127bb55..16796684 100644
--- a/libsolidity/formal/SolverInterface.h
+++ b/libsolidity/formal/SolverInterface.h
@@ -193,6 +193,7 @@ DEV_SIMPLE_EXCEPTION(SolverError);
class SolverInterface
{
public:
+ virtual ~SolverInterface() = default;
virtual void reset() = 0;
virtual void push() = 0;
diff --git a/libsolidity/formal/SymbolicVariable.h b/libsolidity/formal/SymbolicVariable.h
index e4e4ea8d..e29ded26 100644
--- a/libsolidity/formal/SymbolicVariable.h
+++ b/libsolidity/formal/SymbolicVariable.h
@@ -40,6 +40,7 @@ public:
Declaration const& _decl,
smt::SolverInterface& _interface
);
+ virtual ~SymbolicVariable() = default;
smt::Expression operator()(int _seq) const
{
diff --git a/test/ExecutionFramework.h b/test/ExecutionFramework.h
index ee8da322..4525cbf9 100644
--- a/test/ExecutionFramework.h
+++ b/test/ExecutionFramework.h
@@ -53,6 +53,7 @@ class ExecutionFramework
public:
ExecutionFramework();
+ virtual ~ExecutionFramework() = default;
virtual bytes const& compileAndRunWithoutCheck(
std::string const& _sourceCode,
diff --git a/test/libsolidity/AnalysisFramework.h b/test/libsolidity/AnalysisFramework.h
index 05490a42..a904617d 100644
--- a/test/libsolidity/AnalysisFramework.h
+++ b/test/libsolidity/AnalysisFramework.h
@@ -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);