mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add a check for unqualified move
This commit is contained in:
parent
99f15ff04e
commit
1f6a299062
@ -83,7 +83,7 @@ pair<YulString, BuiltinFunctionForEVM> createEVMFunction(
|
|||||||
};
|
};
|
||||||
|
|
||||||
YulString name = f.name;
|
YulString name = f.name;
|
||||||
return {name, move(f)};
|
return {name, std::move(f)};
|
||||||
}
|
}
|
||||||
|
|
||||||
pair<YulString, BuiltinFunctionForEVM> createFunction(
|
pair<YulString, BuiltinFunctionForEVM> createFunction(
|
||||||
|
@ -54,6 +54,8 @@ FORMATERROR=$(
|
|||||||
preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | grep -E -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
|
preparedGrep "[a-zA-Z0-9_]\s*[&][a-zA-Z_]" | grep -E -v "return [&]" # right-aligned reference ampersand (needs to exclude return)
|
||||||
# right-aligned reference pointer star (needs to exclude return and comments)
|
# right-aligned reference pointer star (needs to exclude return and comments)
|
||||||
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*"
|
preparedGrep "[a-zA-Z0-9_]\s*[*][a-zA-Z_]" | grep -E -v -e "return [*]" -e "^* [*]" -e "^*//.*"
|
||||||
|
# unqualified move check, i.e. make sure that std::move() is used instead of move()
|
||||||
|
preparedGrep "move\(.+\)" | grep -v "std::move" | grep -E "[^a-z]move"
|
||||||
) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true
|
) | grep -E -v -e "^[a-zA-Z\./]*:[0-9]*:\s*\/(\/|\*)" -e "^test/" || true
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -498,11 +498,11 @@ void CommandLineInterface::readInputFiles()
|
|||||||
if (m_options.input.mode == InputMode::StandardJson)
|
if (m_options.input.mode == InputMode::StandardJson)
|
||||||
{
|
{
|
||||||
solAssert(!m_standardJsonInput.has_value(), "");
|
solAssert(!m_standardJsonInput.has_value(), "");
|
||||||
m_standardJsonInput = move(fileContent);
|
m_standardJsonInput = std::move(fileContent);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
m_fileReader.addOrUpdateFile(infile, move(fileContent));
|
m_fileReader.addOrUpdateFile(infile, std::move(fileContent));
|
||||||
m_fileReader.allowDirectory(boost::filesystem::canonical(infile).remove_filename());
|
m_fileReader.allowDirectory(boost::filesystem::canonical(infile).remove_filename());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -546,7 +546,7 @@ map<string, Json::Value> CommandLineInterface::parseAstFromInput()
|
|||||||
astAssert(ast["sources"][src].isMember(astKey), "astkey is not member");
|
astAssert(ast["sources"][src].isMember(astKey), "astkey is not member");
|
||||||
astAssert(ast["sources"][src][astKey]["nodeType"].asString() == "SourceUnit", "Top-level node should be a 'SourceUnit'");
|
astAssert(ast["sources"][src][astKey]["nodeType"].asString() == "SourceUnit", "Top-level node should be a 'SourceUnit'");
|
||||||
astAssert(sourceJsons.count(src) == 0, "All sources must have unique names");
|
astAssert(sourceJsons.count(src) == 0, "All sources must have unique names");
|
||||||
sourceJsons.emplace(src, move(ast["sources"][src][astKey]));
|
sourceJsons.emplace(src, std::move(ast["sources"][src][astKey]));
|
||||||
tmpSources[src] = util::jsonCompactPrint(ast);
|
tmpSources[src] = util::jsonCompactPrint(ast);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -643,7 +643,7 @@ void CommandLineInterface::processInput()
|
|||||||
solAssert(m_standardJsonInput.has_value(), "");
|
solAssert(m_standardJsonInput.has_value(), "");
|
||||||
|
|
||||||
StandardCompiler compiler(m_fileReader.reader(), m_options.formatting.json);
|
StandardCompiler compiler(m_fileReader.reader(), m_options.formatting.json);
|
||||||
sout() << compiler.compile(move(m_standardJsonInput.value())) << endl;
|
sout() << compiler.compile(std::move(m_standardJsonInput.value())) << endl;
|
||||||
m_standardJsonInput.reset();
|
m_standardJsonInput.reset();
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -977,7 +977,7 @@ void CommandLineInterface::link()
|
|||||||
while (!src.second.empty() && *prev(src.second.end()) == '\n')
|
while (!src.second.empty() && *prev(src.second.end()) == '\n')
|
||||||
src.second.resize(src.second.size() - 1);
|
src.second.resize(src.second.size() - 1);
|
||||||
}
|
}
|
||||||
m_fileReader.setSourceUnits(move(sourceCodes));
|
m_fileReader.setSourceUnits(std::move(sourceCodes));
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandLineInterface::writeLinkedFiles()
|
void CommandLineInterface::writeLinkedFiles()
|
||||||
|
@ -309,7 +309,7 @@ void CommandLineParser::parseInputPathsAndRemappings()
|
|||||||
m_options.input.allowedDirectories.insert(remappingDir.empty() ? "." : remappingDir);
|
m_options.input.allowedDirectories.insert(remappingDir.empty() ? "." : remappingDir);
|
||||||
}
|
}
|
||||||
|
|
||||||
m_options.input.remappings.emplace_back(move(remapping.value()));
|
m_options.input.remappings.emplace_back(std::move(remapping.value()));
|
||||||
}
|
}
|
||||||
else if (positionalArg == "-")
|
else if (positionalArg == "-")
|
||||||
m_options.input.addStdin = true;
|
m_options.input.addStdin = true;
|
||||||
@ -1218,7 +1218,7 @@ void CommandLineParser::processArgs()
|
|||||||
optional<ModelCheckerContracts> contracts = ModelCheckerContracts::fromString(contractsStr);
|
optional<ModelCheckerContracts> contracts = ModelCheckerContracts::fromString(contractsStr);
|
||||||
if (!contracts)
|
if (!contracts)
|
||||||
solThrow(CommandLineValidationError, "Invalid option for --" + g_strModelCheckerContracts + ": " + contractsStr);
|
solThrow(CommandLineValidationError, "Invalid option for --" + g_strModelCheckerContracts + ": " + contractsStr);
|
||||||
m_options.modelChecker.settings.contracts = move(*contracts);
|
m_options.modelChecker.settings.contracts = std::move(*contracts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_args.count(g_strModelCheckerDivModNoSlacks))
|
if (m_args.count(g_strModelCheckerDivModNoSlacks))
|
||||||
|
Loading…
Reference in New Issue
Block a user