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 --- libevmasm/Assembly.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'libevmasm/Assembly.cpp') diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 29d9846d..2654eae2 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -83,7 +83,7 @@ AssemblyItem const& Assembly::append(AssemblyItem const& _i) { assertThrow(m_deposit >= 0, AssemblyException, "Stack underflow."); m_deposit += _i.deposit(); - m_items.push_back(_i); + m_items.emplace_back(_i); if (m_items.back().location().isEmpty() && !m_currentSourceLocation.isEmpty()) m_items.back().setLocation(m_currentSourceLocation); return back(); -- cgit v1.2.3 From cb935fe9086b60295f97c5b8a5fd0ea8245d145e Mon Sep 17 00:00:00 2001 From: Mathias Baumann Date: Mon, 10 Dec 2018 19:03:47 +0100 Subject: Use curly-brackets initialization --- libevmasm/Assembly.cpp | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) (limited to 'libevmasm/Assembly.cpp') diff --git a/libevmasm/Assembly.cpp b/libevmasm/Assembly.cpp index 2654eae2..231eed93 100644 --- a/libevmasm/Assembly.cpp +++ b/libevmasm/Assembly.cpp @@ -353,14 +353,14 @@ AssemblyItem Assembly::namedTag(string const& _name) assertThrow(!_name.empty(), AssemblyException, "Empty named tag."); if (!m_namedTags.count(_name)) m_namedTags[_name] = size_t(newTag().data()); - return AssemblyItem(Tag, m_namedTags.at(_name)); + return AssemblyItem{Tag, m_namedTags.at(_name)}; } AssemblyItem Assembly::newPushLibraryAddress(string const& _identifier) { h256 h(dev::keccak256(_identifier)); m_libraries[h] = _identifier; - return AssemblyItem(PushLibraryAddress, h); + return AssemblyItem{PushLibraryAddress, h}; } Assembly& Assembly::optimise(bool _enable, EVMVersion _evmVersion, bool _isCreation, size_t _runs) @@ -415,14 +415,14 @@ map Assembly::optimiseInternal( if (_settings.runJumpdestRemover) { - JumpdestRemover jumpdestOpt(m_items); + JumpdestRemover jumpdestOpt{m_items}; if (jumpdestOpt.optimise(_tagsReferencedFromOutside)) count++; } if (_settings.runPeephole) { - PeepholeOptimiser peepOpt(m_items); + PeepholeOptimiser peepOpt{m_items}; while (peepOpt.optimise()) { count++; @@ -433,7 +433,7 @@ map Assembly::optimiseInternal( // This only modifies PushTags, we have to run again to actually remove code. if (_settings.runDeduplicate) { - BlockDeduplicator dedup(m_items); + BlockDeduplicator dedup{m_items}; if (dedup.deduplicate()) { tagReplacements.insert(dedup.replacedTags().begin(), dedup.replacedTags().end()); @@ -448,13 +448,13 @@ map Assembly::optimiseInternal( // function types that can be stored in storage. AssemblyItems optimisedItems; - bool usesMSize = (find(m_items.begin(), m_items.end(), AssemblyItem(Instruction::MSIZE)) != m_items.end()); + bool usesMSize = (find(m_items.begin(), m_items.end(), AssemblyItem{Instruction::MSIZE}) != m_items.end()); auto iter = m_items.begin(); while (iter != m_items.end()) { KnownState emptyState; - CommonSubexpressionEliminator eliminator(emptyState); + CommonSubexpressionEliminator eliminator{emptyState}; auto orig = iter; iter = eliminator.feedItems(iter, m_items.end(), usesMSize); bool shouldReplace = false; -- cgit v1.2.3