Replace boost::variant by std::variant in libyul

This commit is contained in:
Leonardo Alt
2019-11-19 17:23:18 +01:00
parent 6d85b63f87
commit be849b3c47
75 changed files with 371 additions and 372 deletions
+12 -10
View File
@@ -21,7 +21,9 @@
#include <libyul/backends/evm/EVMDialect.h>
#include <liblangutil/ErrorReporter.h>
#include <libevmasm/SemanticInformation.h>
#include <functional>
#include <variant>
using namespace std;
using namespace dev;
@@ -31,7 +33,7 @@ using namespace dev::solidity;
namespace
{
class AssemblyViewPureChecker: public boost::static_visitor<void>
class AssemblyViewPureChecker
{
public:
explicit AssemblyViewPureChecker(
@@ -52,21 +54,21 @@ public:
{
checkInstruction(_instr.location, _instr.instruction);
for (auto const& arg: _instr.arguments)
boost::apply_visitor(*this, arg);
std::visit(*this, arg);
}
void operator()(yul::ExpressionStatement const& _expr)
{
boost::apply_visitor(*this, _expr.expression);
std::visit(*this, _expr.expression);
}
void operator()(yul::StackAssignment const&) {}
void operator()(yul::Assignment const& _assignment)
{
boost::apply_visitor(*this, *_assignment.value);
std::visit(*this, *_assignment.value);
}
void operator()(yul::VariableDeclaration const& _varDecl)
{
if (_varDecl.value)
boost::apply_visitor(*this, *_varDecl.value);
std::visit(*this, *_varDecl.value);
}
void operator()(yul::FunctionDefinition const& _funDef)
{
@@ -80,16 +82,16 @@ public:
checkInstruction(_funCall.location, *fun->instruction);
for (auto const& arg: _funCall.arguments)
boost::apply_visitor(*this, arg);
std::visit(*this, arg);
}
void operator()(yul::If const& _if)
{
boost::apply_visitor(*this, *_if.condition);
std::visit(*this, *_if.condition);
(*this)(_if.body);
}
void operator()(yul::Switch const& _switch)
{
boost::apply_visitor(*this, *_switch.expression);
std::visit(*this, *_switch.expression);
for (auto const& _case: _switch.cases)
{
if (_case.value)
@@ -100,7 +102,7 @@ public:
void operator()(yul::ForLoop const& _for)
{
(*this)(_for.pre);
boost::apply_visitor(*this, *_for.condition);
std::visit(*this, *_for.condition);
(*this)(_for.body);
(*this)(_for.post);
}
@@ -113,7 +115,7 @@ public:
void operator()(yul::Block const& _block)
{
for (auto const& s: _block.statements)
boost::apply_visitor(*this, s);
std::visit(*this, s);
}
private: