summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--.clang-tidy1
-rw-r--r--Source/CursesDialog/cmCursesCacheEntryComposite.cxx5
-rw-r--r--Source/CursesDialog/cmCursesOptionsWidget.cxx5
-rw-r--r--Source/CursesDialog/cmCursesStringWidget.cxx4
-rw-r--r--Source/cmcmd.cxx7
-rw-r--r--Tests/CMakeLib/run_compile_commands.cxx9
6 files changed, 10 insertions, 21 deletions
diff --git a/.clang-tidy b/.clang-tidy
index 6093532..e8d39ce 100644
--- a/.clang-tidy
+++ b/.clang-tidy
@@ -8,7 +8,6 @@ misc-*,\
-misc-static-assert,\
modernize-*,\
-modernize-deprecated-headers,\
--modernize-loop-convert,\
-modernize-pass-by-value,\
-modernize-raw-string-literal,\
-modernize-replace-auto-ptr,\
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());
diff --git a/Tests/CMakeLib/run_compile_commands.cxx b/Tests/CMakeLib/run_compile_commands.cxx
index 0d692ca..b49803b 100644
--- a/Tests/CMakeLib/run_compile_commands.cxx
+++ b/Tests/CMakeLib/run_compile_commands.cxx
@@ -144,14 +144,11 @@ int main()
cmsys::ifstream file("compile_commands.json");
CompileCommandParser parser(file);
parser.Parse();
- for (CompileCommandParser::TranslationUnitsType::const_iterator
- it = parser.GetTranslationUnits().begin(),
- end = parser.GetTranslationUnits().end();
- it != end; ++it) {
+ for (auto const& tu : parser.GetTranslationUnits()) {
std::vector<std::string> command;
- cmSystemTools::ParseUnixCommandLine(it->at("command").c_str(), command);
+ cmSystemTools::ParseUnixCommandLine(tu.at("command").c_str(), command);
if (!cmSystemTools::RunSingleCommand(command, nullptr, nullptr, nullptr,
- it->at("directory").c_str())) {
+ tu.at("directory").c_str())) {
std::cout << "ERROR: Failed to run command \"" << command[0] << "\""
<< std::endl;
exit(1);