summaryrefslogtreecommitdiffstats
path: root/Source/cmSetPropertyCommand.cxx
diff options
context:
space:
mode:
authorPavel Solodovnikov <hellyeahdominate@gmail.com>2017-09-11 10:40:26 (GMT)
committerPavel Solodovnikov <hellyeahdominate@gmail.com>2017-09-12 13:22:47 (GMT)
commit7d5095796ab616cf9b709036387bb95ab9984141 (patch)
treec010e922adad95ef86ab4a3ac2a3abd63e9f33ef /Source/cmSetPropertyCommand.cxx
parent00975e926199eea21763470e2ab876246e36669a (diff)
downloadCMake-7d5095796ab616cf9b709036387bb95ab9984141.zip
CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.gz
CMake-7d5095796ab616cf9b709036387bb95ab9984141.tar.bz2
Meta: modernize old-fashioned loops to range-based `for`.
Changes done via `clang-tidy` with some manual fine-tuning for the variable naming and `auto` type deduction where appropriate.
Diffstat (limited to 'Source/cmSetPropertyCommand.cxx')
-rw-r--r--Source/cmSetPropertyCommand.cxx37
1 files changed, 16 insertions, 21 deletions
diff --git a/Source/cmSetPropertyCommand.cxx b/Source/cmSetPropertyCommand.cxx
index 338fcea..7efcc04 100644
--- a/Source/cmSetPropertyCommand.cxx
+++ b/Source/cmSetPropertyCommand.cxx
@@ -204,20 +204,19 @@ bool cmSetPropertyCommand::HandleDirectoryMode()
bool cmSetPropertyCommand::HandleTargetMode()
{
- for (std::set<std::string>::const_iterator ni = this->Names.begin();
- ni != this->Names.end(); ++ni) {
- if (this->Makefile->IsAlias(*ni)) {
+ for (std::string const& name : this->Names) {
+ if (this->Makefile->IsAlias(name)) {
this->SetError("can not be used on an ALIAS target.");
return false;
}
- if (cmTarget* target = this->Makefile->FindTargetToUse(*ni)) {
+ if (cmTarget* target = this->Makefile->FindTargetToUse(name)) {
// Handle the current target.
if (!this->HandleTarget(target)) {
return false;
}
} else {
std::ostringstream e;
- e << "could not find TARGET " << *ni
+ e << "could not find TARGET " << name
<< ". Perhaps it has not yet been created.";
this->SetError(e.str());
return false;
@@ -248,16 +247,15 @@ bool cmSetPropertyCommand::HandleTarget(cmTarget* target)
bool cmSetPropertyCommand::HandleSourceMode()
{
- for (std::set<std::string>::const_iterator ni = this->Names.begin();
- ni != this->Names.end(); ++ni) {
+ for (std::string const& name : this->Names) {
// Get the source file.
- if (cmSourceFile* sf = this->Makefile->GetOrCreateSource(*ni)) {
+ if (cmSourceFile* sf = this->Makefile->GetOrCreateSource(name)) {
if (!this->HandleSource(sf)) {
return false;
}
} else {
std::ostringstream e;
- e << "given SOURCE name that could not be found or created: " << *ni;
+ e << "given SOURCE name that could not be found or created: " << name;
this->SetError(e.str());
return false;
}
@@ -303,9 +301,8 @@ bool cmSetPropertyCommand::HandleTestMode()
if (!this->Names.empty()) {
std::ostringstream e;
e << "given TEST names that do not exist:\n";
- for (std::set<std::string>::const_iterator ni = this->Names.begin();
- ni != this->Names.end(); ++ni) {
- e << " " << *ni << "\n";
+ for (std::string const& name : this->Names) {
+ e << " " << name << "\n";
}
this->SetError(e.str());
return false;
@@ -359,19 +356,18 @@ bool cmSetPropertyCommand::HandleCacheMode()
return false;
}
- for (std::set<std::string>::const_iterator ni = this->Names.begin();
- ni != this->Names.end(); ++ni) {
+ for (std::string const& name : this->Names) {
// Get the source file.
cmMakefile* mf = this->GetMakefile();
cmake* cm = mf->GetCMakeInstance();
- const char* existingValue = cm->GetState()->GetCacheEntryValue(*ni);
+ const char* existingValue = cm->GetState()->GetCacheEntryValue(name);
if (existingValue) {
- if (!this->HandleCacheEntry(*ni)) {
+ if (!this->HandleCacheEntry(name)) {
return false;
}
} else {
std::ostringstream e;
- e << "could not find CACHE variable " << *ni
+ e << "could not find CACHE variable " << name
<< ". Perhaps it has not yet been created.";
this->SetError(e.str());
return false;
@@ -403,16 +399,15 @@ bool cmSetPropertyCommand::HandleInstallMode()
{
cmake* cm = this->Makefile->GetCMakeInstance();
- for (std::set<std::string>::const_iterator i = this->Names.begin();
- i != this->Names.end(); ++i) {
+ for (std::string const& name : this->Names) {
if (cmInstalledFile* file =
- cm->GetOrCreateInstalledFile(this->Makefile, *i)) {
+ cm->GetOrCreateInstalledFile(this->Makefile, name)) {
if (!this->HandleInstall(file)) {
return false;
}
} else {
std::ostringstream e;
- e << "given INSTALL name that could not be found or created: " << *i;
+ e << "given INSTALL name that could not be found or created: " << name;
this->SetError(e.str());
return false;
}