diff options
author | Brad King <brad.king@kitware.com> | 2019-02-11 13:08:13 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2019-02-11 13:08:22 (GMT) |
commit | 4b37b4f1bb785a305ab742f37e5268d4cffef693 (patch) | |
tree | f9c6e15ac0925bfa8b15fce4c3475d3233a820f6 /Source/cmGhsMultiTargetGenerator.cxx | |
parent | 17de1eea806d7ba87a4ba6ad1073ced5f7ea9473 (diff) | |
parent | 01b2d6ab7465e7f22fb821876027df86b0c8f363 (diff) | |
download | CMake-4b37b4f1bb785a305ab742f37e5268d4cffef693.zip CMake-4b37b4f1bb785a305ab742f37e5268d4cffef693.tar.gz CMake-4b37b4f1bb785a305ab742f37e5268d4cffef693.tar.bz2 |
Merge topic 'modernize-for-loops'
01b2d6ab74 Modernize: Use ranged for-loops when possible
15bdbec017 cmAlgorithms: Make cmRange advance/retreat safe for rvalues
Acked-by: Kitware Robot <kwrobot@kitware.com>
Acked-by: Daniel Pfeifer <daniel@pfeifer-mail.de>
Merge-request: !2901
Diffstat (limited to 'Source/cmGhsMultiTargetGenerator.cxx')
-rw-r--r-- | Source/cmGhsMultiTargetGenerator.cxx | 37 |
1 files changed, 15 insertions, 22 deletions
diff --git a/Source/cmGhsMultiTargetGenerator.cxx b/Source/cmGhsMultiTargetGenerator.cxx index 5fe350c..08441a8 100644 --- a/Source/cmGhsMultiTargetGenerator.cxx +++ b/Source/cmGhsMultiTargetGenerator.cxx @@ -238,10 +238,8 @@ void cmGhsMultiTargetGenerator::WriteCompilerDefinitions( std::vector<std::string> compileDefinitions; this->GeneratorTarget->GetCompileDefinitions(compileDefinitions, config, language); - for (std::vector<std::string>::const_iterator cdI = - compileDefinitions.begin(); - cdI != compileDefinitions.end(); ++cdI) { - fout << " -D" << (*cdI) << std::endl; + for (std::string const& compileDefinition : compileDefinitions) { + fout << " -D" << compileDefinition << std::endl; } } @@ -253,9 +251,8 @@ void cmGhsMultiTargetGenerator::WriteIncludes(std::ostream& fout, this->LocalGenerator->GetIncludeDirectories(includes, this->GeneratorTarget, language, config); - for (std::vector<std::string>::const_iterator includes_i = includes.begin(); - includes_i != includes.end(); ++includes_i) { - fout << " -I\"" << *includes_i << "\"" << std::endl; + for (std::string const& include : includes) { + fout << " -I\"" << include << "\"" << std::endl; } } @@ -324,12 +321,9 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( std::ostream& fout, std::vector<cmCustomCommand> const& commandsSet, cmTarget::CustomCommandType const commandType) { - for (std::vector<cmCustomCommand>::const_iterator commandsSetI = - commandsSet.begin(); - commandsSetI != commandsSet.end(); ++commandsSetI) { - cmCustomCommandLines const& commands = commandsSetI->GetCommandLines(); - for (cmCustomCommandLines::const_iterator commandI = commands.begin(); - commandI != commands.end(); ++commandI) { + for (cmCustomCommand const& customCommand : commandsSet) { + cmCustomCommandLines const& commandLines = customCommand.GetCommandLines(); + for (cmCustomCommandLine const& command : commandLines) { switch (commandType) { case cmTarget::PRE_BUILD: fout << " :preexecShellSafe="; @@ -340,17 +334,16 @@ void cmGhsMultiTargetGenerator::WriteCustomCommandsHelper( default: assert("Only pre and post are supported"); } - cmCustomCommandLine const& command = *commandI; - for (cmCustomCommandLine::const_iterator commandLineI = command.begin(); - commandLineI != command.end(); ++commandLineI) { + + bool firstIteration = true; + for (std::string const& commandLine : command) { std::string subCommandE = - this->LocalGenerator->EscapeForShell(*commandLineI, true); - if (!command.empty()) { - fout << (command.begin() == commandLineI ? "'" : " "); - // Need to double escape backslashes - cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\"); - } + this->LocalGenerator->EscapeForShell(commandLine, true); + fout << (firstIteration ? "'" : " "); + // Need to double escape backslashes + cmSystemTools::ReplaceString(subCommandE, "\\", "\\\\"); fout << subCommandE; + firstIteration = false; } if (!command.empty()) { fout << "'" << std::endl; |