From 0f4ed52a719af90b52a15eb6709f46f03d4108b9 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Fri, 23 Nov 2018 11:18:57 +0100 Subject: Rewrite header paths to adapt to recent `git mv` of libsolidity/inlineasm to libyul --- test/libyul/Common.cpp | 6 +++--- test/libyul/Common.h | 2 +- test/libyul/Inliner.cpp | 2 +- test/libyul/Parser.cpp | 6 +++--- test/libyul/YulOptimizerTest.cpp | 6 +++--- test/tools/yulopti.cpp | 10 +++++----- 6 files changed, 16 insertions(+), 16 deletions(-) (limited to 'test') diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index 8913483f..ae7686b7 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -27,9 +27,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/libyul/Common.h b/test/libyul/Common.h index 390e214f..8241bfe1 100644 --- a/test/libyul/Common.h +++ b/test/libyul/Common.h @@ -21,7 +21,7 @@ #pragma once -#include +#include #include #include diff --git a/test/libyul/Inliner.cpp b/test/libyul/Inliner.cpp index 66810298..38d2491f 100644 --- a/test/libyul/Inliner.cpp +++ b/test/libyul/Inliner.cpp @@ -27,7 +27,7 @@ #include #include -#include +#include #include diff --git a/test/libyul/Parser.cpp b/test/libyul/Parser.cpp index 4aa3dd5c..957973d0 100644 --- a/test/libyul/Parser.cpp +++ b/test/libyul/Parser.cpp @@ -23,9 +23,9 @@ #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index 6b2b81c3..a8ad5680 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -44,9 +44,9 @@ #include #include -#include -#include -#include +#include +#include +#include #include #include diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index 8bc807d4..4e916b49 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -21,12 +21,12 @@ #include #include #include -#include -#include +#include +#include #include -#include -#include -#include +#include +#include +#include #include #include -- cgit v1.2.3 From 713d94476ec5ba61901b538c622c8cca6873c2af Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Fri, 23 Nov 2018 11:31:45 +0100 Subject: Reorder some include files and group 's together (as much as possible) --- test/libyul/Common.cpp | 7 +++---- test/libyul/Inliner.cpp | 1 - test/libyul/YulOptimizerTest.cpp | 7 +++---- 3 files changed, 6 insertions(+), 9 deletions(-) (limited to 'test') diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index ae7686b7..5851555a 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -23,15 +23,14 @@ #include -#include - -#include +#include +#include #include #include #include -#include +#include #include #include diff --git a/test/libyul/Inliner.cpp b/test/libyul/Inliner.cpp index 38d2491f..0f82dee3 100644 --- a/test/libyul/Inliner.cpp +++ b/test/libyul/Inliner.cpp @@ -26,7 +26,6 @@ #include #include #include - #include #include diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index a8ad5680..02a63ae3 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -21,9 +21,6 @@ #include -#include -#include - #include #include #include @@ -43,12 +40,14 @@ #include #include #include - #include #include #include #include +#include +#include + #include #include -- cgit v1.2.3 From 3734f40d315439f8a791967a6adfda8cf9fd1e55 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Fri, 23 Nov 2018 11:39:40 +0100 Subject: CMake: Isolate libyul into its own static library --- test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'test') diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index acfc7d00..10b78bdc 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -27,7 +27,7 @@ add_executable(soltest ${sources} ${headers} ${liblll_sources} ${liblll_headers} ${libsolidity_sources} ${libsolidity_headers} ) -target_link_libraries(soltest PRIVATE libsolc solidity evmasm devcore ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) +target_link_libraries(soltest PRIVATE libsolc yul solidity evmasm devcore ${Boost_UNIT_TEST_FRAMEWORK_LIBRARIES}) if (LLL) target_link_libraries(soltest PRIVATE lll) -- cgit v1.2.3 From ec47c8946ba5f78563b7eca2512b3cee68db45b4 Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 21 Nov 2018 12:42:34 +0100 Subject: Isolating libyul library API into its own namespace `yul`. --- test/boostTest.cpp | 2 +- test/libyul/Common.cpp | 20 ++++++++++---------- test/libyul/Common.h | 13 ++++--------- test/libyul/Inliner.cpp | 4 ++-- test/libyul/Parser.cpp | 16 +++++++--------- test/libyul/YulOptimizerTest.cpp | 16 ++++++++-------- test/libyul/YulOptimizerTest.h | 15 +++++---------- test/tools/yulopti.cpp | 11 +++++------ 8 files changed, 42 insertions(+), 55 deletions(-) (limited to 'test') diff --git a/test/boostTest.cpp b/test/boostTest.cpp index 5352ef85..966badfc 100644 --- a/test/boostTest.cpp +++ b/test/boostTest.cpp @@ -143,7 +143,7 @@ test_suite* init_unit_test_suite( int /*argc*/, char* /*argv*/[] ) master, dev::test::Options::get().testPath / "libyul", "yulOptimizerTests", - dev::yul::test::YulOptimizerTest::create + yul::test::YulOptimizerTest::create ) > 0, "no Yul Optimizer tests found"); if (!dev::test::Options::get().disableSMT) solAssert(registerTests( diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index 5851555a..d7785287 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -37,10 +37,10 @@ using namespace std; using namespace langutil; -using namespace dev::yul; +using namespace yul; using namespace dev::solidity; -void dev::yul::test::printErrors(ErrorList const& _errors, Scanner const& _scanner) +void yul::test::printErrors(ErrorList const& _errors, Scanner const& _scanner) { SourceReferenceFormatter formatter(cout, [&](std::string const&) -> Scanner const& { return _scanner; }); @@ -52,18 +52,18 @@ void dev::yul::test::printErrors(ErrorList const& _errors, Scanner const& _scann } -pair, shared_ptr> dev::yul::test::parse(string const& _source, bool _yul) +pair, shared_ptr> yul::test::parse(string const& _source, bool _yul) { - auto flavour = _yul ? assembly::AsmFlavour::Yul : assembly::AsmFlavour::Strict; + auto flavour = _yul ? yul::AsmFlavour::Yul : yul::AsmFlavour::Strict; ErrorList errors; ErrorReporter errorReporter(errors); auto scanner = make_shared(CharStream(_source), ""); - auto parserResult = assembly::Parser(errorReporter, flavour).parse(scanner, false); + auto parserResult = yul::Parser(errorReporter, flavour).parse(scanner, false); if (parserResult) { BOOST_REQUIRE(errorReporter.errors().empty()); - auto analysisInfo = make_shared(); - assembly::AsmAnalyzer analyzer( + auto analysisInfo = make_shared(); + yul::AsmAnalyzer analyzer( *analysisInfo, errorReporter, dev::test::Options::get().evmVersion(), @@ -83,13 +83,13 @@ pair, shared_ptr> dev::yul::test::p return {}; } -assembly::Block dev::yul::test::disambiguate(string const& _source, bool _yul) +yul::Block yul::test::disambiguate(string const& _source, bool _yul) { auto result = parse(_source, _yul); return boost::get(Disambiguator(*result.second, {})(*result.first)); } -string dev::yul::test::format(string const& _source, bool _yul) +string yul::test::format(string const& _source, bool _yul) { - return assembly::AsmPrinter(_yul)(*parse(_source, _yul).first); + return yul::AsmPrinter(_yul)(*parse(_source, _yul).first); } diff --git a/test/libyul/Common.h b/test/libyul/Common.h index 8241bfe1..a1c64ca5 100644 --- a/test/libyul/Common.h +++ b/test/libyul/Common.h @@ -34,26 +34,21 @@ class Error; using ErrorList = std::vector>; } -namespace dev -{ -namespace solidity -{ -namespace assembly +namespace yul { struct AsmAnalysisInfo; } -} + namespace yul { namespace test { void printErrors(langutil::ErrorList const& _errors, langutil::Scanner const& _scanner); -std::pair, std::shared_ptr> +std::pair, std::shared_ptr> parse(std::string const& _source, bool _yul = true); -solidity::assembly::Block disambiguate(std::string const& _source, bool _yul = true); +Block disambiguate(std::string const& _source, bool _yul = true); std::string format(std::string const& _source, bool _yul = true); } } -} diff --git a/test/libyul/Inliner.cpp b/test/libyul/Inliner.cpp index 0f82dee3..631cda08 100644 --- a/test/libyul/Inliner.cpp +++ b/test/libyul/Inliner.cpp @@ -35,8 +35,8 @@ using namespace std; using namespace dev; -using namespace dev::yul; -using namespace dev::yul::test; +using namespace yul; +using namespace yul::test; using namespace dev::solidity; namespace diff --git a/test/libyul/Parser.cpp b/test/libyul/Parser.cpp index 957973d0..6f946362 100644 --- a/test/libyul/Parser.cpp +++ b/test/libyul/Parser.cpp @@ -36,11 +36,10 @@ #include using namespace std; +using namespace dev; using namespace langutil; -namespace dev -{ -namespace solidity +namespace yul { namespace test { @@ -53,16 +52,16 @@ bool parse(string const& _source, ErrorReporter& errorReporter) try { auto scanner = make_shared(CharStream(_source)); - auto parserResult = assembly::Parser(errorReporter, assembly::AsmFlavour::Yul).parse(scanner, false); + auto parserResult = yul::Parser(errorReporter, yul::AsmFlavour::Yul).parse(scanner, false); if (parserResult) { - assembly::AsmAnalysisInfo analysisInfo; - return (assembly::AsmAnalyzer( + yul::AsmAnalysisInfo analysisInfo; + return (yul::AsmAnalyzer( analysisInfo, errorReporter, dev::test::Options::get().evmVersion(), boost::none, - assembly::AsmFlavour::Yul + yul::AsmFlavour::Yul )).analyze(*parserResult); } } @@ -117,7 +116,7 @@ do \ { \ Error err = expectError((text), false); \ BOOST_CHECK(err.type() == (Error::Type::typ)); \ - BOOST_CHECK(searchErrorMessage(err, (substring))); \ + BOOST_CHECK(dev::solidity::searchErrorMessage(err, (substring))); \ } while(0) BOOST_AUTO_TEST_SUITE(YulParser) @@ -302,6 +301,5 @@ BOOST_AUTO_TEST_CASE(if_statement_invalid) BOOST_AUTO_TEST_SUITE_END() -} } } // end namespaces diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index 02a63ae3..9c2da493 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -55,8 +55,8 @@ using namespace dev; using namespace langutil; -using namespace dev::yul; -using namespace dev::yul::test; +using namespace yul; +using namespace yul::test; using namespace dev::solidity; using namespace dev::solidity::test; using namespace std; @@ -92,9 +92,9 @@ YulOptimizerTest::YulOptimizerTest(string const& _filename) bool YulOptimizerTest::run(ostream& _stream, string const& _linePrefix, bool const _formatted) { - assembly::AsmPrinter printer{m_yul}; + yul::AsmPrinter printer{m_yul}; shared_ptr ast; - shared_ptr analysisInfo; + shared_ptr analysisInfo; if (!parse(_stream, _linePrefix, _formatted)) return false; @@ -256,19 +256,19 @@ void YulOptimizerTest::printIndented(ostream& _stream, string const& _output, st bool YulOptimizerTest::parse(ostream& _stream, string const& _linePrefix, bool const _formatted) { - assembly::AsmFlavour flavour = m_yul ? assembly::AsmFlavour::Yul : assembly::AsmFlavour::Strict; + yul::AsmFlavour flavour = m_yul ? yul::AsmFlavour::Yul : yul::AsmFlavour::Strict; ErrorList errors; ErrorReporter errorReporter(errors); shared_ptr scanner = make_shared(CharStream(m_source), ""); - m_ast = assembly::Parser(errorReporter, flavour).parse(scanner, false); + m_ast = yul::Parser(errorReporter, flavour).parse(scanner, false); if (!m_ast || !errorReporter.errors().empty()) { FormattedScope(_stream, _formatted, {formatting::BOLD, formatting::RED}) << _linePrefix << "Error parsing source." << endl; printErrors(_stream, errorReporter.errors(), *scanner); return false; } - m_analysisInfo = make_shared(); - assembly::AsmAnalyzer analyzer( + m_analysisInfo = make_shared(); + yul::AsmAnalyzer analyzer( *m_analysisInfo, errorReporter, dev::test::Options::get().evmVersion(), diff --git a/test/libyul/YulOptimizerTest.h b/test/libyul/YulOptimizerTest.h index d11ff8fb..72c4299f 100644 --- a/test/libyul/YulOptimizerTest.h +++ b/test/libyul/YulOptimizerTest.h @@ -26,22 +26,18 @@ class Error; using ErrorList = std::vector>; } -namespace dev -{ -namespace solidity -{ -namespace assembly +namespace yul { struct AsmAnalysisInfo; struct Block; } -} + namespace yul { namespace test { -class YulOptimizerTest: public solidity::test::TestCase +class YulOptimizerTest: public dev::solidity::test::TestCase { public: static std::unique_ptr create(std::string const& _filename) @@ -68,11 +64,10 @@ private: std::string m_optimizerStep; std::string m_expectation; - std::shared_ptr m_ast; - std::shared_ptr m_analysisInfo; + std::shared_ptr m_ast; + std::shared_ptr m_analysisInfo; std::string m_obtainedResult; }; } } -} diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index 4e916b49..7a147137 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -60,8 +60,7 @@ using namespace std; using namespace dev; using namespace langutil; using namespace dev::solidity; -using namespace dev::solidity::assembly; -using namespace dev::yul; +using namespace yul; namespace po = boost::program_options; @@ -83,14 +82,14 @@ public: { ErrorReporter errorReporter(m_errors); shared_ptr scanner = make_shared(CharStream(_input), ""); - m_ast = assembly::Parser(errorReporter, assembly::AsmFlavour::Strict).parse(scanner, false); + m_ast = yul::Parser(errorReporter, yul::AsmFlavour::Strict).parse(scanner, false); if (!m_ast || !errorReporter.errors().empty()) { cout << "Error parsing source." << endl; printErrors(*scanner); return false; } - m_analysisInfo = make_shared(); + m_analysisInfo = make_shared(); AsmAnalyzer analyzer( *m_analysisInfo, errorReporter, @@ -118,7 +117,7 @@ public: return; if (!disambiguated) { - *m_ast = boost::get(Disambiguator(*m_analysisInfo)(*m_ast)); + *m_ast = boost::get(Disambiguator(*m_analysisInfo)(*m_ast)); m_analysisInfo.reset(); m_nameDispenser = make_shared(*m_ast); disambiguated = true; @@ -187,7 +186,7 @@ public: private: ErrorList m_errors; - shared_ptr m_ast; + shared_ptr m_ast; shared_ptr m_analysisInfo; shared_ptr m_nameDispenser; }; -- cgit v1.2.3