CmakeProjectManager: Remove foreach / Q_FOREACH usage

Task-number: QTCREATORBUG-27464
Change-Id: Iabe3a621efa56282bf1511f540c98fdf5d8da270
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
This commit is contained in:
Artem Sokolovskii
2022-05-18 12:28:04 +02:00
parent 7173bd6190
commit c23aa1c656
6 changed files with 18 additions and 13 deletions

View File

@@ -80,7 +80,8 @@ static QStringList scanDirectory(const FilePath &path, const QString &prefix)
QStringList result;
qCDebug(cmInputLog) << "Scanning for directories matching" << prefix << "in" << path;
foreach (const FilePath &entry, path.dirEntries({{prefix + "*"}, QDir::Dirs | QDir::NoDotAndDotDot})) {
const QList<FilePath> entries = path.dirEntries({{prefix + "*"}, QDir::Dirs | QDir::NoDotAndDotDot});
for (const FilePath &entry : entries) {
QTC_ASSERT(entry.isDir(), continue);
result.append(entry.toString());
}
@@ -119,7 +120,8 @@ QStringList CMakeProjectImporter::importCandidates()
candidates << scanDirectory(projectFilePath().absolutePath(), "build");
foreach (Kit *k, KitManager::kits()) {
const QList<Kit *> kits = KitManager::kits();
for (const Kit *k : kits) {
FilePath shadowBuildDirectory
= CMakeBuildConfiguration::shadowBuildDirectory(projectFilePath(),
k,
@@ -533,7 +535,7 @@ void CMakeProjectPlugin::testCMakeProjectImporterQt()
QFETCH(QString, expectedQmake);
CMakeConfig config;
foreach (const QString &c, cache) {
for (const QString &c : qAsConst(cache)) {
const int pos = c.indexOf('=');
Q_ASSERT(pos > 0);
const QString key = c.left(pos);
@@ -590,7 +592,7 @@ void CMakeProjectPlugin::testCMakeProjectImporterToolChain()
QCOMPARE(expectedLanguages.count(), expectedToolChains.count());
CMakeConfig config;
foreach (const QString &c, cache) {
for (const QString &c : qAsConst(cache)) {
const int pos = c.indexOf('=');
Q_ASSERT(pos > 0);
const QString key = c.left(pos);