summaryrefslogtreecommitdiffstats
path: root/Source/cmAddCustomCommandCommand.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/cmAddCustomCommandCommand.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/cmAddCustomCommandCommand.cxx')
-rw-r--r--Source/cmAddCustomCommandCommand.cxx15
1 files changed, 6 insertions, 9 deletions
diff --git a/Source/cmAddCustomCommandCommand.cxx b/Source/cmAddCustomCommandCommand.cxx
index bd054e8..7fed52d 100644
--- a/Source/cmAddCustomCommandCommand.cxx
+++ b/Source/cmAddCustomCommandCommand.cxx
@@ -68,9 +68,7 @@ bool cmAddCustomCommandCommand::InitialPass(
tdoing doing = doing_nothing;
- for (unsigned int j = 0; j < args.size(); ++j) {
- std::string const& copy = args[j];
-
+ for (std::string const& copy : args) {
if (copy == "SOURCE") {
doing = doing_source;
} else if (copy == "COMMAND") {
@@ -355,12 +353,11 @@ bool cmAddCustomCommandCommand::InitialPass(
bool cmAddCustomCommandCommand::CheckOutputs(
const std::vector<std::string>& outputs)
{
- for (std::vector<std::string>::const_iterator o = outputs.begin();
- o != outputs.end(); ++o) {
+ for (std::string const& o : outputs) {
// Make sure the file will not be generated into the source
// directory during an out of source build.
- if (!this->Makefile->CanIWriteThisFile(o->c_str())) {
- std::string e = "attempted to have a file \"" + *o +
+ if (!this->Makefile->CanIWriteThisFile(o.c_str())) {
+ std::string e = "attempted to have a file \"" + o +
"\" in a source directory as an output of custom command.";
this->SetError(e);
cmSystemTools::SetFatalErrorOccured();
@@ -368,10 +365,10 @@ bool cmAddCustomCommandCommand::CheckOutputs(
}
// Make sure the output file name has no invalid characters.
- std::string::size_type pos = o->find_first_of("#<>");
+ std::string::size_type pos = o.find_first_of("#<>");
if (pos != std::string::npos) {
std::ostringstream msg;
- msg << "called with OUTPUT containing a \"" << (*o)[pos]
+ msg << "called with OUTPUT containing a \"" << o[pos]
<< "\". This character is not allowed.";
this->SetError(msg.str());
return false;