Add std:: qualifier to move() calls

This commit is contained in:
Marenz
2022-08-30 11:12:15 +02:00
parent 19e3c7339e
commit f7cc29bec1
111 changed files with 362 additions and 362 deletions
+9 -9
View File
@@ -88,7 +88,7 @@ void Parser::updateLocationEndFrom(
DebugData updatedDebugData = *_debugData;
updatedDebugData.nativeLocation.end = _location.end;
updatedDebugData.originLocation.end = _location.end;
_debugData = make_shared<DebugData const>(move(updatedDebugData));
_debugData = make_shared<DebugData const>(std::move(updatedDebugData));
break;
}
case UseSourceLocationFrom::LocationOverride:
@@ -98,7 +98,7 @@ void Parser::updateLocationEndFrom(
{
DebugData updatedDebugData = *_debugData;
updatedDebugData.nativeLocation.end = _location.end;
_debugData = make_shared<DebugData const>(move(updatedDebugData));
_debugData = make_shared<DebugData const>(std::move(updatedDebugData));
break;
}
}
@@ -246,7 +246,7 @@ optional<pair<string_view, SourceLocation>> Parser::parseSrcComment(
{
shared_ptr<string const> sourceName = m_sourceNames->at(static_cast<unsigned>(sourceIndex.value()));
solAssert(sourceName, "");
return {{tail, SourceLocation{start.value(), end.value(), move(sourceName)}}};
return {{tail, SourceLocation{start.value(), end.value(), std::move(sourceName)}}};
}
return {{tail, SourceLocation{}}};
}
@@ -313,7 +313,7 @@ Statement Parser::parseStatement()
_if.condition = make_unique<Expression>(parseExpression());
_if.body = parseBlock();
updateLocationEndFrom(_if.debugData, nativeLocationOf(_if.body));
return Statement{move(_if)};
return Statement{std::move(_if)};
}
case Token::Switch:
{
@@ -331,7 +331,7 @@ Statement Parser::parseStatement()
if (_switch.cases.empty())
fatalParserError(2418_error, "Switch statement without any cases.");
updateLocationEndFrom(_switch.debugData, nativeLocationOf(_switch.cases.back().body));
return Statement{move(_switch)};
return Statement{std::move(_switch)};
}
case Token::For:
return parseForLoop();
@@ -371,7 +371,7 @@ Statement Parser::parseStatement()
case Token::LParen:
{
Expression expr = parseCall(std::move(elementary));
return ExpressionStatement{debugDataOf(expr), move(expr)};
return ExpressionStatement{debugDataOf(expr), std::move(expr)};
}
case Token::Comma:
case Token::AssemblyAssign:
@@ -414,7 +414,7 @@ Statement Parser::parseStatement()
assignment.value = make_unique<Expression>(parseExpression());
updateLocationEndFrom(assignment.debugData, nativeLocationOf(*assignment.value));
return Statement{move(assignment)};
return Statement{std::move(assignment)};
}
default:
fatalParserError(6913_error, "Call or assignment expected.");
@@ -485,11 +485,11 @@ Expression Parser::parseExpression()
nativeLocationOf(_identifier),
"Builtin function \"" + _identifier.name.str() + "\" must be called."
);
return move(_identifier);
return std::move(_identifier);
},
[&](Literal& _literal) -> Expression
{
return move(_literal);
return std::move(_literal);
}
}, operation);
}
+1 -1
View File
@@ -197,7 +197,7 @@ string AsmPrinter::operator()(ForLoop const& _forLoop)
delim = ' ';
return
locationComment +
("for " + move(pre) + delim + move(condition) + delim + move(post) + "\n") +
("for " + std::move(pre) + delim + std::move(condition) + delim + std::move(post) + "\n") +
(*this)(_forLoop.body);
}
+1 -1
View File
@@ -92,7 +92,7 @@ void ControlFlowBuilder::operator()(FunctionDefinition const& _function)
m_currentNode->successors.emplace_back(flow.exit);
m_functionFlows[&_function] = move(flow);
m_functionFlows[&_function] = std::move(flow);
m_leave = nullptr;
}
+4 -4
View File
@@ -88,7 +88,7 @@ shared_ptr<Object> ObjectParser::parseObject(Object* _containingObject)
expectToken(Token::LBrace);
ret->code = parseCode(move(sourceNameMapping));
ret->code = parseCode(std::move(sourceNameMapping));
while (currentToken() != Token::RBrace)
{
@@ -113,7 +113,7 @@ shared_ptr<Block> ObjectParser::parseCode(optional<SourceNameMap> _sourceNames)
fatalParserError(4846_error, "Expected keyword \"code\".");
advance();
return parseBlock(move(_sourceNames));
return parseBlock(std::move(_sourceNames));
}
optional<SourceNameMap> ObjectParser::tryParseSourceNameMapping() const
@@ -156,7 +156,7 @@ optional<SourceNameMap> ObjectParser::tryParseSourceNameMapping() const
Token const next = scanner.next();
if (next == Token::EOS)
return {move(sourceNames)};
return {std::move(sourceNames)};
if (next != Token::Comma)
break;
scanner.next();
@@ -172,7 +172,7 @@ optional<SourceNameMap> ObjectParser::tryParseSourceNameMapping() const
shared_ptr<Block> ObjectParser::parseBlock(optional<SourceNameMap> _sourceNames)
{
Parser parser(m_errorReporter, m_dialect, move(_sourceNames));
Parser parser(m_errorReporter, m_dialect, std::move(_sourceNames));
shared_ptr<Block> block = parser.parseInline(m_scanner);
yulAssert(block || m_errorReporter.hasErrors(), "Invalid block but no error!");
return block;
+3 -3
View File
@@ -130,7 +130,7 @@ Representation const& RepresentationFinder::findRepresentation(u256 const& _valu
if (numberEncodingSize(~_value) < numberEncodingSize(_value))
// Negated is shorter to represent
routine = min(move(routine), represent("not"_yulstring, findRepresentation(~_value)));
routine = min(std::move(routine), represent("not"_yulstring, findRepresentation(~_value)));
// Decompose value into a * 2**k + b where abs(b) << 2**k
for (unsigned bits = 255; bits > 8 && m_maxSteps > 0; --bits)
@@ -171,10 +171,10 @@ Representation const& RepresentationFinder::findRepresentation(u256 const& _valu
if (m_maxSteps > 0)
m_maxSteps--;
routine = min(move(routine), move(newRoutine));
routine = min(std::move(routine), std::move(newRoutine));
}
yulAssert(MiniEVMInterpreter{m_dialect}.eval(*routine.expression) == _value, "Invalid expression generated.");
return m_cache[_value] = move(routine);
return m_cache[_value] = std::move(routine);
}
Representation RepresentationFinder::represent(u256 const& _value) const
+1 -1
View File
@@ -236,7 +236,7 @@ struct CFG
BasicBlock& makeBlock(std::shared_ptr<DebugData const> _debugData)
{
return blocks.emplace_back(BasicBlock{move(_debugData), {}, {}});
return blocks.emplace_back(BasicBlock{std::move(_debugData), {}, {}});
}
};
@@ -532,7 +532,7 @@ Stack const& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _cal
return TemporarySlot{_call, _i};
}) | ranges::to<Stack>,
// operation
move(builtinCall)
std::move(builtinCall)
}).output;
}
else
@@ -607,8 +607,8 @@ void ControlFlowGraphBuilder::makeConditionalJump(
{
yulAssert(m_currentBlock, "");
m_currentBlock->exit = CFG::BasicBlock::ConditionalJump{
move(_debugData),
move(_condition),
std::move(_debugData),
std::move(_condition),
&_nonZero,
&_zero
};
@@ -624,7 +624,7 @@ void ControlFlowGraphBuilder::jump(
)
{
yulAssert(m_currentBlock, "");
m_currentBlock->exit = CFG::BasicBlock::Jump{move(_debugData), &_target, backwards};
m_currentBlock->exit = CFG::BasicBlock::Jump{std::move(_debugData), &_target, backwards};
_target.entries.emplace_back(m_currentBlock);
m_currentBlock = &_target;
}
+5 -5
View File
@@ -64,9 +64,9 @@ CodeTransform::CodeTransform(
m_builtinContext(_builtinContext),
m_allowStackOpt(_allowStackOpt),
m_useNamedLabelsForFunctions(_useNamedLabelsForFunctions),
m_identifierAccessCodeGen(move(_identifierAccessCodeGen)),
m_context(move(_context)),
m_delayedReturnVariables(move(_delayedReturnVariables)),
m_identifierAccessCodeGen(std::move(_identifierAccessCodeGen)),
m_context(std::move(_context)),
m_delayedReturnVariables(std::move(_delayedReturnVariables)),
m_functionExitLabel(_functionExitLabel)
{
if (!m_context)
@@ -406,11 +406,11 @@ void CodeTransform::operator()(FunctionDefinition const& _function)
if (!m_allowStackOpt)
subTransform.setupReturnVariablesAndFunctionExit();
subTransform.m_assignedNamedLabels = move(m_assignedNamedLabels);
subTransform.m_assignedNamedLabels = std::move(m_assignedNamedLabels);
subTransform(_function.body);
m_assignedNamedLabels = move(subTransform.m_assignedNamedLabels);
m_assignedNamedLabels = std::move(subTransform.m_assignedNamedLabels);
m_assembly.setSourceLocation(originLocationOf(_function));
if (!subTransform.m_stackErrors.empty())
+1 -1
View File
@@ -383,7 +383,7 @@ BuiltinFunctionForEVM const* EVMDialect::verbatimFunction(size_t _arguments, siz
}
).second;
builtinFunction.isMSize = true;
function = make_shared<BuiltinFunctionForEVM const>(move(builtinFunction));
function = make_shared<BuiltinFunctionForEVM const>(std::move(builtinFunction));
}
return function.get();
}
+1 -1
View File
@@ -96,7 +96,7 @@ void EthAssemblyAdapter::appendLinkerSymbol(std::string const& _linkerSymbol)
void EthAssemblyAdapter::appendVerbatim(bytes _data, size_t _arguments, size_t _returnVariables)
{
m_assembly.appendVerbatim(move(_data), _arguments, _returnVariables);
m_assembly.appendVerbatim(std::move(_data), _arguments, _returnVariables);
}
void EthAssemblyAdapter::appendJump(int _stackDiffAfter, JumpType _jumpType)
@@ -61,7 +61,7 @@ vector<StackTooDeepError> OptimizedEVMCodeTransform::run(
optimizedCodeTransform(*dfg->entry);
for (Scope::Function const* function: dfg->functions)
optimizedCodeTransform(dfg->functionInfo.at(function));
return move(optimizedCodeTransform.m_stackErrors);
return std::move(optimizedCodeTransform.m_stackErrors);
}
void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call)
@@ -459,7 +459,7 @@ void OptimizedEVMCodeTransform::operator()(CFG::BasicBlock const& _block)
{
// Restore the stack afterwards for the non-zero case below.
ScopeGuard stackRestore([storedStack = m_stack, this]() {
m_stack = move(storedStack);
m_stack = std::move(storedStack);
m_assembly.setStackHeight(static_cast<int>(m_stack.size()));
});
+6 -6
View File
@@ -65,7 +65,7 @@ map<YulString, vector<StackLayoutGenerator::StackTooDeep>> StackLayoutGenerator:
stackTooDeepErrors[YulString{}] = reportStackTooDeep(_cfg, YulString{});
for (auto const& function: _cfg.functions)
if (auto errors = reportStackTooDeep(_cfg, function->name); !errors.empty())
stackTooDeepErrors[function->name] = move(errors);
stackTooDeepErrors[function->name] = std::move(errors);
return stackTooDeepErrors;
}
@@ -324,8 +324,8 @@ Stack StackLayoutGenerator::propagateStackThroughBlock(Stack _exitStack, CFG::Ba
Stack newStack = propagateStackThroughOperation(stack, operation, _aggressiveStackCompression);
if (!_aggressiveStackCompression && !findStackTooDeep(newStack, stack).empty())
// If we had stack errors, run again with aggressive stack compression.
return propagateStackThroughBlock(move(_exitStack), _block, true);
stack = move(newStack);
return propagateStackThroughBlock(std::move(_exitStack), _block, true);
stack = std::move(newStack);
}
return stack;
@@ -715,13 +715,13 @@ void StackLayoutGenerator::fillInJunk(CFG::BasicBlock const& _block)
util::BreadthFirstSearch<CFG::BasicBlock const*> breadthFirstSearch{{_entry}};
breadthFirstSearch.run([&](CFG::BasicBlock const* _block, auto _addChild) {
auto& blockInfo = m_layout.blockInfos.at(_block);
blockInfo.entryLayout = Stack{_numJunk, JunkSlot{}} + move(blockInfo.entryLayout);
blockInfo.entryLayout = Stack{_numJunk, JunkSlot{}} + std::move(blockInfo.entryLayout);
for (auto const& operation: _block->operations)
{
auto& operationEntryLayout = m_layout.operationEntryLayout.at(&operation);
operationEntryLayout = Stack{_numJunk, JunkSlot{}} + move(operationEntryLayout);
operationEntryLayout = Stack{_numJunk, JunkSlot{}} + std::move(operationEntryLayout);
}
blockInfo.exitLayout = Stack{_numJunk, JunkSlot{}} + move(blockInfo.exitLayout);
blockInfo.exitLayout = Stack{_numJunk, JunkSlot{}} + std::move(blockInfo.exitLayout);
std::visit(util::GenericVisitor{
[&](CFG::BasicBlock::MainExit const&) {},
+18 -18
View File
@@ -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>();
+4 -4
View File
@@ -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;
}
+11 -11
View File
@@ -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&)
+1 -1
View File
@@ -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);
+1 -1
View File
@@ -64,7 +64,7 @@ private:
Dialect const& _dialect,
std::map<YulString, ControlFlowSideEffects> _sideEffects
):
m_dialect(_dialect), m_functionSideEffects(move(_sideEffects))
m_dialect(_dialect), m_functionSideEffects(std::move(_sideEffects))
{}
Dialect const& m_dialect;
std::map<YulString, ControlFlowSideEffects> m_functionSideEffects;
+1 -1
View File
@@ -63,7 +63,7 @@ private:
DeadCodeEliminator(
Dialect const& _dialect,
std::map<YulString, ControlFlowSideEffects> _sideEffects
): m_dialect(_dialect), m_functionSideEffects(move(_sideEffects)) {}
): m_dialect(_dialect), m_functionSideEffects(std::move(_sideEffects)) {}
Dialect const& m_dialect;
std::map<YulString, ControlFlowSideEffects> m_functionSideEffects;
+1 -1
View File
@@ -40,7 +40,7 @@ void ForLoopInitRewriter::operator()(Block& _block)
(*this)(forLoop.post);
vector<Statement> rewrite;
swap(rewrite, forLoop.pre.statements);
rewrite.emplace_back(move(forLoop));
rewrite.emplace_back(std::move(forLoop));
return { std::move(rewrite) };
}
else
+6 -6
View File
@@ -65,7 +65,7 @@ void FunctionSpecializer::operator()(FunctionCall& _f)
if (ranges::any_of(arguments, [](auto& _a) { return _a.has_value(); }))
{
YulString oldName = move(_f.functionName.name);
YulString oldName = std::move(_f.functionName.name);
auto newName = m_nameDispenser.newName(oldName);
m_oldToNewMap[oldName].emplace_back(make_pair(newName, arguments));
@@ -106,12 +106,12 @@ FunctionDefinition FunctionSpecializer::specialize(
VariableDeclaration{
_f.debugData,
vector<TypedName>{newFunction.parameters[index]},
make_unique<Expression>(move(*argument))
make_unique<Expression>(std::move(*argument))
}
);
newFunction.body.statements =
move(missingVariableDeclarations) + move(newFunction.body.statements);
std::move(missingVariableDeclarations) + std::move(newFunction.body.statements);
// Only take those indices that cannot be specialized, i.e., whose value is `nullopt`.
newFunction.parameters =
@@ -120,7 +120,7 @@ FunctionDefinition FunctionSpecializer::specialize(
applyMap(_arguments, [&](auto const& _v) { return !_v; })
);
newFunction.name = move(_newName);
newFunction.name = std::move(_newName);
return newFunction;
}
@@ -146,10 +146,10 @@ void FunctionSpecializer::run(OptimiserStepContext& _context, Block& _ast)
f.m_oldToNewMap.at(functionDefinition.name),
[&](auto& _p) -> Statement
{
return f.specialize(functionDefinition, move(_p.first), move(_p.second));
return f.specialize(functionDefinition, std::move(_p.first), std::move(_p.second));
}
);
return move(out) + make_vector<Statement>(move(functionDefinition));
return std::move(out) + make_vector<Statement>(std::move(functionDefinition));
}
}
+1 -1
View File
@@ -89,7 +89,7 @@ optional<u256> KnowledgeBase::valueIfKnownConstant(YulString _a)
Expression KnowledgeBase::simplify(Expression _expression)
{
m_counter = 0;
return simplifyRecursively(move(_expression));
return simplifyRecursively(std::move(_expression));
}
Expression KnowledgeBase::simplifyRecursively(Expression _expression)
+1 -1
View File
@@ -37,7 +37,7 @@ using namespace solidity::util;
NameDispenser::NameDispenser(Dialect const& _dialect, Block const& _ast, set<YulString> _reservedNames):
NameDispenser(_dialect, NameCollector(_ast).names() + _reservedNames)
{
m_reservedNames = move(_reservedNames);
m_reservedNames = std::move(_reservedNames);
}
NameDispenser::NameDispenser(Dialect const& _dialect, set<YulString> _usedNames):
+1 -1
View File
@@ -111,7 +111,7 @@ void NameSimplifier::findSimplification(YulString const& _name)
{
YulString newName{name};
m_context.dispenser.markUsed(newName);
m_translations[_name] = move(newName);
m_translations[_name] = std::move(newName);
}
}
@@ -71,7 +71,7 @@ void ReasoningBasedSimplifier::operator()(If& _if)
{
Literal trueCondition = m_dialect.trueLiteral();
trueCondition.debugData = debugDataOf(*_if.condition);
_if.condition = make_unique<yul::Expression>(move(trueCondition));
_if.condition = make_unique<yul::Expression>(std::move(trueCondition));
}
else
{
@@ -83,7 +83,7 @@ void ReasoningBasedSimplifier::operator()(If& _if)
{
Literal falseCondition = m_dialect.zeroLiteralForType(m_dialect.boolType);
falseCondition.debugData = debugDataOf(*_if.condition);
_if.condition = make_unique<yul::Expression>(move(falseCondition));
_if.condition = make_unique<yul::Expression>(std::move(falseCondition));
_if.body = yul::Block{};
// Nothing left to be done.
return;
+1 -1
View File
@@ -176,7 +176,7 @@ void eliminateVariables(
varsToEliminate += chooseVarsToEliminate(candidates[functionName], static_cast<size_t>(numVariables));
}
Rematerialiser::run(_dialect, _ast, move(varsToEliminate));
Rematerialiser::run(_dialect, _ast, std::move(varsToEliminate));
// Do not remove functions.
set<YulString> allFunctions = NameCollector{_ast, NameCollector::OnlyFunctions}.names();
UnusedPruner::runUntilStabilised(_dialect, _ast, _allowMSizeOptimization, nullptr, allFunctions);
+16 -16
View File
@@ -50,7 +50,7 @@ vector<Statement> generateMemoryStore(
Identifier{_debugData, memoryStoreFunction->name},
{
Literal{_debugData, LiteralKind::Number, _mpos, {}},
move(_value)
std::move(_value)
}
}});
return result;
@@ -95,7 +95,7 @@ void StackToMemoryMover::run(
)
);
stackToMemoryMover(_block);
_block.statements += move(stackToMemoryMover.m_newFunctionDefinitions);
_block.statements += std::move(stackToMemoryMover.m_newFunctionDefinitions);
}
StackToMemoryMover::StackToMemoryMover(
@@ -106,7 +106,7 @@ StackToMemoryMover::StackToMemoryMover(
m_context(_context),
m_memoryOffsetTracker(_memoryOffsetTracker),
m_nameDispenser(_context.dispenser),
m_functionReturnVariables(move(_functionReturnVariables))
m_functionReturnVariables(std::move(_functionReturnVariables))
{
auto const* evmDialect = dynamic_cast<EVMDialect const*>(&_context.dialect);
yulAssert(
@@ -156,7 +156,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition)
newFunctionName,
stackParameters,
{},
move(_functionDefinition.body)
std::move(_functionDefinition.body)
});
// Generate new names for the arguments to maintain disambiguation.
std::map<YulString, YulString> newArgumentNames;
@@ -165,7 +165,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition)
for (auto& parameter: _functionDefinition.parameters)
parameter.name = util::valueOrDefault(newArgumentNames, parameter.name, parameter.name);
// Replace original function by a call to the new function and an assignment to the return variable from memory.
_functionDefinition.body = Block{_functionDefinition.debugData, move(memoryVariableInits)};
_functionDefinition.body = Block{_functionDefinition.debugData, std::move(memoryVariableInits)};
_functionDefinition.body.statements.emplace_back(ExpressionStatement{
_functionDefinition.debugData,
FunctionCall{
@@ -189,7 +189,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition)
}
if (!memoryVariableInits.empty())
_functionDefinition.body.statements = move(memoryVariableInits) + move(_functionDefinition.body.statements);
_functionDefinition.body.statements = std::move(memoryVariableInits) + std::move(_functionDefinition.body.statements);
_functionDefinition.returnVariables = _functionDefinition.returnVariables | ranges::views::filter(
not_fn(m_memoryOffsetTracker)
@@ -214,7 +214,7 @@ void StackToMemoryMover::operator()(Block& _block)
m_context.dialect,
debugData,
*offset,
_stmt.value ? *move(_stmt.value) : Literal{debugData, LiteralKind::Number, "0"_yulstring, {}}
_stmt.value ? *std::move(_stmt.value) : Literal{debugData, LiteralKind::Number, "0"_yulstring, {}}
);
else
return {};
@@ -245,7 +245,7 @@ void StackToMemoryMover::operator()(Block& _block)
vector<Statement> memoryAssignments;
vector<Statement> variableAssignments;
VariableDeclaration tempDecl{debugData, {}, move(_stmt.value)};
VariableDeclaration tempDecl{debugData, {}, std::move(_stmt.value)};
yulAssert(rhsMemorySlots.size() == _lhsVars.size(), "");
for (auto&& [lhsVar, rhsSlot]: ranges::views::zip(_lhsVars, rhsMemorySlots))
@@ -265,26 +265,26 @@ void StackToMemoryMover::operator()(Block& _block)
m_context.dialect,
_stmt.debugData,
*offset,
move(*rhs)
std::move(*rhs)
);
else
variableAssignments.emplace_back(StatementType{
debugData,
{ move(lhsVar) },
move(rhs)
{ std::move(lhsVar) },
std::move(rhs)
});
}
vector<Statement> result;
if (tempDecl.variables.empty())
result.emplace_back(ExpressionStatement{debugData, *move(tempDecl.value)});
result.emplace_back(ExpressionStatement{debugData, *std::move(tempDecl.value)});
else
result.emplace_back(move(tempDecl));
result.emplace_back(std::move(tempDecl));
reverse(memoryAssignments.begin(), memoryAssignments.end());
result += move(memoryAssignments);
result += std::move(memoryAssignments);
reverse(variableAssignments.begin(), variableAssignments.end());
result += move(variableAssignments);
return OptionalStatements{move(result)};
result += std::move(variableAssignments);
return OptionalStatements{std::move(result)};
};
util::iterateReplacing(
@@ -118,7 +118,7 @@ void UnusedFunctionParameterPruner::run(OptimiserStepContext& _context, Block& _
originalFunction.returnVariables =
filter(originalFunction.returnVariables, used.second);
return make_vector<Statement>(move(originalFunction), move(linkingFunction));
return make_vector<Statement>(std::move(originalFunction), std::move(linkingFunction));
}
}
+14 -14
View File
@@ -40,7 +40,7 @@ void UnusedStoreBase::operator()(If const& _if)
TrackedStores skipBranch{m_stores};
(*this)(_if.body);
merge(m_stores, move(skipBranch));
merge(m_stores, std::move(skipBranch));
}
void UnusedStoreBase::operator()(Switch const& _switch)
@@ -56,17 +56,17 @@ void UnusedStoreBase::operator()(Switch const& _switch)
if (!c.value)
hasDefault = true;
(*this)(c.body);
branches.emplace_back(move(m_stores));
branches.emplace_back(std::move(m_stores));
m_stores = preState;
}
if (hasDefault)
{
m_stores = move(branches.back());
m_stores = std::move(branches.back());
branches.pop_back();
}
for (auto& branch: branches)
merge(m_stores, move(branch));
merge(m_stores, std::move(branch));
}
void UnusedStoreBase::operator()(FunctionDefinition const& _functionDefinition)
@@ -97,7 +97,7 @@ void UnusedStoreBase::operator()(ForLoop const& _forLoop)
TrackedStores zeroRuns{m_stores};
(*this)(_forLoop.body);
merge(m_stores, move(m_forLoopInfo.pendingContinueStmts));
merge(m_stores, std::move(m_forLoopInfo.pendingContinueStmts));
m_forLoopInfo.pendingContinueStmts = {};
(*this)(_forLoop.post);
@@ -110,50 +110,50 @@ void UnusedStoreBase::operator()(ForLoop const& _forLoop)
(*this)(_forLoop.body);
merge(m_stores, move(m_forLoopInfo.pendingContinueStmts));
merge(m_stores, std::move(m_forLoopInfo.pendingContinueStmts));
m_forLoopInfo.pendingContinueStmts.clear();
(*this)(_forLoop.post);
visit(*_forLoop.condition);
// Order of merging does not matter because "max" is commutative and associative.
merge(m_stores, move(oneRun));
merge(m_stores, std::move(oneRun));
}
else
// Shortcut to avoid horrible runtime.
shortcutNestedLoop(zeroRuns);
// Order of merging does not matter because "max" is commutative and associative.
merge(m_stores, move(zeroRuns));
merge(m_stores, move(m_forLoopInfo.pendingBreakStmts));
merge(m_stores, std::move(zeroRuns));
merge(m_stores, std::move(m_forLoopInfo.pendingBreakStmts));
m_forLoopInfo.pendingBreakStmts.clear();
}
void UnusedStoreBase::operator()(Break const&)
{
m_forLoopInfo.pendingBreakStmts.emplace_back(move(m_stores));
m_forLoopInfo.pendingBreakStmts.emplace_back(std::move(m_stores));
m_stores.clear();
}
void UnusedStoreBase::operator()(Continue const&)
{
m_forLoopInfo.pendingContinueStmts.emplace_back(move(m_stores));
m_forLoopInfo.pendingContinueStmts.emplace_back(std::move(m_stores));
m_stores.clear();
}
void UnusedStoreBase::merge(TrackedStores& _target, TrackedStores&& _other)
{
util::joinMap(_target, move(_other), [](
util::joinMap(_target, std::move(_other), [](
map<Statement const*, State>& _assignmentHere,
map<Statement const*, State>&& _assignmentThere
)
{
return util::joinMap(_assignmentHere, move(_assignmentThere), State::join);
return util::joinMap(_assignmentHere, std::move(_assignmentThere), State::join);
});
}
void UnusedStoreBase::merge(TrackedStores& _target, vector<TrackedStores>&& _source)
{
for (TrackedStores& ts: _source)
merge(_target, move(ts));
merge(_target, std::move(ts));
_source.clear();
}
+1 -1
View File
@@ -186,7 +186,7 @@ void UnusedStoreEliminator::visit(Statement const& _statement)
m_stores[YulString{}].insert({&_statement, initialState});
vector<Operation> operations = operationsFromFunctionCall(*funCall);
yulAssert(operations.size() == 1, "");
m_storeOperations[&_statement] = move(operations.front());
m_storeOperations[&_statement] = std::move(operations.front());
}
}