From b0ce98bcb2c4a1728a2e67266448eeff3928b8f6 Mon Sep 17 00:00:00 2001 From: soroosh-sdi Date: Tue, 24 Aug 2021 21:38:18 +0430 Subject: [PATCH] Using range-v3 instead of boost Signed-off-by: soroosh-sdi --- libsolidity/analysis/ControlFlowAnalyzer.cpp | 5 +++-- libsolidity/analysis/TypeChecker.cpp | 1 - libsolidity/ast/ASTJsonConverter.cpp | 8 +++++--- libsolidity/formal/SMTEncoder.cpp | 2 -- libsolidity/parsing/DocStringParser.cpp | 16 +++++++--------- test/libyul/Inliner.cpp | 1 - 6 files changed, 15 insertions(+), 18 deletions(-) diff --git a/libsolidity/analysis/ControlFlowAnalyzer.cpp b/libsolidity/analysis/ControlFlowAnalyzer.cpp index 8ea82bc43..181943032 100644 --- a/libsolidity/analysis/ControlFlowAnalyzer.cpp +++ b/libsolidity/analysis/ControlFlowAnalyzer.cpp @@ -20,7 +20,8 @@ #include #include -#include + +#include #include @@ -141,7 +142,7 @@ void ControlFlowAnalyzer::checkUninitializedAccess(CFGNode const* _entry, CFGNod exitInfo.uninitializedVariableAccesses.begin(), exitInfo.uninitializedVariableAccesses.end() ); - boost::range::sort( + ranges::sort( uninitializedAccessesOrdered, [](VariableOccurrence const* lhs, VariableOccurrence const* rhs) -> bool { diff --git a/libsolidity/analysis/TypeChecker.cpp b/libsolidity/analysis/TypeChecker.cpp index 7f36746d3..2f545c7ef 100644 --- a/libsolidity/analysis/TypeChecker.cpp +++ b/libsolidity/analysis/TypeChecker.cpp @@ -38,7 +38,6 @@ #include #include -#include #include #include diff --git a/libsolidity/ast/ASTJsonConverter.cpp b/libsolidity/ast/ASTJsonConverter.cpp index bae1b7d62..e009bc8cb 100644 --- a/libsolidity/ast/ASTJsonConverter.cpp +++ b/libsolidity/ast/ASTJsonConverter.cpp @@ -34,7 +34,8 @@ #include #include -#include + +#include #include #include @@ -563,8 +564,9 @@ bool ASTJsonConverter::visit(InlineAssembly const& _node) Json::Value externalReferencesJson = Json::arrayValue; - for (auto&& it: boost::range::sort(externalReferences)) - externalReferencesJson.append(std::move(it.second)); + ranges::sort(externalReferences); + for (Json::Value& it: externalReferences | ranges::views::values) + externalReferencesJson.append(std::move(it)); setJsonNode(_node, "InlineAssembly", { make_pair("AST", Json::Value(yul::AsmJsonConverter(sourceIndexFromLocation(_node.location()))(_node.operations()))), diff --git a/libsolidity/formal/SMTEncoder.cpp b/libsolidity/formal/SMTEncoder.cpp index 8a3d11707..cec220a0e 100644 --- a/libsolidity/formal/SMTEncoder.cpp +++ b/libsolidity/formal/SMTEncoder.cpp @@ -34,8 +34,6 @@ #include -#include - #include diff --git a/libsolidity/parsing/DocStringParser.cpp b/libsolidity/parsing/DocStringParser.cpp index d5a849751..5c07950ed 100644 --- a/libsolidity/parsing/DocStringParser.cpp +++ b/libsolidity/parsing/DocStringParser.cpp @@ -24,8 +24,9 @@ #include #include -#include -#include +#include +#include +#include using namespace std; using namespace solidity; @@ -52,8 +53,7 @@ string::const_iterator firstNonIdentifier( if (currPos == _pos && isIdentifierStart(*currPos)) { currPos++; - while (currPos != _end && isIdentifierPart(*currPos)) - currPos++; + currPos = ranges::find_if_not(ranges::make_subrange(currPos, _end), isIdentifierPart); } return currPos; } @@ -63,7 +63,7 @@ string::const_iterator firstWhitespaceOrNewline( string::const_iterator _end ) { - return boost::range::find_first_of(make_pair(_pos, _end), " \t\n"); + return ranges::find_first_of(ranges::make_subrange(_pos, _end), " \t\n"); } @@ -72,10 +72,8 @@ string::const_iterator skipWhitespace( string::const_iterator _end ) { - auto currPos = _pos; - while (currPos != _end && (*currPos == ' ' || *currPos == '\t')) - currPos += 1; - return currPos; + auto isWhitespace = [](char const& c) { return (c == ' ' || c == '\t'); }; + return ranges::find_if_not(ranges::make_subrange(_pos, _end), isWhitespace); } } diff --git a/test/libyul/Inliner.cpp b/test/libyul/Inliner.cpp index 6fc50ddc6..f80ec433e 100644 --- a/test/libyul/Inliner.cpp +++ b/test/libyul/Inliner.cpp @@ -32,7 +32,6 @@ #include -#include #include using namespace std;