mirror of
https://github.com/Kitware/CMake.git
synced 2026-01-06 05:40:54 -06:00
Merge topic 'loops-improve'
cbbca9ee2aConvert more loops to range-based for-loops9296cd0551GHS: Name range-based for-loop variable types explicitlydb17de2438GHS: Use cm::erase in place of loop Acked-by: Kitware Robot <kwrobot@kitware.com> Merge-request: !4446
This commit is contained in:
@@ -231,7 +231,7 @@ void cmGhsMultiTargetGenerator::WriteCompilerFlags(std::ostream& fout,
|
||||
if (!flagsByLangI->second.empty()) {
|
||||
std::vector<std::string> ghsCompFlags =
|
||||
cmSystemTools::ParseArguments(flagsByLangI->second);
|
||||
for (auto& f : ghsCompFlags) {
|
||||
for (const std::string& f : ghsCompFlags) {
|
||||
fout << " " << f << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -286,14 +286,14 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
|
||||
|
||||
// write out link options
|
||||
std::vector<std::string> lopts = cmSystemTools::ParseArguments(linkFlags);
|
||||
for (auto& l : lopts) {
|
||||
for (const std::string& l : lopts) {
|
||||
fout << " " << l << std::endl;
|
||||
}
|
||||
|
||||
// write out link search paths
|
||||
// must be quoted for paths that contain spaces
|
||||
std::vector<std::string> lpath = cmSystemTools::ParseArguments(linkPath);
|
||||
for (auto& l : lpath) {
|
||||
for (const std::string& l : lpath) {
|
||||
fout << " -L\"" << l << "\"" << std::endl;
|
||||
}
|
||||
|
||||
@@ -303,7 +303,7 @@ void cmGhsMultiTargetGenerator::WriteTargetLinkLine(std::ostream& fout,
|
||||
|
||||
std::vector<std::string> llibs =
|
||||
cmSystemTools::ParseArguments(linkLibraries);
|
||||
for (auto& l : llibs) {
|
||||
for (const std::string& l : llibs) {
|
||||
if (l.compare(0, 2, "-l") == 0) {
|
||||
fout << " \"" << l << "\"" << std::endl;
|
||||
} else {
|
||||
@@ -459,7 +459,7 @@ void cmGhsMultiTargetGenerator::WriteSourceProperty(
|
||||
const char* prop = sf->GetProperty(propName);
|
||||
if (prop) {
|
||||
std::vector<std::string> list = cmExpandedList(prop);
|
||||
for (auto& p : list) {
|
||||
for (const std::string& p : list) {
|
||||
fout << " " << propFlag << p << std::endl;
|
||||
}
|
||||
}
|
||||
@@ -479,7 +479,7 @@ void cmGhsMultiTargetGenerator::WriteSources(std::ostream& fout_proj)
|
||||
/* for each source file assign it to its group */
|
||||
std::map<std::string, std::vector<cmSourceFile*>> groupFiles;
|
||||
std::set<std::string> groupNames;
|
||||
for (auto& sf : sources) {
|
||||
for (cmSourceFile* sf : sources) {
|
||||
cmSourceGroup* sourceGroup =
|
||||
this->Makefile->FindSourceGroup(sf->ResolveFullPath(), sourceGroups);
|
||||
std::string gn = sourceGroup->GetFullName();
|
||||
@@ -726,7 +726,7 @@ bool cmGhsMultiTargetGenerator::DetermineIfIntegrityApp()
|
||||
}
|
||||
std::vector<cmSourceFile*> sources;
|
||||
this->GeneratorTarget->GetSourceFiles(sources, this->ConfigName);
|
||||
for (auto& sf : sources) {
|
||||
for (const cmSourceFile* sf : sources) {
|
||||
if ("int" == sf->GetExtension()) {
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@
|
||||
#include <utility>
|
||||
|
||||
#include <cm/memory>
|
||||
#include <cm/string>
|
||||
|
||||
#include "cmAlgorithms.h"
|
||||
#include "cmDocumentationEntry.h"
|
||||
@@ -651,21 +652,16 @@ void cmGlobalGhsMultiGenerator::WriteHighLevelDirectives(
|
||||
char const* const customization =
|
||||
this->GetCMakeInstance()->GetCacheDefinition("GHS_CUSTOMIZATION");
|
||||
if (nullptr != customization && strlen(customization) > 0) {
|
||||
fout << "customization=" << this->TrimQuotes(customization) << std::endl;
|
||||
fout << "customization="
|
||||
<< cmGlobalGhsMultiGenerator::TrimQuotes(customization) << std::endl;
|
||||
this->GetCMakeInstance()->MarkCliAsUsed("GHS_CUSTOMIZATION");
|
||||
}
|
||||
}
|
||||
|
||||
std::string cmGlobalGhsMultiGenerator::TrimQuotes(std::string const& str)
|
||||
std::string cmGlobalGhsMultiGenerator::TrimQuotes(std::string str)
|
||||
{
|
||||
std::string result;
|
||||
result.reserve(str.size());
|
||||
for (const char* ch = str.c_str(); *ch != '\0'; ++ch) {
|
||||
if (*ch != '"') {
|
||||
result += *ch;
|
||||
}
|
||||
}
|
||||
return result;
|
||||
cm::erase(str, '"');
|
||||
return str;
|
||||
}
|
||||
|
||||
bool cmGlobalGhsMultiGenerator::TargetCompare::operator()(
|
||||
|
||||
@@ -111,7 +111,7 @@ private:
|
||||
std::vector<cmLocalGenerator*>& generators,
|
||||
std::string& all_target);
|
||||
|
||||
std::string TrimQuotes(std::string const& str);
|
||||
static std::string TrimQuotes(std::string str);
|
||||
|
||||
std::string OsDir;
|
||||
static const char* DEFAULT_BUILD_PROGRAM;
|
||||
|
||||
@@ -2914,11 +2914,11 @@ void cmLocalGenerator::JoinDefines(const std::set<std::string>& defines,
|
||||
// command line without any escapes. However we still have to
|
||||
// get the '$' and '#' characters through WMake as '$$' and
|
||||
// '$#'.
|
||||
for (const char* c = define.c_str(); *c; ++c) {
|
||||
if (*c == '$' || *c == '#') {
|
||||
for (char c : define) {
|
||||
if (c == '$' || c == '#') {
|
||||
def += '$';
|
||||
}
|
||||
def += *c;
|
||||
def += c;
|
||||
}
|
||||
} else {
|
||||
// Make the definition appear properly on the command line. Use
|
||||
|
||||
@@ -1510,10 +1510,9 @@ cmLocalVisualStudio7GeneratorFCInfo::cmLocalVisualStudio7GeneratorFCInfo(
|
||||
if (const char* deps = sf.GetProperty("OBJECT_DEPENDS")) {
|
||||
std::vector<std::string> depends = cmExpandedList(deps);
|
||||
const char* sep = "";
|
||||
for (std::vector<std::string>::iterator j = depends.begin();
|
||||
j != depends.end(); ++j) {
|
||||
for (const std::string& d : depends) {
|
||||
fc.AdditionalDeps += sep;
|
||||
fc.AdditionalDeps += lg->ConvertToXMLOutputPath(*j);
|
||||
fc.AdditionalDeps += lg->ConvertToXMLOutputPath(d);
|
||||
sep = ";";
|
||||
needfc = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user