diff options
author | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-11 13:40:26 +0300 |
---|---|---|
committer | Pavel Solodovnikov <hellyeahdominate@gmail.com> | 2017-09-12 16:22:47 +0300 |
commit | 7d5095796ab616cf9b709036387bb95ab9984141 (patch) | |
tree | c010e922adad95ef86ab4a3ac2a3abd63e9f33ef /Source/cmSourceFile.cxx | |
parent | 00975e926199eea21763470e2ab876246e36669a (diff) | |
download | cmake-7d5095796ab616cf9b709036387bb95ab9984141.tar.gz |
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/cmSourceFile.cxx')
-rw-r--r-- | Source/cmSourceFile.cxx | 20 |
1 files changed, 8 insertions, 12 deletions
diff --git a/Source/cmSourceFile.cxx b/Source/cmSourceFile.cxx index 6d2b98d474..0964bea6b4 100644 --- a/Source/cmSourceFile.cxx +++ b/Source/cmSourceFile.cxx @@ -150,15 +150,13 @@ bool cmSourceFile::FindFullPath(std::string* error) if (this->TryFullPath(tryPath, "")) { return true; } - for (std::vector<std::string>::const_iterator ei = srcExts.begin(); - ei != srcExts.end(); ++ei) { - if (this->TryFullPath(tryPath, *ei)) { + for (std::string const& ext : srcExts) { + if (this->TryFullPath(tryPath, ext)) { return true; } } - for (std::vector<std::string>::const_iterator ei = hdrExts.begin(); - ei != hdrExts.end(); ++ei) { - if (this->TryFullPath(tryPath, *ei)) { + for (std::string const& ext : hdrExts) { + if (this->TryFullPath(tryPath, ext)) { return true; } } @@ -171,13 +169,11 @@ bool cmSourceFile::FindFullPath(std::string* error) } missing += this->Location.GetName(); e << "Cannot find source file:\n " << missing << "\nTried extensions"; - for (std::vector<std::string>::const_iterator ext = srcExts.begin(); - ext != srcExts.end(); ++ext) { - e << " ." << *ext; + for (std::string const& srcExt : srcExts) { + e << " ." << srcExt; } - for (std::vector<std::string>::const_iterator ext = hdrExts.begin(); - ext != hdrExts.end(); ++ext) { - e << " ." << *ext; + for (std::string const& ext : hdrExts) { + e << " ." << ext; } if (error) { *error = e.str(); |