@@ -137,7 +137,7 @@ void CheckThread::run()
137137
138138void CheckThread::runAddonsAndTools (const ImportProject::FileSettings *fileSettings, const QString &fileName)
139139{
140- foreach (const QString addon, mAddonsAndTools ) {
140+ for (const QString& addon : mAddonsAndTools ) {
141141 if (addon == CLANG_ANALYZER || addon == CLANG_TIDY ) {
142142 if (!fileSettings)
143143 continue ;
@@ -150,17 +150,17 @@ void CheckThread::runAddonsAndTools(const ImportProject::FileSettings *fileSetti
150150 args << (" -I" + QString::fromStdString (*incIt));
151151 for (std::list<std::string>::const_iterator i = fileSettings->systemIncludePaths .begin (); i != fileSettings->systemIncludePaths .end (); ++i)
152152 args << " -isystem" << QString::fromStdString (*i);
153- foreach ( QString def, QString::fromStdString (fileSettings->defines ).split (" ;" )) {
153+ for ( const QString& def : QString::fromStdString (fileSettings->defines ).split (" ;" )) {
154154 args << (" -D" + def);
155155 }
156- foreach (const std::string& U, fileSettings->undefs ) {
156+ for (const std::string& U : fileSettings->undefs ) {
157157 args << QString::fromStdString (" -U" + U);
158158 }
159159
160160 const QString clangPath = CheckThread::clangTidyCmd ();
161161 if (!clangPath.isEmpty ()) {
162162 QDir dir (clangPath + " /../lib/clang" );
163- foreach (QString ver, dir.entryList ()) {
163+ for (QString ver : dir.entryList ()) {
164164 QString includePath = dir.absolutePath () + ' /' + ver + " /include" ;
165165 if (ver[0 ] != ' .' && QDir (includePath).exists ()) {
166166 args << " -isystem" << includePath;
@@ -173,7 +173,7 @@ void CheckThread::runAddonsAndTools(const ImportProject::FileSettings *fileSetti
173173 // To create compile_commands.json in windows see:
174174 // https://bitsmaker.gitlab.io/post/clang-tidy-from-vs2015/
175175
176- foreach (QString includePath, mClangIncludePaths ) {
176+ for (QString includePath : mClangIncludePaths ) {
177177 if (!includePath.isEmpty ()) {
178178 includePath.replace (" \\ " , " /" );
179179 args << " -isystem" << includePath.trimmed ();
@@ -262,7 +262,7 @@ void CheckThread::runAddonsAndTools(const ImportProject::FileSettings *fileSetti
262262 {
263263 const QString cmd (clangTidyCmd ());
264264 QString debug (cmd.contains (" " ) ? (' \" ' + cmd + ' \" ' ) : cmd);
265- foreach ( QString arg, args) {
265+ for ( const QString& arg : args) {
266266 if (arg.contains (" " ))
267267 debug += " \" " + arg + ' \" ' ;
268268 else
@@ -375,7 +375,7 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
375375 }
376376 errorItems.append (errorItem);
377377
378- foreach (const ErrorItem &e, errorItems) {
378+ for (const ErrorItem &e : errorItems) {
379379 if (e.errorPath .isEmpty ())
380380 continue ;
381381 Suppressions::ErrorMessage errorMessage;
@@ -388,7 +388,7 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
388388 continue ;
389389
390390 std::list<ErrorMessage::FileLocation> callstack;
391- foreach (const QErrorPathItem &path, e.errorPath ) {
391+ for (const QErrorPathItem &path : e.errorPath ) {
392392 callstack.push_back (ErrorMessage::FileLocation (path.file .toStdString (), path.info .toStdString (), path.line , path.column ));
393393 }
394394 const std::string f0 = file0.toStdString ();
@@ -401,7 +401,7 @@ void CheckThread::parseClangErrors(const QString &tool, const QString &file0, QS
401401
402402bool CheckThread::isSuppressed (const Suppressions::ErrorMessage &errorMessage) const
403403{
404- foreach (const Suppressions::Suppression &suppression, mSuppressions ) {
404+ for (const Suppressions::Suppression &suppression : mSuppressions ) {
405405 if (suppression.isSuppressed (errorMessage))
406406 return true ;
407407 }
0 commit comments