mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add std:: qualifier to move() calls
This commit is contained in:
@@ -239,12 +239,12 @@ static map<string, uint8_t> const builtins = {
|
||||
bytes prefixSize(bytes _data)
|
||||
{
|
||||
size_t size = _data.size();
|
||||
return lebEncode(size) + move(_data);
|
||||
return lebEncode(size) + std::move(_data);
|
||||
}
|
||||
|
||||
bytes makeSection(Section _section, bytes _data)
|
||||
{
|
||||
return toBytes(_section) + prefixSize(move(_data));
|
||||
return toBytes(_section) + prefixSize(std::move(_data));
|
||||
}
|
||||
|
||||
/// This is a kind of run-length-encoding of local types.
|
||||
@@ -306,7 +306,7 @@ bytes BinaryTransform::run(Module const& _module)
|
||||
// TODO should we prefix and / or shorten the name?
|
||||
bytes data = BinaryTransform::run(module);
|
||||
size_t const length = data.size();
|
||||
ret += customSection(name, move(data));
|
||||
ret += customSection(name, std::move(data));
|
||||
// Skip all the previous sections and the size field of this current custom section.
|
||||
size_t const offset = ret.size() - length;
|
||||
subModulePosAndSize[name] = {offset, length};
|
||||
@@ -321,10 +321,10 @@ bytes BinaryTransform::run(Module const& _module)
|
||||
}
|
||||
|
||||
BinaryTransform bt(
|
||||
move(globalIDs),
|
||||
move(functionIDs),
|
||||
move(functionTypes),
|
||||
move(subModulePosAndSize)
|
||||
std::move(globalIDs),
|
||||
std::move(functionIDs),
|
||||
std::move(functionTypes),
|
||||
std::move(subModulePosAndSize)
|
||||
);
|
||||
|
||||
ret += bt.codeSection(_module.functions);
|
||||
@@ -378,7 +378,7 @@ bytes BinaryTransform::operator()(BuiltinCall const& _call)
|
||||
yulAssert(builtins.count(_call.functionName), "Builtin " + _call.functionName + " not found");
|
||||
// NOTE: the dialect ensures we have the right amount of arguments
|
||||
bytes args = visit(_call.arguments);
|
||||
bytes ret = move(args) + toBytes(builtins.at(_call.functionName));
|
||||
bytes ret = std::move(args) + toBytes(builtins.at(_call.functionName));
|
||||
if (
|
||||
_call.functionName.find(".load") != string::npos ||
|
||||
_call.functionName.find(".store") != string::npos
|
||||
@@ -500,7 +500,7 @@ bytes BinaryTransform::operator()(FunctionDefinition const& _function)
|
||||
|
||||
yulAssert(m_labels.empty(), "Stray labels.");
|
||||
|
||||
return prefixSize(move(ret));
|
||||
return prefixSize(std::move(ret));
|
||||
}
|
||||
|
||||
BinaryTransform::Type BinaryTransform::typeOf(FunctionImport const& _import)
|
||||
@@ -602,7 +602,7 @@ bytes BinaryTransform::typeSection(map<BinaryTransform::Type, vector<string>> co
|
||||
index++;
|
||||
}
|
||||
|
||||
return makeSection(Section::TYPE, lebEncode(index) + move(result));
|
||||
return makeSection(Section::TYPE, lebEncode(index) + std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::importSection(
|
||||
@@ -620,7 +620,7 @@ bytes BinaryTransform::importSection(
|
||||
toBytes(importKind) +
|
||||
lebEncode(_functionTypes.at(import.internalName));
|
||||
}
|
||||
return makeSection(Section::IMPORT, move(result));
|
||||
return makeSection(Section::IMPORT, std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::functionSection(
|
||||
@@ -631,7 +631,7 @@ bytes BinaryTransform::functionSection(
|
||||
bytes result = lebEncode(_functions.size());
|
||||
for (auto const& fun: _functions)
|
||||
result += lebEncode(_functionTypes.at(fun.name));
|
||||
return makeSection(Section::FUNCTION, move(result));
|
||||
return makeSection(Section::FUNCTION, std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::memorySection()
|
||||
@@ -639,7 +639,7 @@ bytes BinaryTransform::memorySection()
|
||||
bytes result = lebEncode(1);
|
||||
result.push_back(static_cast<uint8_t>(LimitsKind::Min));
|
||||
result.push_back(1); // initial length
|
||||
return makeSection(Section::MEMORY, move(result));
|
||||
return makeSection(Section::MEMORY, std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::globalSection(vector<wasm::GlobalVariableDeclaration> const& _globals)
|
||||
@@ -656,7 +656,7 @@ bytes BinaryTransform::globalSection(vector<wasm::GlobalVariableDeclaration> con
|
||||
toBytes(Opcode::End);
|
||||
}
|
||||
|
||||
return makeSection(Section::GLOBAL, move(result));
|
||||
return makeSection(Section::GLOBAL, std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::exportSection(map<string, size_t> const& _functionIDs)
|
||||
@@ -666,13 +666,13 @@ bytes BinaryTransform::exportSection(map<string, size_t> const& _functionIDs)
|
||||
result += encodeName("memory") + toBytes(Export::Memory) + lebEncode(0);
|
||||
if (hasMain)
|
||||
result += encodeName("main") + toBytes(Export::Function) + lebEncode(_functionIDs.at("main"));
|
||||
return makeSection(Section::EXPORT, move(result));
|
||||
return makeSection(Section::EXPORT, std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::customSection(string const& _name, bytes _data)
|
||||
{
|
||||
bytes result = encodeName(_name) + move(_data);
|
||||
return makeSection(Section::CUSTOM, move(result));
|
||||
bytes result = encodeName(_name) + std::move(_data);
|
||||
return makeSection(Section::CUSTOM, std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::codeSection(vector<wasm::FunctionDefinition> const& _functions)
|
||||
@@ -680,7 +680,7 @@ bytes BinaryTransform::codeSection(vector<wasm::FunctionDefinition> const& _func
|
||||
bytes result = lebEncode(_functions.size());
|
||||
for (FunctionDefinition const& fun: _functions)
|
||||
result += (*this)(fun);
|
||||
return makeSection(Section::CODE, move(result));
|
||||
return makeSection(Section::CODE, std::move(result));
|
||||
}
|
||||
|
||||
bytes BinaryTransform::visit(vector<Expression> const& _expressions)
|
||||
|
||||
@@ -92,7 +92,7 @@ Object EVMToEwasmTranslator::run(Object const& _object)
|
||||
|
||||
Object ret;
|
||||
ret.name = _object.name;
|
||||
ret.code = make_shared<Block>(move(ast));
|
||||
ret.code = make_shared<Block>(std::move(ast));
|
||||
ret.debugData = _object.debugData;
|
||||
ret.analysisInfo = make_shared<AsmAnalysisInfo>();
|
||||
|
||||
|
||||
@@ -90,7 +90,7 @@ string TextTransform::run(wasm::Module const& _module)
|
||||
ret += "\n";
|
||||
for (auto const& f: _module.functions)
|
||||
ret += transform(f) + "\n";
|
||||
return move(ret) + ")\n";
|
||||
return std::move(ret) + ")\n";
|
||||
}
|
||||
|
||||
string TextTransform::operator()(wasm::Literal const& _literal)
|
||||
@@ -159,7 +159,7 @@ string TextTransform::operator()(wasm::If const& _if)
|
||||
string TextTransform::operator()(wasm::Loop const& _loop)
|
||||
{
|
||||
string label = _loop.labelName.empty() ? "" : " $" + _loop.labelName;
|
||||
return "(loop" + move(label) + "\n" + indented(joinTransformed(_loop.statements, '\n')) + ")\n";
|
||||
return "(loop" + std::move(label) + "\n" + indented(joinTransformed(_loop.statements, '\n')) + ")\n";
|
||||
}
|
||||
|
||||
string TextTransform::operator()(wasm::Branch const& _branch)
|
||||
@@ -180,7 +180,7 @@ string TextTransform::operator()(wasm::Return const&)
|
||||
string TextTransform::operator()(wasm::Block const& _block)
|
||||
{
|
||||
string label = _block.labelName.empty() ? "" : " $" + _block.labelName;
|
||||
return "(block" + move(label) + "\n" + indented(joinTransformed(_block.statements, '\n')) + "\n)\n";
|
||||
return "(block" + std::move(label) + "\n" + indented(joinTransformed(_block.statements, '\n')) + "\n)\n";
|
||||
}
|
||||
|
||||
string TextTransform::indented(string const& _in)
|
||||
@@ -230,7 +230,7 @@ string TextTransform::joinTransformed(vector<wasm::Expression> const& _expressio
|
||||
string t = visit(e);
|
||||
if (!t.empty() && !ret.empty() && ret.back() != '\n')
|
||||
ret += _separator;
|
||||
ret += move(t);
|
||||
ret += std::move(t);
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -68,7 +68,7 @@ wasm::Expression WasmCodeTransform::generateMultiAssignment(
|
||||
)
|
||||
{
|
||||
yulAssert(!_variableNames.empty(), "");
|
||||
wasm::LocalAssignment assignment{move(_variableNames.front()), std::move(_firstValue)};
|
||||
wasm::LocalAssignment assignment{std::move(_variableNames.front()), std::move(_firstValue)};
|
||||
|
||||
if (_variableNames.size() == 1)
|
||||
return { std::move(assignment) };
|
||||
@@ -80,10 +80,10 @@ wasm::Expression WasmCodeTransform::generateMultiAssignment(
|
||||
yulAssert(allocatedIndices.size() == _variableNames.size() - 1, "");
|
||||
|
||||
wasm::Block block;
|
||||
block.statements.emplace_back(move(assignment));
|
||||
block.statements.emplace_back(std::move(assignment));
|
||||
for (size_t i = 1; i < _variableNames.size(); ++i)
|
||||
block.statements.emplace_back(wasm::LocalAssignment{
|
||||
move(_variableNames.at(i)),
|
||||
std::move(_variableNames.at(i)),
|
||||
make_unique<wasm::Expression>(wasm::GlobalVariable{m_globalVariables.at(allocatedIndices[i - 1]).variableName})
|
||||
});
|
||||
return { std::move(block) };
|
||||
@@ -99,7 +99,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::VariableDeclaration const& _
|
||||
}
|
||||
|
||||
if (_varDecl.value)
|
||||
return generateMultiAssignment(move(variableNames), visit(*_varDecl.value));
|
||||
return generateMultiAssignment(std::move(variableNames), visit(*_varDecl.value));
|
||||
else
|
||||
return wasm::BuiltinCall{"nop", {}};
|
||||
}
|
||||
@@ -109,7 +109,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::Assignment const& _assignmen
|
||||
vector<string> variableNames;
|
||||
for (auto const& var: _assignment.variableNames)
|
||||
variableNames.emplace_back(var.name.str());
|
||||
return generateMultiAssignment(move(variableNames), visit(*_assignment.value));
|
||||
return generateMultiAssignment(std::move(variableNames), visit(*_assignment.value));
|
||||
}
|
||||
|
||||
wasm::Expression WasmCodeTransform::operator()(yul::ExpressionStatement const& _statement)
|
||||
@@ -134,7 +134,7 @@ void WasmCodeTransform::importBuiltinFunction(BuiltinFunction const* _builtin, s
|
||||
};
|
||||
for (auto const& param: _builtin->parameters)
|
||||
imp.paramTypes.emplace_back(translatedType(param));
|
||||
m_functionsToImport[internalName] = move(imp);
|
||||
m_functionsToImport[internalName] = std::move(imp);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -199,7 +199,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::If const& _if)
|
||||
else
|
||||
yulAssert(false, "Invalid condition type");
|
||||
|
||||
return wasm::If{make_unique<wasm::Expression>(move(condition)), visit(_if.body.statements), {}};
|
||||
return wasm::If{make_unique<wasm::Expression>(std::move(condition)), visit(_if.body.statements), {}};
|
||||
}
|
||||
|
||||
wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch)
|
||||
@@ -224,7 +224,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch)
|
||||
visitReturnByValue(*c.value)
|
||||
)};
|
||||
wasm::If ifStmnt{
|
||||
make_unique<wasm::Expression>(move(comparison)),
|
||||
make_unique<wasm::Expression>(std::move(comparison)),
|
||||
visit(c.body.statements),
|
||||
{}
|
||||
};
|
||||
@@ -234,7 +234,7 @@ wasm::Expression WasmCodeTransform::operator()(yul::Switch const& _switch)
|
||||
ifStmnt.elseStatements = make_unique<vector<wasm::Expression>>();
|
||||
nextBlock = ifStmnt.elseStatements.get();
|
||||
}
|
||||
currentBlock->emplace_back(move(ifStmnt));
|
||||
currentBlock->emplace_back(std::move(ifStmnt));
|
||||
currentBlock = nextBlock;
|
||||
}
|
||||
else
|
||||
@@ -275,8 +275,8 @@ wasm::Expression WasmCodeTransform::operator()(yul::ForLoop const& _for)
|
||||
loop.statements += visit(_for.post.statements);
|
||||
loop.statements.emplace_back(wasm::Branch{wasm::Label{loop.labelName}});
|
||||
|
||||
statements += make_vector<wasm::Expression>(move(loop));
|
||||
return wasm::Block{breakLabel, move(statements)};
|
||||
statements += make_vector<wasm::Expression>(std::move(loop));
|
||||
return wasm::Block{breakLabel, std::move(statements)};
|
||||
}
|
||||
|
||||
wasm::Expression WasmCodeTransform::operator()(yul::Break const&)
|
||||
|
||||
@@ -269,7 +269,7 @@ void WasmDialect::addFunction(
|
||||
vector<optional<LiteralKind>> _literalArguments
|
||||
)
|
||||
{
|
||||
YulString name{move(_name)};
|
||||
YulString name{std::move(_name)};
|
||||
BuiltinFunction& f = m_functions[name];
|
||||
f.name = name;
|
||||
f.parameters = std::move(_params);
|
||||
|
||||
Reference in New Issue
Block a user