From c4cf412fed752e2949dac586ff40c972da7d455a Mon Sep 17 00:00:00 2001 From: anurag4u80 Date: Sat, 24 Apr 2021 08:10:41 +0530 Subject: [PATCH] Replaced boost remove_erase and remove_erase_if --- libyul/optimiser/ControlFlowSimplifier.cpp | 6 +++--- libyul/optimiser/DataFlowAnalyzer.cpp | 1 - libyul/optimiser/FunctionGrouper.cpp | 2 -- libyul/optimiser/OptimizerUtilities.cpp | 4 ++-- libyul/optimiser/RedundantAssignEliminator.cpp | 4 ++-- libyul/optimiser/StructuralSimplifier.cpp | 2 -- libyul/optimiser/Suite.cpp | 6 +++--- test/tools/ossfuzz/protoToYul.cpp | 7 ++++--- 8 files changed, 14 insertions(+), 18 deletions(-) diff --git a/libyul/optimiser/ControlFlowSimplifier.cpp b/libyul/optimiser/ControlFlowSimplifier.cpp index c617e2005..73d907d33 100644 --- a/libyul/optimiser/ControlFlowSimplifier.cpp +++ b/libyul/optimiser/ControlFlowSimplifier.cpp @@ -25,7 +25,7 @@ #include #include -#include +#include using namespace std; using namespace solidity; @@ -52,7 +52,7 @@ ExpressionStatement makeDiscardCall( void removeEmptyDefaultFromSwitch(Switch& _switchStmt) { - boost::remove_erase_if( + ranges::actions::remove_if( _switchStmt.cases, [](Case const& _case) { return !_case.value && _case.body.statements.empty(); } ); @@ -69,7 +69,7 @@ void removeEmptyCasesFromSwitch(Switch& _switchStmt) if (hasDefault) return; - boost::remove_erase_if( + ranges::actions::remove_if( _switchStmt.cases, [](Case const& _case) { return _case.body.statements.empty(); } ); diff --git a/libyul/optimiser/DataFlowAnalyzer.cpp b/libyul/optimiser/DataFlowAnalyzer.cpp index 1150da659..c6d9decaf 100644 --- a/libyul/optimiser/DataFlowAnalyzer.cpp +++ b/libyul/optimiser/DataFlowAnalyzer.cpp @@ -32,7 +32,6 @@ #include #include -#include #include #include diff --git a/libyul/optimiser/FunctionGrouper.cpp b/libyul/optimiser/FunctionGrouper.cpp index 6ebab56db..2ed92435e 100644 --- a/libyul/optimiser/FunctionGrouper.cpp +++ b/libyul/optimiser/FunctionGrouper.cpp @@ -24,8 +24,6 @@ #include -#include - using namespace std; using namespace solidity; using namespace solidity::yul; diff --git a/libyul/optimiser/OptimizerUtilities.cpp b/libyul/optimiser/OptimizerUtilities.cpp index 52019356e..0fe942ea8 100644 --- a/libyul/optimiser/OptimizerUtilities.cpp +++ b/libyul/optimiser/OptimizerUtilities.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include using namespace std; using namespace solidity; @@ -40,7 +40,7 @@ void yul::removeEmptyBlocks(Block& _block) auto isEmptyBlock = [](Statement const& _st) -> bool { return holds_alternative(_st) && std::get(_st).statements.empty(); }; - boost::range::remove_erase_if(_block.statements, isEmptyBlock); + ranges::actions::remove_if(_block.statements, isEmptyBlock); } bool yul::isRestrictedIdentifier(Dialect const& _dialect, YulString const& _identifier) diff --git a/libyul/optimiser/RedundantAssignEliminator.cpp b/libyul/optimiser/RedundantAssignEliminator.cpp index cd528aedf..209be21c7 100644 --- a/libyul/optimiser/RedundantAssignEliminator.cpp +++ b/libyul/optimiser/RedundantAssignEliminator.cpp @@ -27,7 +27,7 @@ #include -#include +#include using namespace std; using namespace solidity; @@ -307,7 +307,7 @@ void RedundantAssignEliminator::finalize(YulString _variable, RedundantAssignEli void AssignmentRemover::operator()(Block& _block) { - boost::range::remove_erase_if(_block.statements, [&](Statement const& _statement) -> bool { + ranges::actions::remove_if(_block.statements, [&](Statement const& _statement) -> bool { return holds_alternative(_statement) && m_toRemove.count(&std::get(_statement)); }); diff --git a/libyul/optimiser/StructuralSimplifier.cpp b/libyul/optimiser/StructuralSimplifier.cpp index 4cfa0b3f1..cb212bdee 100644 --- a/libyul/optimiser/StructuralSimplifier.cpp +++ b/libyul/optimiser/StructuralSimplifier.cpp @@ -22,8 +22,6 @@ #include #include -#include - using namespace std; using namespace solidity; using namespace solidity::yul; diff --git a/libyul/optimiser/Suite.cpp b/libyul/optimiser/Suite.cpp index 8f676e335..480a542a3 100644 --- a/libyul/optimiser/Suite.cpp +++ b/libyul/optimiser/Suite.cpp @@ -73,10 +73,10 @@ #include -#include #include #include +#include using namespace std; using namespace solidity; @@ -312,8 +312,8 @@ void OptimiserSuite::runSequence(string const& _stepAbbreviations, Block& _ast) validateSequence(_stepAbbreviations); string input = _stepAbbreviations; - boost::remove_erase(input, ' '); - boost::remove_erase(input, '\n'); + ranges::actions::remove(input, ' '); + ranges::actions::remove(input, '\n'); auto abbreviationsToSteps = [](string const& _sequence) -> vector { diff --git a/test/tools/ossfuzz/protoToYul.cpp b/test/tools/ossfuzz/protoToYul.cpp index 53a706efb..599e6153e 100644 --- a/test/tools/ossfuzz/protoToYul.cpp +++ b/test/tools/ossfuzz/protoToYul.cpp @@ -27,7 +27,8 @@ #include #include -#include + +#include #include @@ -61,7 +62,7 @@ string ProtoConverter::createHex(string const& _hexBytes) string tmp{_hexBytes}; if (!tmp.empty()) { - boost::range::remove_erase_if(tmp, [=](char c) -> bool { + ranges::actions::remove_if(tmp, [=](char c) -> bool { return !std::isxdigit(c); }); tmp = tmp.substr(0, 64); @@ -83,7 +84,7 @@ string ProtoConverter::createAlphaNum(string const& _strBytes) string tmp{_strBytes}; if (!tmp.empty()) { - boost::range::remove_erase_if(tmp, [=](char c) -> bool { + ranges::actions::remove_if(tmp, [=](char c) -> bool { return !(std::isalpha(c) || std::isdigit(c)); }); tmp = tmp.substr(0, 32);