diff options
author | Brad King <brad.king@kitware.com> | 2017-09-20 17:18:25 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2017-09-20 17:18:28 (GMT) |
commit | be475daa8f89f93691912abf082bfd4f59cf7253 (patch) | |
tree | 9c6a60b50d3208429490e09558a8b7a7260dbc64 /Source | |
parent | cb36e91eff65127f9b99fa02c7ff6b9a0a2d55b8 (diff) | |
parent | 706b37b7f597f449cc3d02bd50123c4e7277eadb (diff) | |
download | CMake-be475daa8f89f93691912abf082bfd4f59cf7253.zip CMake-be475daa8f89f93691912abf082bfd4f59cf7253.tar.gz CMake-be475daa8f89f93691912abf082bfd4f59cf7253.tar.bz2 |
Merge topic 'tidy-modernize-loop-convert'
706b37b7 Enable clang-tidy modernize-loop-convert lint
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !1287
Diffstat (limited to 'Source')
-rw-r--r-- | Source/CursesDialog/cmCursesCacheEntryComposite.cxx | 5 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesOptionsWidget.cxx | 5 | ||||
-rw-r--r-- | Source/CursesDialog/cmCursesStringWidget.cxx | 4 | ||||
-rw-r--r-- | Source/cmcmd.cxx | 7 |
4 files changed, 7 insertions, 14 deletions
diff --git a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx index 8596281..e7ed097 100644 --- a/Source/CursesDialog/cmCursesCacheEntryComposite.cxx +++ b/Source/CursesDialog/cmCursesCacheEntryComposite.cxx @@ -72,9 +72,8 @@ cmCursesCacheEntryComposite::cmCursesCacheEntryComposite( this->Entry = ow; std::vector<std::string> options; cmSystemTools::ExpandListArgument(stringsProp, options); - for (std::vector<std::string>::iterator si = options.begin(); - si != options.end(); ++si) { - ow->AddOption(*si); + for (auto const& opt : options) { + ow->AddOption(opt); } ow->SetOption(value); } else { diff --git a/Source/CursesDialog/cmCursesOptionsWidget.cxx b/Source/CursesDialog/cmCursesOptionsWidget.cxx index d26a98f..a8c4933 100644 --- a/Source/CursesDialog/cmCursesOptionsWidget.cxx +++ b/Source/CursesDialog/cmCursesOptionsWidget.cxx @@ -75,9 +75,8 @@ void cmCursesOptionsWidget::SetOption(const std::string& value) this->CurrentOption = 0; // default to 0 index this->SetValue(value); int index = 0; - for (std::vector<std::string>::iterator i = this->Options.begin(); - i != this->Options.end(); ++i) { - if (*i == value) { + for (auto const& opt : this->Options) { + if (opt == value) { this->CurrentOption = index; } index++; diff --git a/Source/CursesDialog/cmCursesStringWidget.cxx b/Source/CursesDialog/cmCursesStringWidget.cxx index 8cb9c1f..5e2a329 100644 --- a/Source/CursesDialog/cmCursesStringWidget.cxx +++ b/Source/CursesDialog/cmCursesStringWidget.cxx @@ -188,9 +188,7 @@ bool cmCursesStringWidget::PrintKeys() char fmt_s[] = "%s"; char firstLine[512]; // Clean the toolbar - for (int i = 0; i < 512; i++) { - firstLine[i] = ' '; - } + memset(firstLine, ' ', sizeof(firstLine)); firstLine[511] = '\0'; curses_move(y - 4, 0); printw(fmt_s, firstLine); diff --git a/Source/cmcmd.cxx b/Source/cmcmd.cxx index 26868bc..e152cdb 100644 --- a/Source/cmcmd.cxx +++ b/Source/cmcmd.cxx @@ -282,8 +282,7 @@ int cmcmd::HandleCppCheck(const std::string& runCmd, std::vector<std::string> cppcheck_cmd; cmSystemTools::ExpandListArgument(runCmd, cppcheck_cmd, true); // extract all the -D, -U, and -I options from the compile line - for (size_t i = 0; i < orig_cmd.size(); i++) { - const std::string& opt = orig_cmd[i]; + for (auto const& opt : orig_cmd) { if (opt.size() > 2) { if ((opt[0] == '-') && ((opt[1] == 'D') || (opt[1] == 'I') || (opt[1] == 'U'))) { @@ -367,9 +366,7 @@ int cmcmd::HandleCoCompileCommands(std::vector<std::string>& args) } else if (doing_options) { bool optionFound = false; // check arg against all the commandOptions - for (std::vector<std::string>::size_type i = 0; - i < commandOptions.size(); ++i) { - const std::string& command = commandOptions[i]; + for (auto const& command : commandOptions) { if (arg.compare(0, command.size(), command) == 0) { optionFound = true; runCmd = arg.substr(command.size()); |