1
0
mirror of https://github.com/Kitware/CMake.git synced 2025-10-15 20:46:37 +08:00

GHS: Name range-based for-loop variable types explicitly

In general we avoid using `auto` except in cases of hard-to-name types
like iterators.
This commit is contained in:
Vitaly Stakhovsky
2020-03-09 12:00:00 -04:00
committed by Brad King
parent db17de2438
commit 9296cd0551

View File

@@ -235,7 +235,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
if (!flagsByLangI->second.empty()) { if (!flagsByLangI->second.empty()) {
std::vector<std::string> ghsCompFlags = std::vector<std::string> ghsCompFlags =
cmSystemTools::ParseArguments(flagsByLangI->second); cmSystemTools::ParseArguments(flagsByLangI->second);
for (auto& f : ghsCompFlags) { for (const std::string& f : ghsCompFlags) {
fout << " " << f << std::endl; fout << " " << f << std::endl;
} }
} }
@@ -290,14 +290,14 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
// write out link options // write out link options
std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags); std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags);
for (auto& l : lopts) { for (const std::string& l : lopts) {
fout << " " << l << std::endl; fout << " " << l << std::endl;
} }
// write out link search paths // write out link search paths
// must be quoted for paths that contain spaces // must be quoted for paths that contain spaces
std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath); std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath);
for (auto& l : lpath) { for (const std::string& l : lpath) {
fout << " -L\"" << l << "\"" << std::endl; fout << " -L\"" << l << "\"" << std::endl;
} }
@@ -307,7 +307,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
std::vector<std::string> llibs = std::vector<std::string> llibs =
cmSystemTools::ParseArguments(linkLibraries); cmSystemTools::ParseArguments(linkLibraries);
for (auto& l : llibs) { for (const std::string& l : llibs) {
if (l.compare(0, 2, "-l") == 0) { if (l.compare(0, 2, "-l") == 0) {
fout << " \"" << l << "\"" << std::endl; fout << " \"" << l << "\"" << std::endl;
} else { } else {
@@ -463,7 +463,7 @@ void cmGhsMultiTargetGenerator::WriteSourceProperty(
const char* prop = sf->GetProperty(propName); const char* prop = sf->GetProperty(propName);
if (prop) { if (prop) {
std::vector<std::string> list = cmExpandedList(prop); std::vector<std::string> list = cmExpandedList(prop);
for (auto& p : list) { for (const std::string& p : list) {
fout << " " << propFlag << p << std::endl; fout << " " << propFlag << p << std::endl;
} }
} }
@@ -483,7 +483,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
/* for each source file assign it to its group */ /* for each source file assign it to its group */
std::map<std::string, std::vector<cmSourceFile*>> groupFiles; std::map<std::string, std::vector<cmSourceFile*>> groupFiles;
std::set<std::string> groupNames; std::set<std::string> groupNames;
for (auto& sf : sources) { for (cmSourceFile* sf : sources) {
cmSourceGroup* sourceGroup = cmSourceGroup* sourceGroup =
this->Makefile->FindSourceGroup(sf->ResolveFullPath(), sourceGroups); this->Makefile->FindSourceGroup(sf->ResolveFullPath(), sourceGroups);
std::string gn = sourceGroup->GetFullName(); std::string gn = sourceGroup->GetFullName();
@@ -730,7 +730,7 @@ bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
} }
std::vector<cmSourceFile*> sources; std::vector<cmSourceFile*> sources;
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName); this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
for (auto& sf : sources) { for (const cmSourceFile* sf : sources) {
if ("int" == sf->GetExtension()) { if ("int" == sf->GetExtension()) {
return true; return true;
} }