Commit a181c3e4 authored by Joerg Bornemann's avatar Joerg Bornemann

QbsProjectManager: Fix detaching of Qt containers in for loops

Found by clazy.

Change-Id: I9ccca922f6aa8b6a8f1c16c6e62db8dae3c4cc6f
Reviewed-by: Jake Petroules's avatarJake Petroules <jake.petroules@qt.io>
Reviewed-by: Christian Kandeler's avatarChristian Kandeler <christian.kandeler@qt.io>
parent e71912b4
......@@ -217,7 +217,8 @@ QbsRootProjectNode *QbsNodeTreeBuilder::buildTree(QbsProject *project)
QCoreApplication::translate("QbsRootProjectNode", "Qbs files"));
Utils::FileName base = project->projectDirectory();
for (const QString &f : unreferencedBuildSystemFiles(project->qbsProject())) {
const QStringList &files = unreferencedBuildSystemFiles(project->qbsProject());
for (const QString &f : files) {
const Utils::FileName filePath = Utils::FileName::fromString(f);
if (filePath.isChildOf(base))
buildSystemFiles->addNestedNode(new ProjectExplorer::FileNode(filePath, ProjectExplorer::FileType::Project, false));
......
......@@ -701,7 +701,8 @@ void QbsProject::configureAsExampleProject(const QSet<Id> &platforms)
= IBuildConfigurationFactory::find(k, projectFilePath().toString());
if (!factory)
continue;
for (BuildInfo * const info : factory->availableSetups(k, projectFilePath().toString()))
const auto &buildInfos = factory->availableSetups(k, projectFilePath().toString());
for (BuildInfo * const info : buildInfos)
infoList << info;
}
setup(infoList);
......
......@@ -106,7 +106,8 @@ static bool hasBuildGraph(const QString &dir)
static QStringList candidatesForDirectory(const QString &dir)
{
QStringList candidates;
for (const QString &subDir : QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot)) {
const QStringList &subDirs = QDir(dir).entryList(QDir::Dirs | QDir::NoDotAndDotDot);
for (const QString &subDir : subDirs) {
const QString absSubDir = dir + QLatin1Char('/') + subDir;
if (hasBuildGraph(absSubDir))
candidates << absSubDir;
......@@ -121,7 +122,8 @@ QStringList QbsProjectImporter::importCandidates()
QSet<QString> seenCandidates;
seenCandidates.insert(projectDir);
for (Kit * const k : KitManager::kits()) {
const auto &kits = KitManager::kits();
for (Kit * const k : kits) {
QFileInfo fi(buildDir(projectFilePath().toString(), k));
const QString candidate = fi.absolutePath();
if (!seenCandidates.contains(candidate)) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment