clang-tidy: fix modernize-use-auto
lints
This commit is contained in:
parent
64c0702f91
commit
c61ece5c40
@ -302,7 +302,7 @@ bool cmGlobalVisualStudio10Generator::ParseGeneratorToolset(
|
||||
std::string const& ts, cmMakefile* mf)
|
||||
{
|
||||
std::vector<std::string> const fields = cmTokenize(ts, ",");
|
||||
std::vector<std::string>::const_iterator fi = fields.begin();
|
||||
auto fi = fields.begin();
|
||||
if (fi == fields.end()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ void cmGlobalVisualStudio71Generator::WriteProject(std::ostream& fout,
|
||||
|
||||
fout << "EndProject\n";
|
||||
|
||||
UtilityDependsMap::iterator ui = this->UtilityDepends.find(t);
|
||||
auto ui = this->UtilityDepends.find(t);
|
||||
if (ui != this->UtilityDepends.end()) {
|
||||
const char* uname = ui->second.c_str();
|
||||
/* clang-format off */
|
||||
@ -218,8 +218,7 @@ void cmGlobalVisualStudio71Generator::WriteProjectConfigurations(
|
||||
}
|
||||
fout << "\t\t{" << guid << "}." << i << ".ActiveCfg = " << dstConfig << "|"
|
||||
<< platformName << std::endl;
|
||||
std::set<std::string>::const_iterator ci =
|
||||
configsPartOfDefaultBuild.find(i);
|
||||
auto ci = configsPartOfDefaultBuild.find(i);
|
||||
if (!(ci == configsPartOfDefaultBuild.end())) {
|
||||
fout << "\t\t{" << guid << "}." << i << ".Build.0 = " << dstConfig << "|"
|
||||
<< platformName << std::endl;
|
||||
|
@ -238,8 +238,7 @@ bool cmGlobalVisualStudio8Generator::AddCheckTarget()
|
||||
|
||||
// Sort the list of input files and remove duplicates.
|
||||
std::sort(listFiles.begin(), listFiles.end(), std::less<std::string>());
|
||||
std::vector<std::string>::iterator new_end =
|
||||
std::unique(listFiles.begin(), listFiles.end());
|
||||
auto new_end = std::unique(listFiles.begin(), listFiles.end());
|
||||
listFiles.erase(new_end, listFiles.end());
|
||||
|
||||
// Create a rule to re-run CMake.
|
||||
@ -325,8 +324,7 @@ void cmGlobalVisualStudio8Generator::WriteProjectConfigurations(
|
||||
<< (!platformMapping.empty() ? platformMapping
|
||||
: this->GetPlatformName())
|
||||
<< "\n";
|
||||
std::set<std::string>::const_iterator ci =
|
||||
configsPartOfDefaultBuild.find(i);
|
||||
auto ci = configsPartOfDefaultBuild.find(i);
|
||||
if (!(ci == configsPartOfDefaultBuild.end())) {
|
||||
fout << "\t\t{" << guid << "}." << i << "|" << this->GetPlatformName()
|
||||
<< ".Build.0 = " << dstConfig << "|"
|
||||
|
@ -606,7 +606,7 @@ bool cmGlobalVisualStudioVersionedGenerator::ParseGeneratorInstance(
|
||||
this->GeneratorInstanceVersion.clear();
|
||||
|
||||
std::vector<std::string> const fields = cmTokenize(is, ",");
|
||||
std::vector<std::string>::const_iterator fi = fields.begin();
|
||||
auto fi = fields.begin();
|
||||
if (fi == fields.end()) {
|
||||
return true;
|
||||
}
|
||||
|
@ -246,8 +246,7 @@ bool cmIDEOptions::HasFlag(std::string const& flag) const
|
||||
const char* cmIDEOptions::GetFlag(std::string const& flag) const
|
||||
{
|
||||
// This method works only for single-valued flags!
|
||||
std::map<std::string, FlagValue>::const_iterator i =
|
||||
this->FlagMap.find(flag);
|
||||
auto i = this->FlagMap.find(flag);
|
||||
if (i != this->FlagMap.cend() && i->second.size() == 1) {
|
||||
return i->second[0].c_str();
|
||||
}
|
||||
|
@ -179,8 +179,7 @@ void cmLocalVisualStudio7Generator::WriteStampFiles()
|
||||
|
||||
// Sort the list of input files and remove duplicates.
|
||||
std::sort(listFiles.begin(), listFiles.end(), std::less<std::string>());
|
||||
std::vector<std::string>::iterator new_end =
|
||||
std::unique(listFiles.begin(), listFiles.end());
|
||||
auto new_end = std::unique(listFiles.begin(), listFiles.end());
|
||||
listFiles.erase(new_end, listFiles.end());
|
||||
|
||||
for (const std::string& lf : listFiles) {
|
||||
@ -253,8 +252,7 @@ cmSourceFile* cmLocalVisualStudio7Generator::CreateVCProjBuildRule()
|
||||
|
||||
// Sort the list of input files and remove duplicates.
|
||||
std::sort(listFiles.begin(), listFiles.end(), std::less<std::string>());
|
||||
std::vector<std::string>::iterator new_end =
|
||||
std::unique(listFiles.begin(), listFiles.end());
|
||||
auto new_end = std::unique(listFiles.begin(), listFiles.end());
|
||||
listFiles.erase(new_end, listFiles.end());
|
||||
|
||||
std::string argS = cmStrCat("-S", this->GetSourceDirectory());
|
||||
@ -1633,8 +1631,7 @@ std::string cmLocalVisualStudio7Generator::ComputeLongestObjectDirectory(
|
||||
|
||||
// Compute the maximum length configuration name.
|
||||
std::string config_max;
|
||||
for (std::vector<std::string>::iterator i = configs.begin();
|
||||
i != configs.end(); ++i) {
|
||||
for (auto i = configs.begin(); i != configs.end(); ++i) {
|
||||
if (i->size() > config_max.size()) {
|
||||
config_max = *i;
|
||||
}
|
||||
@ -1690,8 +1687,7 @@ bool cmLocalVisualStudio7Generator::WriteGroup(
|
||||
target->GetType() == cmStateEnums::GLOBAL_TARGET ||
|
||||
target->GetType() == cmStateEnums::INTERFACE_LIBRARY) {
|
||||
// Look up the source kind and configs.
|
||||
std::map<cmSourceFile const*, size_t>::const_iterator map_it =
|
||||
sources.Index.find(sf);
|
||||
auto map_it = sources.Index.find(sf);
|
||||
// The map entry must exist because we populated it earlier.
|
||||
assert(map_it != sources.Index.end());
|
||||
cmGeneratorTarget::AllConfigSource const& acs =
|
||||
|
@ -115,8 +115,7 @@ bool cmVisualStudioGeneratorOptions::IsDebug() const
|
||||
if (this->CurrentTool != CSharpCompiler) {
|
||||
return this->FlagMap.find("DebugInformationFormat") != this->FlagMap.end();
|
||||
}
|
||||
std::map<std::string, FlagValue>::const_iterator i =
|
||||
this->FlagMap.find("DebugType");
|
||||
auto i = this->FlagMap.find("DebugType");
|
||||
if (i != this->FlagMap.end()) {
|
||||
if (i->second.size() == 1) {
|
||||
return i->second[0] != "none";
|
||||
@ -267,8 +266,7 @@ void cmVisualStudioGeneratorOptions::ParseFinish()
|
||||
}
|
||||
|
||||
if (this->CurrentTool == CudaCompiler) {
|
||||
std::map<std::string, FlagValue>::iterator i =
|
||||
this->FlagMap.find("CudaRuntime");
|
||||
auto i = this->FlagMap.find("CudaRuntime");
|
||||
if (i != this->FlagMap.end() && i->second.size() == 1) {
|
||||
std::string& cudaRuntime = i->second[0];
|
||||
if (cudaRuntime == "static") {
|
||||
@ -285,7 +283,7 @@ void cmVisualStudioGeneratorOptions::ParseFinish()
|
||||
void cmVisualStudioGeneratorOptions::PrependInheritedString(
|
||||
std::string const& key)
|
||||
{
|
||||
std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(key);
|
||||
auto i = this->FlagMap.find(key);
|
||||
if (i == this->FlagMap.end() || i->second.size() != 1) {
|
||||
return;
|
||||
}
|
||||
@ -295,7 +293,7 @@ void cmVisualStudioGeneratorOptions::PrependInheritedString(
|
||||
|
||||
void cmVisualStudioGeneratorOptions::Reparse(std::string const& key)
|
||||
{
|
||||
std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(key);
|
||||
auto i = this->FlagMap.find(key);
|
||||
if (i == this->FlagMap.end() || i->second.size() != 1) {
|
||||
return;
|
||||
}
|
||||
@ -339,7 +337,7 @@ cmIDEOptions::FlagValue cmVisualStudioGeneratorOptions::TakeFlag(
|
||||
std::string const& key)
|
||||
{
|
||||
FlagValue value;
|
||||
std::map<std::string, FlagValue>::iterator i = this->FlagMap.find(key);
|
||||
auto i = this->FlagMap.find(key);
|
||||
if (i != this->FlagMap.end()) {
|
||||
value = i->second;
|
||||
this->FlagMap.erase(i);
|
||||
@ -373,8 +371,7 @@ void cmVisualStudioGeneratorOptions::OutputPreprocessorDefinitions(
|
||||
if (this->Version != cmGlobalVisualStudioGenerator::VSVersion::VS9) {
|
||||
oss << "%(" << tag << ")";
|
||||
}
|
||||
std::vector<std::string>::const_iterator de =
|
||||
cmRemoveDuplicates(this->Defines);
|
||||
auto de = cmRemoveDuplicates(this->Defines);
|
||||
for (std::string const& di : cmMakeRange(this->Defines.cbegin(), de)) {
|
||||
// Escape the definition for the compiler.
|
||||
std::string define;
|
||||
|
@ -23,7 +23,7 @@ std::string cmSlnProjectEntry::GetProjectConfiguration(
|
||||
const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByGUID(
|
||||
const std::string& projectGUID) const
|
||||
{
|
||||
ProjectStorage::const_iterator it(ProjectsByGUID.find(projectGUID));
|
||||
auto it(ProjectsByGUID.find(projectGUID));
|
||||
if (it != ProjectsByGUID.end())
|
||||
return it->second;
|
||||
else
|
||||
@ -33,7 +33,7 @@ const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByGUID(
|
||||
const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByName(
|
||||
const std::string& projectName) const
|
||||
{
|
||||
ProjectStringIndex::const_iterator it(ProjectNameIndex.find(projectName));
|
||||
auto it(ProjectNameIndex.find(projectName));
|
||||
if (it != ProjectNameIndex.end())
|
||||
return it->second->second;
|
||||
else
|
||||
@ -42,8 +42,7 @@ const cm::optional<cmSlnProjectEntry> cmSlnData::GetProjectByName(
|
||||
|
||||
std::vector<cmSlnProjectEntry> cmSlnData::GetProjects() const
|
||||
{
|
||||
ProjectStringIndex::const_iterator it(this->ProjectNameIndex.begin()),
|
||||
itEnd(this->ProjectNameIndex.end());
|
||||
auto it(this->ProjectNameIndex.begin()), itEnd(this->ProjectNameIndex.end());
|
||||
std::vector<cmSlnProjectEntry> result;
|
||||
for (; it != itEnd; ++it)
|
||||
result.push_back(it->second->second);
|
||||
@ -54,7 +53,7 @@ cmSlnProjectEntry* cmSlnData::AddProject(
|
||||
const std::string& projectGUID, const std::string& projectName,
|
||||
const std::string& projectRelativePath)
|
||||
{
|
||||
ProjectStorage::iterator it(ProjectsByGUID.find(projectGUID));
|
||||
auto it(ProjectsByGUID.find(projectGUID));
|
||||
if (it != ProjectsByGUID.end())
|
||||
return nullptr;
|
||||
it = ProjectsByGUID
|
||||
|
@ -44,8 +44,7 @@ std::string cmVisualStudioWCEPlatformParser::GetOSVersion() const
|
||||
|
||||
const char* cmVisualStudioWCEPlatformParser::GetArchitectureFamily() const
|
||||
{
|
||||
std::map<std::string, std::string>::const_iterator it =
|
||||
this->Macros.find("ARCHFAM");
|
||||
auto it = this->Macros.find("ARCHFAM");
|
||||
if (it != this->Macros.end()) {
|
||||
return it->second.c_str();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user