Skip to content

Commit 1f6a299

Browse files
committed
Add a check for unqualified move
1 parent 99f15ff commit 1f6a299

File tree

4 files changed

+10
-8
lines changed

4 files changed

+10
-8
lines changed

libyul/backends/evm/EVMDialect.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ pair<YulString, BuiltinFunctionForEVM> createEVMFunction(
8383
};
8484

8585
YulString name = f.name;
86-
return {name, move(f)};
86+
return {name, std::move(f)};
8787
}
8888

8989
pair<YulString, BuiltinFunctionForEVM> createFunction(

scripts/check_style.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,8 @@ FORMATERROR=$(
5454
preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | grep -E -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
5555
# right-aligned reference pointer star (needs to exclude return and comments)
5656
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*"
57+
# unqualified move check, i.e. make sure that std::move() is used instead of move()
58+
preparedGrep "move\(.+\)" | grep -v "std::move" | grep -E "[^a-z]move"
5759
) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true
5860
)
5961

solc/CommandLineInterface.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -498,11 +498,11 @@ void CommandLineInterface::readInputFiles()
498498
if (m_options.input.mode == InputMode::StandardJson)
499499
{
500500
solAssert(!m_standardJsonInput.has_value(), "");
501-
m_standardJsonInput = move(fileContent);
501+
m_standardJsonInput = std::move(fileContent);
502502
}
503503
else
504504
{
505-
m_fileReader.addOrUpdateFile(infile, move(fileContent));
505+
m_fileReader.addOrUpdateFile(infile, std::move(fileContent));
506506
m_fileReader.allowDirectory(boost::filesystem::canonical(infile).remove_filename());
507507
}
508508
}
@@ -546,7 +546,7 @@ map<string, Json::Value> CommandLineInterface::parseAstFromInput()
546546
astAssert(ast["sources"][src].isMember(astKey), "astkey is not member");
547547
astAssert(ast["sources"][src][astKey]["nodeType"].asString() == "SourceUnit", "Top-level node should be a 'SourceUnit'");
548548
astAssert(sourceJsons.count(src) == 0, "All sources must have unique names");
549-
sourceJsons.emplace(src, move(ast["sources"][src][astKey]));
549+
sourceJsons.emplace(src, std::move(ast["sources"][src][astKey]));
550550
tmpSources[src] = util::jsonCompactPrint(ast);
551551
}
552552
}
@@ -643,7 +643,7 @@ void CommandLineInterface::processInput()
643643
solAssert(m_standardJsonInput.has_value(), "");
644644

645645
StandardCompiler compiler(m_fileReader.reader(), m_options.formatting.json);
646-
sout() << compiler.compile(move(m_standardJsonInput.value())) << endl;
646+
sout() << compiler.compile(std::move(m_standardJsonInput.value())) << endl;
647647
m_standardJsonInput.reset();
648648
break;
649649
}
@@ -977,7 +977,7 @@ void CommandLineInterface::link()
977977
while (!src.second.empty() && *prev(src.second.end()) == '\n')
978978
src.second.resize(src.second.size() - 1);
979979
}
980-
m_fileReader.setSourceUnits(move(sourceCodes));
980+
m_fileReader.setSourceUnits(std::move(sourceCodes));
981981
}
982982

983983
void CommandLineInterface::writeLinkedFiles()

solc/CommandLineParser.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ void CommandLineParser::parseInputPathsAndRemappings()
309309
m_options.input.allowedDirectories.insert(remappingDir.empty() ? "." : remappingDir);
310310
}
311311

312-
m_options.input.remappings.emplace_back(move(remapping.value()));
312+
m_options.input.remappings.emplace_back(std::move(remapping.value()));
313313
}
314314
else if (positionalArg == "-")
315315
m_options.input.addStdin = true;
@@ -1218,7 +1218,7 @@ void CommandLineParser::processArgs()
12181218
optional<ModelCheckerContracts> contracts = ModelCheckerContracts::fromString(contractsStr);
12191219
if (!contracts)
12201220
solThrow(CommandLineValidationError, "Invalid option for --" + g_strModelCheckerContracts + ": " + contractsStr);
1221-
m_options.modelChecker.settings.contracts = move(*contracts);
1221+
m_options.modelChecker.settings.contracts = std::move(*contracts);
12221222
}
12231223

12241224
if (m_args.count(g_strModelCheckerDivModNoSlacks))

0 commit comments

Comments
 (0)