diff --git a/libyul/AsmJsonConverter.cpp b/libyul/AsmJsonConverter.cpp index d7154a122..429da10fd 100644 --- a/libyul/AsmJsonConverter.cpp +++ b/libyul/AsmJsonConverter.cpp @@ -83,7 +83,7 @@ Json::Value AsmJsonConverter::operator()(Assignment const& _node) const Json::Value ret = createAstNode(_node.location, "YulAssignment"); for (auto const& var: _node.variableNames) ret["variableNames"].append((*this)(var)); - ret["value"] = _node.value ? boost::apply_visitor(*this, *_node.value) : Json::nullValue; + ret["value"] = _node.value ? std::visit(*this, *_node.value) : Json::nullValue; return ret; } @@ -98,7 +98,7 @@ Json::Value AsmJsonConverter::operator()(FunctionCall const& _node) const Json::Value AsmJsonConverter::operator()(ExpressionStatement const& _node) const { Json::Value ret = createAstNode(_node.location, "YulExpressionStatement"); - ret["expression"] = boost::apply_visitor(*this, _node.expression); + ret["expression"] = std::visit(*this, _node.expression); return ret; } @@ -108,7 +108,7 @@ Json::Value AsmJsonConverter::operator()(VariableDeclaration const& _node) const for (auto const& var: _node.variables) ret["variables"].append((*this)(var)); - ret["value"] = _node.value ? boost::apply_visitor(*this, *_node.value) : Json::nullValue; + ret["value"] = _node.value ? std::visit(*this, *_node.value) : Json::nullValue; return ret; } @@ -130,7 +130,7 @@ Json::Value AsmJsonConverter::operator()(If const& _node) const { solAssert(_node.condition, "Invalid if condition."); Json::Value ret = createAstNode(_node.location, "YulIf"); - ret["condition"] = boost::apply_visitor(*this, *_node.condition); + ret["condition"] = std::visit(*this, *_node.condition); ret["body"] = (*this)(_node.body); return ret; } @@ -139,7 +139,7 @@ Json::Value AsmJsonConverter::operator()(Switch const& _node) const { solAssert(_node.expression, "Invalid expression pointer."); Json::Value ret = createAstNode(_node.location, "YulSwitch"); - ret["expression"] = boost::apply_visitor(*this, *_node.expression); + ret["expression"] = std::visit(*this, *_node.expression); for (auto const& var: _node.cases) ret["cases"].append((*this)(var)); return ret; @@ -158,7 +158,7 @@ Json::Value AsmJsonConverter::operator()(ForLoop const& _node) const solAssert(_node.condition, "Invalid for loop condition."); Json::Value ret = createAstNode(_node.location, "YulForLoop"); ret["pre"] = (*this)(_node.pre); - ret["condition"] = boost::apply_visitor(*this, *_node.condition); + ret["condition"] = std::visit(*this, *_node.condition); ret["post"] = (*this)(_node.post); ret["body"] = (*this)(_node.body); return ret; @@ -195,7 +195,7 @@ Json::Value AsmJsonConverter::vectorOfVariantsToJson(vector const& _vec) cons { Json::Value ret{Json::arrayValue}; for (auto const& var: _vec) - ret.append(boost::apply_visitor(*this, var)); + ret.append(std::visit(*this, var)); return ret; } diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index 5d054e9d2..b79525c72 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -466,11 +466,11 @@ Expression Parser::parseCall(Parser::ElementaryOperation&& _initialOp) FunctionCall ret; if (holds_alternative(_initialOp)) { - ret.functionName = std::move(boost::get(_initialOp)); + ret.functionName = std::move(std::get(_initialOp)); ret.location = ret.functionName.location; } else if (holds_alternative(_initialOp)) - ret = std::move(boost::get(_initialOp)); + ret = std::move(std::get(_initialOp)); else fatalParserError( m_dialect.flavour == AsmFlavour::Yul ? diff --git a/libyul/optimiser/ControlFlowSimplifier.cpp b/libyul/optimiser/ControlFlowSimplifier.cpp index bcb281401..e370126eb 100644 --- a/libyul/optimiser/ControlFlowSimplifier.cpp +++ b/libyul/optimiser/ControlFlowSimplifier.cpp @@ -139,7 +139,7 @@ void ControlFlowSimplifier::operator()(Block& _block) void ControlFlowSimplifier::operator()(FunctionDefinition& _funDef) { ASTModifier::operator()(_funDef); - if (!_funDef.body.statements.empty() && _funDef.body.statements.back().type() == typeid(Leave)) + if (!_funDef.body.statements.empty() && holds_alternative(_funDef.body.statements.back())) _funDef.body.statements.pop_back(); } diff --git a/libyul/optimiser/Semantics.cpp b/libyul/optimiser/Semantics.cpp index 322560843..40d41a5d1 100644 --- a/libyul/optimiser/Semantics.cpp +++ b/libyul/optimiser/Semantics.cpp @@ -158,7 +158,7 @@ TerminationFinder::ControlFlow TerminationFinder::controlFlowKind(Statement cons return ControlFlow::Break; else if (holds_alternative(_statement)) return ControlFlow::Continue; - else if (_statement.type() == typeid(Leave)) + else if (holds_alternative(_statement)) return ControlFlow::Leave; else return ControlFlow::FlowOut; diff --git a/test/libsolidity/GasCosts.cpp b/test/libsolidity/GasCosts.cpp index b79ec230d..af81efc53 100644 --- a/test/libsolidity/GasCosts.cpp +++ b/test/libsolidity/GasCosts.cpp @@ -41,7 +41,7 @@ namespace test #define CHECK_DEPLOY_GAS(_gasNoOpt, _gasOpt, _evmVersion) \ do \ { \ - u256 ipfsCost = GasMeter::dataGas(dev::ipfsHash(m_compiler.metadata(m_compiler.lastContractName())), true); \ + u256 ipfsCost = GasMeter::dataGas(dev::ipfsHash(m_compiler.metadata(m_compiler.lastContractName())), true, _evmVersion); \ u256 gasOpt{_gasOpt}; \ u256 gasNoOpt{_gasNoOpt}; \ u256 gas = m_optimiserSettings == OptimiserSettings::minimal() ? gasNoOpt : gasOpt; \ @@ -99,7 +99,7 @@ BOOST_AUTO_TEST_CASE(string_storage) auto evmVersion = dev::test::Options::get().evmVersion(); if (evmVersion <= EVMVersion::byzantium()) - CHECK_DEPLOY_GAS(134071, 130763, evmVersion); + CHECK_DEPLOY_GAS(134145, 130831, evmVersion); // This is only correct on >=Constantinople. else if (Options::get().useABIEncoderV2) { @@ -107,28 +107,28 @@ BOOST_AUTO_TEST_CASE(string_storage) { // Costs with 0 are cases which cannot be triggered in tests. if (evmVersion < EVMVersion::istanbul()) - CHECK_DEPLOY_GAS(0, 127653, evmVersion); + CHECK_DEPLOY_GAS(0, 127721, evmVersion); else - CHECK_DEPLOY_GAS(0, 113821, evmVersion); + CHECK_DEPLOY_GAS(0, 113993, evmVersion); } else { if (evmVersion < EVMVersion::istanbul()) - CHECK_DEPLOY_GAS(0, 135371, evmVersion); + CHECK_DEPLOY_GAS(151523, 135371, evmVersion); else - CHECK_DEPLOY_GAS(0, 120083, evmVersion); + CHECK_DEPLOY_GAS(134883, 120083, evmVersion); } } else if (evmVersion < EVMVersion::istanbul()) - CHECK_DEPLOY_GAS(126861, 119591, evmVersion); + CHECK_DEPLOY_GAS(126929, 119659, evmVersion); else - CHECK_DEPLOY_GAS(114173, 107163, evmVersion); + CHECK_DEPLOY_GAS(114345, 107335, evmVersion); if (evmVersion >= EVMVersion::byzantium()) { callContractFunction("f()"); if (evmVersion == EVMVersion::byzantium()) - CHECK_GAS(21551, 21526, 20); + CHECK_GAS(21545, 21526, 20); // This is only correct on >=Constantinople. else if (Options::get().useABIEncoderV2) { @@ -142,9 +142,9 @@ BOOST_AUTO_TEST_CASE(string_storage) else { if (evmVersion < EVMVersion::istanbul()) - CHECK_GAS(0, 21635, 20); + CHECK_GAS(21707, 21635, 20); else - CHECK_GAS(0, 21431, 20); + CHECK_GAS(21499, 21431, 20); } } else if (evmVersion < EVMVersion::istanbul())