Remove the usage of boost::noncopyable

Prior to this half of the codebase used explicit deleted copy constructors, the others used boost::noncopyable.
This commit is contained in:
Alex Beregszaszi 2020-11-25 20:28:50 +00:00
parent 15decd2413
commit e39433198d
20 changed files with 70 additions and 38 deletions

View File

@ -29,8 +29,6 @@
#include <libsolutil/CommonData.h> #include <libsolutil/CommonData.h>
#include <boost/noncopyable.hpp>
#include <functional> #include <functional>
#include <vector> #include <vector>
@ -47,9 +45,13 @@ class Pattern;
/** /**
* Container for all simplification rules. * Container for all simplification rules.
*/ */
class Rules: public boost::noncopyable class Rules
{ {
public: public:
/// Noncopyable.
Rules(Rules const&) = delete;
Rules& operator=(Rules const&) = delete;
using Expression = ExpressionClasses::Expression; using Expression = ExpressionClasses::Expression;
Rules(); Rules();

View File

@ -19,7 +19,6 @@
#pragma once #pragma once
#include <libsmtutil/SolverInterface.h> #include <libsmtutil/SolverInterface.h>
#include <boost/noncopyable.hpp>
#if defined(__GLIBC__) #if defined(__GLIBC__)
// The CVC4 headers includes the deprecated system headers <ext/hash_map> // The CVC4 headers includes the deprecated system headers <ext/hash_map>
@ -37,9 +36,13 @@
namespace solidity::smtutil namespace solidity::smtutil
{ {
class CVC4Interface: public SolverInterface, public boost::noncopyable class CVC4Interface: public SolverInterface
{ {
public: public:
/// Noncopyable.
CVC4Interface(CVC4Interface const&) = delete;
CVC4Interface& operator=(CVC4Interface const&) = delete;
CVC4Interface(std::optional<unsigned> _queryTimeout = {}); CVC4Interface(std::optional<unsigned> _queryTimeout = {});
void reset() override; void reset() override;

View File

@ -25,7 +25,6 @@
#include <libsolutil/Common.h> #include <libsolutil/Common.h>
#include <libsolutil/FixedHash.h> #include <libsolutil/FixedHash.h>
#include <boost/noncopyable.hpp>
#include <cstdio> #include <cstdio>
#include <map> #include <map>
#include <set> #include <set>
@ -35,9 +34,13 @@
namespace solidity::smtutil namespace solidity::smtutil
{ {
class SMTLib2Interface: public SolverInterface, public boost::noncopyable class SMTLib2Interface: public SolverInterface
{ {
public: public:
/// Noncopyable.
SMTLib2Interface(SMTLib2Interface const&) = delete;
SMTLib2Interface& operator=(SMTLib2Interface const&) = delete;
explicit SMTLib2Interface( explicit SMTLib2Interface(
std::map<util::h256, std::string> _queryResponses = {}, std::map<util::h256, std::string> _queryResponses = {},
frontend::ReadCallback::Callback _smtCallback = {}, frontend::ReadCallback::Callback _smtCallback = {},

View File

@ -23,7 +23,6 @@
#include <libsolidity/interface/ReadFile.h> #include <libsolidity/interface/ReadFile.h>
#include <libsolutil/FixedHash.h> #include <libsolutil/FixedHash.h>
#include <boost/noncopyable.hpp>
#include <map> #include <map>
#include <vector> #include <vector>
@ -36,9 +35,13 @@ namespace solidity::smtutil
* It also checks whether different solvers give conflicting answers * It also checks whether different solvers give conflicting answers
* to SMT queries. * to SMT queries.
*/ */
class SMTPortfolio: public SolverInterface, public boost::noncopyable class SMTPortfolio: public SolverInterface
{ {
public: public:
/// Noncopyable.
SMTPortfolio(SMTPortfolio const&) = delete;
SMTPortfolio& operator=(SMTPortfolio const&) = delete;
SMTPortfolio( SMTPortfolio(
std::map<util::h256, std::string> _smtlib2Responses = {}, std::map<util::h256, std::string> _smtlib2Responses = {},
frontend::ReadCallback::Callback _smtCallback = {}, frontend::ReadCallback::Callback _smtCallback = {},

View File

@ -23,7 +23,6 @@
#include <libsolutil/Common.h> #include <libsolutil/Common.h>
#include <boost/noncopyable.hpp>
#include <cstdio> #include <cstdio>
#include <map> #include <map>
#include <memory> #include <memory>

View File

@ -19,15 +19,18 @@
#pragma once #pragma once
#include <libsmtutil/SolverInterface.h> #include <libsmtutil/SolverInterface.h>
#include <boost/noncopyable.hpp>
#include <z3++.h> #include <z3++.h>
namespace solidity::smtutil namespace solidity::smtutil
{ {
class Z3Interface: public SolverInterface, public boost::noncopyable class Z3Interface: public SolverInterface
{ {
public: public:
/// Noncopyable.
Z3Interface(Z3Interface const&) = delete;
Z3Interface& operator=(Z3Interface const&) = delete;
Z3Interface(std::optional<unsigned> _queryTimeout = {}); Z3Interface(std::optional<unsigned> _queryTimeout = {});
static bool available(); static bool available();

View File

@ -26,7 +26,6 @@
#include <libsolidity/ast/ASTForward.h> #include <libsolidity/ast/ASTForward.h>
#include <liblangutil/Exceptions.h> #include <liblangutil/Exceptions.h>
#include <liblangutil/SourceLocation.h> #include <liblangutil/SourceLocation.h>
#include <boost/noncopyable.hpp>
namespace solidity::frontend namespace solidity::frontend
{ {

View File

@ -22,7 +22,6 @@
#include <libsolidity/ast/ASTAnnotations.h> #include <libsolidity/ast/ASTAnnotations.h>
#include <liblangutil/EVMVersion.h> #include <liblangutil/EVMVersion.h>
#include <boost/noncopyable.hpp>
#include <list> #include <list>
#include <map> #include <map>

View File

@ -24,7 +24,6 @@
#pragma once #pragma once
#include <libsolidity/ast/ASTForward.h> #include <libsolidity/ast/ASTForward.h>
#include <boost/noncopyable.hpp>
#include <map> #include <map>
#include <memory> #include <memory>
#include <string> #include <string>
@ -41,9 +40,13 @@ class Type; // forward
* @note must not be destroyed or moved during compilation as its objects can be referenced from * @note must not be destroyed or moved during compilation as its objects can be referenced from
* other objects. * other objects.
*/ */
class GlobalContext: private boost::noncopyable class GlobalContext
{ {
public: public:
/// Noncopyable.
GlobalContext(GlobalContext const&) = delete;
GlobalContext& operator=(GlobalContext const&) = delete;
GlobalContext(); GlobalContext();
void setCurrentContract(ContractDefinition const& _contract); void setCurrentContract(ContractDefinition const& _contract);
void resetCurrentContract() { m_currentContract = nullptr; } void resetCurrentContract() { m_currentContract = nullptr; }

View File

@ -31,8 +31,6 @@
#include <liblangutil/EVMVersion.h> #include <liblangutil/EVMVersion.h>
#include <boost/noncopyable.hpp>
#include <list> #include <list>
#include <map> #include <map>
@ -48,9 +46,13 @@ namespace solidity::frontend
* Resolves name references, typenames and sets the (explicitly given) types for all variable * Resolves name references, typenames and sets the (explicitly given) types for all variable
* declarations. * declarations.
*/ */
class NameAndTypeResolver: private boost::noncopyable class NameAndTypeResolver
{ {
public: public:
/// Noncopyable.
NameAndTypeResolver(NameAndTypeResolver const&) = delete;
NameAndTypeResolver& operator=(NameAndTypeResolver const&) = delete;
/// Creates the resolver with the given declarations added to the global scope. /// Creates the resolver with the given declarations added to the global scope.
/// @param _scopes mapping of scopes to be used (usually default constructed), these /// @param _scopes mapping of scopes to be used (usually default constructed), these
/// are filled during the lifetime of this object. /// are filled during the lifetime of this object.

View File

@ -28,7 +28,6 @@
#include <liblangutil/EVMVersion.h> #include <liblangutil/EVMVersion.h>
#include <libyul/optimiser/ASTWalker.h> #include <libyul/optimiser/ASTWalker.h>
#include <boost/noncopyable.hpp>
#include <list> #include <list>
#include <map> #include <map>

View File

@ -34,7 +34,6 @@
#include <libsolutil/FixedHash.h> #include <libsolutil/FixedHash.h>
#include <libsolutil/LazyInit.h> #include <libsolutil/LazyInit.h>
#include <boost/noncopyable.hpp>
#include <json/json.h> #include <json/json.h>
#include <memory> #include <memory>
@ -62,9 +61,13 @@ class ASTConstVisitor;
* It is possible to traverse all direct and indirect children of an AST node by calling * It is possible to traverse all direct and indirect children of an AST node by calling
* accept, providing an ASTVisitor. * accept, providing an ASTVisitor.
*/ */
class ASTNode: private boost::noncopyable class ASTNode
{ {
public: public:
/// Noncopyable.
ASTNode(ASTNode const&) = delete;
ASTNode& operator=(ASTNode const&) = delete;
using CompareByID = frontend::ASTCompareByID<ASTNode>; using CompareByID = frontend::ASTCompareByID<ASTNode>;
using SourceLocation = langutil::SourceLocation; using SourceLocation = langutil::SourceLocation;

View File

@ -31,7 +31,6 @@
#include <liblangutil/SourceLocation.h> #include <liblangutil/SourceLocation.h>
#include <libsolutil/Common.h> #include <libsolutil/Common.h>
#include <boost/noncopyable.hpp>
#include <functional> #include <functional>
#include <memory> #include <memory>

View File

@ -45,7 +45,6 @@
#include <libsolutil/FixedHash.h> #include <libsolutil/FixedHash.h>
#include <libsolutil/LazyInit.h> #include <libsolutil/LazyInit.h>
#include <boost/noncopyable.hpp>
#include <json/json.h> #include <json/json.h>
#include <functional> #include <functional>
@ -88,9 +87,13 @@ class DeclarationContainer;
* If error recovery is active, it is possible to progress through the stages even when * 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. * there are errors. In any case, producing code is only possible without errors.
*/ */
class CompilerStack: boost::noncopyable class CompilerStack
{ {
public: public:
/// Noncopyable.
CompilerStack(CompilerStack const&) = delete;
CompilerStack& operator=(CompilerStack const&) = delete;
enum State { enum State {
Empty, Empty,
SourcesSet, SourcesSet,

View File

@ -20,16 +20,19 @@
#include <liblangutil/Exceptions.h> #include <liblangutil/Exceptions.h>
#include <boost/noncopyable.hpp>
#include <functional> #include <functional>
#include <string> #include <string>
namespace solidity::frontend namespace solidity::frontend
{ {
class ReadCallback: boost::noncopyable class ReadCallback
{ {
public: public:
/// Noncopyable.
ReadCallback(ReadCallback const&) = delete;
ReadCallback& operator=(ReadCallback const&) = delete;
/// File reading or generic query result. /// File reading or generic query result.
struct Result struct Result
{ {

View File

@ -36,9 +36,13 @@ namespace solidity::frontend
* Standard JSON compiler interface, which expects a JSON input and returns a JSON output. * 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. * See docs/using-the-compiler#compiler-input-and-output-json-description.
*/ */
class StandardCompiler: boost::noncopyable class StandardCompiler
{ {
public: public:
/// Noncopyable.
StandardCompiler(StandardCompiler const&) = delete;
StandardCompiler& operator=(StandardCompiler const&) = delete;
/// Creates a new StandardCompiler. /// Creates a new StandardCompiler.
/// @param _readFile callback used to read files for import statements. Must return /// @param _readFile callback used to read files for import statements. Must return
/// and must not emit exceptions. /// and must not emit exceptions.

View File

@ -25,8 +25,6 @@
#include <libyul/SideEffects.h> #include <libyul/SideEffects.h>
#include <libyul/ControlFlowSideEffects.h> #include <libyul/ControlFlowSideEffects.h>
#include <boost/noncopyable.hpp>
#include <vector> #include <vector>
#include <set> #include <set>
#include <optional> #include <optional>
@ -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. /// Default type, can be omitted.
YulString defaultType; YulString defaultType;
/// Type used for the literals "true" and "false". /// Type used for the literals "true" and "false".

View File

@ -21,8 +21,6 @@
#pragma once #pragma once
#include <boost/noncopyable.hpp>
#include <unordered_map> #include <unordered_map>
#include <memory> #include <memory>
#include <vector> #include <vector>

View File

@ -31,8 +31,6 @@
#include <liblangutil/EVMVersion.h> #include <liblangutil/EVMVersion.h>
#include <liblangutil/SourceLocation.h> #include <liblangutil/SourceLocation.h>
#include <boost/noncopyable.hpp>
#include <functional> #include <functional>
#include <optional> #include <optional>
#include <vector> #include <vector>
@ -46,9 +44,13 @@ class Pattern;
/** /**
* Container for all simplification rules. * Container for all simplification rules.
*/ */
class SimplificationRules: public boost::noncopyable class SimplificationRules
{ {
public: public:
/// Noncopiable.
SimplificationRules(SimplificationRules const&) = delete;
SimplificationRules& operator=(SimplificationRules const&) = delete;
using Rule = evmasm::SimplificationRule<Pattern>; using Rule = evmasm::SimplificationRule<Pattern>;
explicit SimplificationRules(std::optional<langutil::EVMVersion> _evmVersion = std::nullopt); explicit SimplificationRules(std::optional<langutil::EVMVersion> _evmVersion = std::nullopt);

View File

@ -24,7 +24,6 @@
#include <test/evmc/evmc.h> #include <test/evmc/evmc.h>
#include <boost/filesystem/path.hpp> #include <boost/filesystem/path.hpp>
#include <boost/noncopyable.hpp>
#include <boost/program_options.hpp> #include <boost/program_options.hpp>
namespace solidity::test namespace solidity::test
@ -49,8 +48,12 @@ static constexpr auto heraDownloadLink = "https://github.com/ewasm/hera/releases
struct ConfigException : public util::Exception {}; struct ConfigException : public util::Exception {};
struct CommonOptions: boost::noncopyable struct CommonOptions
{ {
/// Noncopyable.
CommonOptions(CommonOptions const&) = delete;
CommonOptions& operator=(CommonOptions const&) = delete;
std::vector<boost::filesystem::path> vmPaths; std::vector<boost::filesystem::path> vmPaths;
boost::filesystem::path testPath; boost::filesystem::path testPath;
bool ewasm = false; bool ewasm = false;