mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Apply modernize-use-emplace.
This commit is contained in:
@@ -76,13 +76,13 @@ BOOST_AUTO_TEST_CASE(test_alternatives_list)
|
||||
{
|
||||
vector<string> strings;
|
||||
BOOST_CHECK_EQUAL(quotedAlternativesList(strings), "");
|
||||
strings.push_back("a");
|
||||
strings.emplace_back("a");
|
||||
BOOST_CHECK_EQUAL(quotedAlternativesList(strings), "\"a\"");
|
||||
strings.push_back("b");
|
||||
strings.emplace_back("b");
|
||||
BOOST_CHECK_EQUAL(quotedAlternativesList(strings), "\"a\" or \"b\"");
|
||||
strings.push_back("c");
|
||||
strings.emplace_back("c");
|
||||
BOOST_CHECK_EQUAL(quotedAlternativesList(strings), "\"a\", \"b\" or \"c\"");
|
||||
strings.push_back("d");
|
||||
strings.emplace_back("d");
|
||||
BOOST_CHECK_EQUAL(quotedAlternativesList(strings), "\"a\", \"b\", \"c\" or \"d\"");
|
||||
}
|
||||
|
||||
|
||||
@@ -47,15 +47,15 @@ string toString(SideEffects const& _sideEffects)
|
||||
{
|
||||
vector<string> ret;
|
||||
if (_sideEffects.movable)
|
||||
ret.push_back("movable");
|
||||
ret.emplace_back("movable");
|
||||
if (_sideEffects.sideEffectFree)
|
||||
ret.push_back("sideEffectFree");
|
||||
ret.emplace_back("sideEffectFree");
|
||||
if (_sideEffects.sideEffectFreeIfNoMSize)
|
||||
ret.push_back("sideEffectFreeIfNoMSize");
|
||||
ret.emplace_back("sideEffectFreeIfNoMSize");
|
||||
if (_sideEffects.invalidatesStorage)
|
||||
ret.push_back("invalidatesStorage");
|
||||
ret.emplace_back("invalidatesStorage");
|
||||
if (_sideEffects.invalidatesMemory)
|
||||
ret.push_back("invalidatesMemory");
|
||||
ret.emplace_back("invalidatesMemory");
|
||||
return joinHumanReadable(ret);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -104,7 +104,7 @@ Allowed options)",
|
||||
else if (arguments.count("input-files"))
|
||||
inputs = arguments["input-files"].as<vector<string>>();
|
||||
else
|
||||
inputs.push_back("");
|
||||
inputs.emplace_back("");
|
||||
|
||||
bool optimize = !arguments.count("without-optimizer");
|
||||
int retResult = 0;
|
||||
|
||||
@@ -308,7 +308,7 @@ pair<
|
||||
for (auto const& scope: m_scopes)
|
||||
{
|
||||
// Copy over all functions.
|
||||
newScopes.push_back({});
|
||||
newScopes.emplace_back();
|
||||
for (auto const& [name, funDef]: scope)
|
||||
if (funDef)
|
||||
newScopes.back().emplace(name, funDef);
|
||||
|
||||
@@ -136,7 +136,7 @@ private:
|
||||
/// Evaluates the expression and returns its value.
|
||||
std::vector<u256> evaluateMulti(Expression const& _expression);
|
||||
|
||||
void openScope() { m_scopes.push_back({}); }
|
||||
void openScope() { m_scopes.emplace_back(); }
|
||||
/// Unregisters variables and functions.
|
||||
void closeScope();
|
||||
|
||||
|
||||
Reference in New Issue
Block a user