From e39433198dc67b4fea4ac31443e3a95851f92f08 Mon Sep 17 00:00:00 2001 From: Alex Beregszaszi Date: Wed, 25 Nov 2020 20:28:50 +0000 Subject: [PATCH] Remove the usage of boost::noncopyable Prior to this half of the codebase used explicit deleted copy constructors, the others used boost::noncopyable. --- libevmasm/SimplificationRules.h | 8 +++++--- libsmtutil/CVC4Interface.h | 7 +++++-- libsmtutil/SMTLib2Interface.h | 7 +++++-- libsmtutil/SMTPortfolio.h | 7 +++++-- libsmtutil/SolverInterface.h | 1 - libsmtutil/Z3Interface.h | 7 +++++-- libsolidity/analysis/DeclarationContainer.h | 1 - libsolidity/analysis/DeclarationTypeChecker.h | 1 - libsolidity/analysis/GlobalContext.h | 7 +++++-- libsolidity/analysis/NameAndTypeResolver.h | 8 +++++--- libsolidity/analysis/ReferencesResolver.h | 1 - libsolidity/ast/AST.h | 7 +++++-- libsolidity/codegen/ExpressionCompiler.h | 1 - libsolidity/interface/CompilerStack.h | 7 +++++-- libsolidity/interface/ReadFile.h | 7 +++++-- libsolidity/interface/StandardCompiler.h | 6 +++++- libyul/Dialect.h | 8 +++++--- libyul/YulString.h | 2 -- libyul/optimiser/SimplificationRules.h | 8 +++++--- test/Common.h | 7 +++++-- 20 files changed, 70 insertions(+), 38 deletions(-) diff --git a/libevmasm/SimplificationRules.h b/libevmasm/SimplificationRules.h index f548f501d..b3f8da3c7 100644 --- a/libevmasm/SimplificationRules.h +++ b/libevmasm/SimplificationRules.h @@ -29,8 +29,6 @@ #include -#include - #include #include @@ -47,9 +45,13 @@ class Pattern; /** * Container for all simplification rules. */ -class Rules: public boost::noncopyable +class Rules { public: + /// Noncopyable. + Rules(Rules const&) = delete; + Rules& operator=(Rules const&) = delete; + using Expression = ExpressionClasses::Expression; Rules(); diff --git a/libsmtutil/CVC4Interface.h b/libsmtutil/CVC4Interface.h index 5727be0e2..cc3c0577c 100644 --- a/libsmtutil/CVC4Interface.h +++ b/libsmtutil/CVC4Interface.h @@ -19,7 +19,6 @@ #pragma once #include -#include #if defined(__GLIBC__) // The CVC4 headers includes the deprecated system headers @@ -37,9 +36,13 @@ namespace solidity::smtutil { -class CVC4Interface: public SolverInterface, public boost::noncopyable +class CVC4Interface: public SolverInterface { public: + /// Noncopyable. + CVC4Interface(CVC4Interface const&) = delete; + CVC4Interface& operator=(CVC4Interface const&) = delete; + CVC4Interface(std::optional _queryTimeout = {}); void reset() override; diff --git a/libsmtutil/SMTLib2Interface.h b/libsmtutil/SMTLib2Interface.h index 104862f27..bbe1feb9f 100644 --- a/libsmtutil/SMTLib2Interface.h +++ b/libsmtutil/SMTLib2Interface.h @@ -25,7 +25,6 @@ #include #include -#include #include #include #include @@ -35,9 +34,13 @@ namespace solidity::smtutil { -class SMTLib2Interface: public SolverInterface, public boost::noncopyable +class SMTLib2Interface: public SolverInterface { public: + /// Noncopyable. + SMTLib2Interface(SMTLib2Interface const&) = delete; + SMTLib2Interface& operator=(SMTLib2Interface const&) = delete; + explicit SMTLib2Interface( std::map _queryResponses = {}, frontend::ReadCallback::Callback _smtCallback = {}, diff --git a/libsmtutil/SMTPortfolio.h b/libsmtutil/SMTPortfolio.h index aab92f996..3d82756c3 100644 --- a/libsmtutil/SMTPortfolio.h +++ b/libsmtutil/SMTPortfolio.h @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -36,9 +35,13 @@ namespace solidity::smtutil * It also checks whether different solvers give conflicting answers * to SMT queries. */ -class SMTPortfolio: public SolverInterface, public boost::noncopyable +class SMTPortfolio: public SolverInterface { public: + /// Noncopyable. + SMTPortfolio(SMTPortfolio const&) = delete; + SMTPortfolio& operator=(SMTPortfolio const&) = delete; + SMTPortfolio( std::map _smtlib2Responses = {}, frontend::ReadCallback::Callback _smtCallback = {}, diff --git a/libsmtutil/SolverInterface.h b/libsmtutil/SolverInterface.h index d880bf7f5..fb2fa643d 100644 --- a/libsmtutil/SolverInterface.h +++ b/libsmtutil/SolverInterface.h @@ -23,7 +23,6 @@ #include -#include #include #include #include diff --git a/libsmtutil/Z3Interface.h b/libsmtutil/Z3Interface.h index d565b62f1..ee268ac41 100644 --- a/libsmtutil/Z3Interface.h +++ b/libsmtutil/Z3Interface.h @@ -19,15 +19,18 @@ #pragma once #include -#include #include namespace solidity::smtutil { -class Z3Interface: public SolverInterface, public boost::noncopyable +class Z3Interface: public SolverInterface { public: + /// Noncopyable. + Z3Interface(Z3Interface const&) = delete; + Z3Interface& operator=(Z3Interface const&) = delete; + Z3Interface(std::optional _queryTimeout = {}); static bool available(); diff --git a/libsolidity/analysis/DeclarationContainer.h b/libsolidity/analysis/DeclarationContainer.h index a131775b2..2f29425a3 100644 --- a/libsolidity/analysis/DeclarationContainer.h +++ b/libsolidity/analysis/DeclarationContainer.h @@ -26,7 +26,6 @@ #include #include #include -#include namespace solidity::frontend { diff --git a/libsolidity/analysis/DeclarationTypeChecker.h b/libsolidity/analysis/DeclarationTypeChecker.h index c0437a643..d327d4296 100644 --- a/libsolidity/analysis/DeclarationTypeChecker.h +++ b/libsolidity/analysis/DeclarationTypeChecker.h @@ -22,7 +22,6 @@ #include #include -#include #include #include diff --git a/libsolidity/analysis/GlobalContext.h b/libsolidity/analysis/GlobalContext.h index 191359c60..69344537c 100644 --- a/libsolidity/analysis/GlobalContext.h +++ b/libsolidity/analysis/GlobalContext.h @@ -24,7 +24,6 @@ #pragma once #include -#include #include #include #include @@ -41,9 +40,13 @@ class Type; // forward * @note must not be destroyed or moved during compilation as its objects can be referenced from * other objects. */ -class GlobalContext: private boost::noncopyable +class GlobalContext { public: + /// Noncopyable. + GlobalContext(GlobalContext const&) = delete; + GlobalContext& operator=(GlobalContext const&) = delete; + GlobalContext(); void setCurrentContract(ContractDefinition const& _contract); void resetCurrentContract() { m_currentContract = nullptr; } diff --git a/libsolidity/analysis/NameAndTypeResolver.h b/libsolidity/analysis/NameAndTypeResolver.h index 6644e281f..919e84a66 100644 --- a/libsolidity/analysis/NameAndTypeResolver.h +++ b/libsolidity/analysis/NameAndTypeResolver.h @@ -31,8 +31,6 @@ #include -#include - #include #include @@ -48,9 +46,13 @@ namespace solidity::frontend * Resolves name references, typenames and sets the (explicitly given) types for all variable * declarations. */ -class NameAndTypeResolver: private boost::noncopyable +class NameAndTypeResolver { public: + /// Noncopyable. + NameAndTypeResolver(NameAndTypeResolver const&) = delete; + NameAndTypeResolver& operator=(NameAndTypeResolver const&) = delete; + /// Creates the resolver with the given declarations added to the global scope. /// @param _scopes mapping of scopes to be used (usually default constructed), these /// are filled during the lifetime of this object. diff --git a/libsolidity/analysis/ReferencesResolver.h b/libsolidity/analysis/ReferencesResolver.h index cd3aaa717..530100a24 100644 --- a/libsolidity/analysis/ReferencesResolver.h +++ b/libsolidity/analysis/ReferencesResolver.h @@ -28,7 +28,6 @@ #include #include -#include #include #include diff --git a/libsolidity/ast/AST.h b/libsolidity/ast/AST.h index c0d52c644..7a1609e81 100644 --- a/libsolidity/ast/AST.h +++ b/libsolidity/ast/AST.h @@ -34,7 +34,6 @@ #include #include -#include #include #include @@ -62,9 +61,13 @@ class ASTConstVisitor; * It is possible to traverse all direct and indirect children of an AST node by calling * accept, providing an ASTVisitor. */ -class ASTNode: private boost::noncopyable +class ASTNode { public: + /// Noncopyable. + ASTNode(ASTNode const&) = delete; + ASTNode& operator=(ASTNode const&) = delete; + using CompareByID = frontend::ASTCompareByID; using SourceLocation = langutil::SourceLocation; diff --git a/libsolidity/codegen/ExpressionCompiler.h b/libsolidity/codegen/ExpressionCompiler.h index 66399d070..57ba34549 100644 --- a/libsolidity/codegen/ExpressionCompiler.h +++ b/libsolidity/codegen/ExpressionCompiler.h @@ -31,7 +31,6 @@ #include #include -#include #include #include diff --git a/libsolidity/interface/CompilerStack.h b/libsolidity/interface/CompilerStack.h index 83e516d06..ed3245505 100644 --- a/libsolidity/interface/CompilerStack.h +++ b/libsolidity/interface/CompilerStack.h @@ -45,7 +45,6 @@ #include #include -#include #include #include @@ -88,9 +87,13 @@ class DeclarationContainer; * If error recovery is active, it is possible to progress through the stages even when * there are errors. In any case, producing code is only possible without errors. */ -class CompilerStack: boost::noncopyable +class CompilerStack { public: + /// Noncopyable. + CompilerStack(CompilerStack const&) = delete; + CompilerStack& operator=(CompilerStack const&) = delete; + enum State { Empty, SourcesSet, diff --git a/libsolidity/interface/ReadFile.h b/libsolidity/interface/ReadFile.h index b21e8634a..ff505fee7 100644 --- a/libsolidity/interface/ReadFile.h +++ b/libsolidity/interface/ReadFile.h @@ -20,16 +20,19 @@ #include -#include #include #include namespace solidity::frontend { -class ReadCallback: boost::noncopyable +class ReadCallback { public: + /// Noncopyable. + ReadCallback(ReadCallback const&) = delete; + ReadCallback& operator=(ReadCallback const&) = delete; + /// File reading or generic query result. struct Result { diff --git a/libsolidity/interface/StandardCompiler.h b/libsolidity/interface/StandardCompiler.h index eed4f0522..0eba42789 100644 --- a/libsolidity/interface/StandardCompiler.h +++ b/libsolidity/interface/StandardCompiler.h @@ -36,9 +36,13 @@ namespace solidity::frontend * Standard JSON compiler interface, which expects a JSON input and returns a JSON output. * See docs/using-the-compiler#compiler-input-and-output-json-description. */ -class StandardCompiler: boost::noncopyable +class StandardCompiler { public: + /// Noncopyable. + StandardCompiler(StandardCompiler const&) = delete; + StandardCompiler& operator=(StandardCompiler const&) = delete; + /// Creates a new StandardCompiler. /// @param _readFile callback used to read files for import statements. Must return /// and must not emit exceptions. diff --git a/libyul/Dialect.h b/libyul/Dialect.h index 8c8891ee6..803580c80 100644 --- a/libyul/Dialect.h +++ b/libyul/Dialect.h @@ -25,8 +25,6 @@ #include #include -#include - #include #include #include @@ -57,8 +55,12 @@ struct BuiltinFunction } }; -struct Dialect: boost::noncopyable +struct Dialect { + /// Noncopiable. + Dialect(Dialect const&) = delete; + Dialect& operator=(Dialect const&) = delete; + /// Default type, can be omitted. YulString defaultType; /// Type used for the literals "true" and "false". diff --git a/libyul/YulString.h b/libyul/YulString.h index cee7bb9bf..fc3dedfd4 100644 --- a/libyul/YulString.h +++ b/libyul/YulString.h @@ -21,8 +21,6 @@ #pragma once -#include - #include #include #include diff --git a/libyul/optimiser/SimplificationRules.h b/libyul/optimiser/SimplificationRules.h index ca0b7a801..f9d0c9da9 100644 --- a/libyul/optimiser/SimplificationRules.h +++ b/libyul/optimiser/SimplificationRules.h @@ -31,8 +31,6 @@ #include #include -#include - #include #include #include @@ -46,9 +44,13 @@ class Pattern; /** * Container for all simplification rules. */ -class SimplificationRules: public boost::noncopyable +class SimplificationRules { public: + /// Noncopiable. + SimplificationRules(SimplificationRules const&) = delete; + SimplificationRules& operator=(SimplificationRules const&) = delete; + using Rule = evmasm::SimplificationRule; explicit SimplificationRules(std::optional _evmVersion = std::nullopt); diff --git a/test/Common.h b/test/Common.h index ba6d8f10d..2434e49ce 100644 --- a/test/Common.h +++ b/test/Common.h @@ -24,7 +24,6 @@ #include #include -#include #include namespace solidity::test @@ -49,8 +48,12 @@ static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/releases struct ConfigException : public util::Exception {}; -struct CommonOptions: boost::noncopyable +struct CommonOptions { + /// Noncopyable. + CommonOptions(CommonOptions const&) = delete; + CommonOptions& operator=(CommonOptions const&) = delete; + std::vector vmPaths; boost::filesystem::path testPath; bool ewasm = false;