diff options
author | Artur Ryt <artur.ryt@gmail.com> | 2019-02-07 21:39:05 (GMT) |
---|---|---|
committer | Artur Ryt <artur.ryt@gmail.com> | 2019-02-07 21:39:05 (GMT) |
commit | 01b2d6ab7465e7f22fb821876027df86b0c8f363 (patch) | |
tree | 7ae313670e3655269ef7f9db6feabdc4bb2aaf25 /Source/cmGeneratorExpressionEvaluator.cxx | |
parent | 15bdbec0176e3aa620bb5bda3631819c5ca18eaf (diff) | |
download | CMake-01b2d6ab7465e7f22fb821876027df86b0c8f363.zip CMake-01b2d6ab7465e7f22fb821876027df86b0c8f363.tar.gz CMake-01b2d6ab7465e7f22fb821876027df86b0c8f363.tar.bz2 |
Modernize: Use ranged for-loops when possible
Replaced most manual `const_iterator`-based loops and some
reverse-iterator loops with range loops.
Fixes: #18858
Diffstat (limited to 'Source/cmGeneratorExpressionEvaluator.cxx')
-rw-r--r-- | Source/cmGeneratorExpressionEvaluator.cxx | 27 |
1 files changed, 8 insertions, 19 deletions
diff --git a/Source/cmGeneratorExpressionEvaluator.cxx b/Source/cmGeneratorExpressionEvaluator.cxx index f9a6d64..268de6f 100644 --- a/Source/cmGeneratorExpressionEvaluator.cxx +++ b/Source/cmGeneratorExpressionEvaluator.cxx @@ -34,20 +34,16 @@ std::string GeneratorExpressionContent::ProcessArbitraryContent( std::vector<cmGeneratorExpressionEvaluator*>>::const_iterator pend = this->ParamChildren.end(); for (; pit != pend; ++pit) { - std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = - pit->begin(); - const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = - pit->end(); - for (; it != end; ++it) { + for (cmGeneratorExpressionEvaluator* pExprEval : *pit) { if (node->RequiresLiteralInput()) { - if ((*it)->GetType() != cmGeneratorExpressionEvaluator::Text) { + if (pExprEval->GetType() != cmGeneratorExpressionEvaluator::Text) { reportError(context, this->GetOriginalExpression(), "$<" + identifier + "> expression requires literal input."); return std::string(); } } - result += (*it)->Evaluate(context, dagChecker); + result += pExprEval->Evaluate(context, dagChecker); if (context->HadError) { return std::string(); } @@ -70,12 +66,9 @@ std::string GeneratorExpressionContent::Evaluate( { std::string identifier; { - std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = - this->IdentifierChildren.begin(); - const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = - this->IdentifierChildren.end(); - for (; it != end; ++it) { - identifier += (*it)->Evaluate(context, dagChecker); + for (cmGeneratorExpressionEvaluator* pExprEval : + this->IdentifierChildren) { + identifier += pExprEval->Evaluate(context, dagChecker); if (context->HadError) { return std::string(); } @@ -138,12 +131,8 @@ std::string GeneratorExpressionContent::EvaluateParameters( return std::string(); } std::string parameter; - std::vector<cmGeneratorExpressionEvaluator*>::const_iterator it = - pit->begin(); - const std::vector<cmGeneratorExpressionEvaluator*>::const_iterator end = - pit->end(); - for (; it != end; ++it) { - parameter += (*it)->Evaluate(context, dagChecker); + for (cmGeneratorExpressionEvaluator* pExprEval : *pit) { + parameter += pExprEval->Evaluate(context, dagChecker); if (context->HadError) { return std::string(); } |