From 2f6dc2e773148f63f4e2b9d9b3f9bb7eb092fde8 Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 10 Dec 2018 19:02:39 +0100 Subject: Replace push_back with emplace_back where it makes sense --- liblll/CodeFragment.cpp | 6 +++--- liblll/Compiler.cpp | 20 ++++++++++---------- 2 files changed, 13 insertions(+), 13 deletions(-) (limited to 'liblll') diff --git a/liblll/CodeFragment.cpp b/liblll/CodeFragment.cpp index b32f14e9..63d8da3d 100644 --- a/liblll/CodeFragment.cpp +++ b/liblll/CodeFragment.cpp @@ -353,7 +353,7 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) if (j.tag() || j.which() != sp::utree_type::symbol_type) error(); auto sr = j.get, sp::utree_type::symbol_type>>(); - args.push_back(string(sr.begin(), sr.end())); + args.emplace_back(sr.begin(), sr.end()); } else if (ii == 3) { @@ -464,9 +464,9 @@ void CodeFragment::constructOperation(sp::utree const& _t, CompilerState& _s) if (c++) { if (us == "LLL" && c == 1) - code.push_back(CodeFragment(i, ns, m_readFile)); + code.emplace_back(i, ns, m_readFile); else - code.push_back(CodeFragment(i, _s, m_readFile)); + code.emplace_back(i, _s, m_readFile); } auto requireSize = [&](unsigned s) { if (code.size() != s) error(us); }; auto requireMinSize = [&](unsigned s) { if (code.size() < s) error(us); }; diff --git a/liblll/Compiler.cpp b/liblll/Compiler.cpp index f944adbd..6296cbcf 100644 --- a/liblll/Compiler.cpp +++ b/liblll/Compiler.cpp @@ -46,22 +46,22 @@ bytes dev::lll::compileLLL(string const& _src, dev::solidity::EVMVersion _evmVer { if (_errors) { - _errors->push_back("Parse error."); - _errors->push_back(boost::diagnostic_information(_e)); + _errors->emplace_back("Parse error."); + _errors->emplace_back(boost::diagnostic_information(_e)); } } catch (std::exception const& _e) { if (_errors) { - _errors->push_back("Parse exception."); - _errors->push_back(boost::diagnostic_information(_e)); + _errors->emplace_back("Parse exception."); + _errors->emplace_back(boost::diagnostic_information(_e)); } } catch (...) { if (_errors) - _errors->push_back("Internal compiler exception."); + _errors->emplace_back("Internal compiler exception."); } return bytes(); } @@ -84,22 +84,22 @@ std::string dev::lll::compileLLLToAsm(std::string const& _src, EVMVersion _evmVe { if (_errors) { - _errors->push_back("Parse error."); - _errors->push_back(boost::diagnostic_information(_e)); + _errors->emplace_back("Parse error."); + _errors->emplace_back(boost::diagnostic_information(_e)); } } catch (std::exception const& _e) { if (_errors) { - _errors->push_back("Parse exception."); - _errors->push_back(boost::diagnostic_information(_e)); + _errors->emplace_back("Parse exception."); + _errors->emplace_back(boost::diagnostic_information(_e)); } } catch (...) { if (_errors) - _errors->push_back("Internal compiler exception."); + _errors->emplace_back("Internal compiler exception."); } return string(); } -- cgit v1.2.3 From 2353f73c396e2c3c89baabf4e277d25abdfc526f Mon Sep 17 00:00:00 2001 From: Daniel Kirchner Date: Mon, 17 Dec 2018 15:00:39 +0100 Subject: Add headers to targets in CMakeLists.txt. --- liblll/CMakeLists.txt | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'liblll') diff --git a/liblll/CMakeLists.txt b/liblll/CMakeLists.txt index 9566c62f..c529461b 100644 --- a/liblll/CMakeLists.txt +++ b/liblll/CMakeLists.txt @@ -1,8 +1,13 @@ set(sources CodeFragment.cpp + CodeFragment.h Compiler.cpp + Compiler.h CompilerState.cpp + CompilerState.h + Exceptions.h Parser.cpp + Parser.h ) add_library(lll ${sources}) -- cgit v1.2.3 From 62fe57479e7d8949e4ed2e0efb31238d5d8d6d0a Mon Sep 17 00:00:00 2001 From: Christian Parpart Date: Wed, 12 Dec 2018 14:51:22 +0100 Subject: make use of C++ `= default` constructor declarations as well as more non-static member initialization syntax. --- liblll/CodeFragment.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'liblll') diff --git a/liblll/CodeFragment.h b/liblll/CodeFragment.h index e6e4d3b6..5c2f49a6 100644 --- a/liblll/CodeFragment.h +++ b/liblll/CodeFragment.h @@ -41,7 +41,7 @@ class CodeFragment public: using ReadCallback = std::function; - CodeFragment() {} + CodeFragment() = default; CodeFragment(sp::utree const& _t, CompilerState& _s, ReadCallback const& _readFile, bool _allowASM = false); static CodeFragment compile(std::string const& _src, CompilerState& _s, ReadCallback const& _readFile); -- cgit v1.2.3