forked from qt-creator/qt-creator
Qmake: Speed up QmakePriFile::findPriFile
Avoid needless detaching in that method: The method is used less since the Nodes no longer need to go through it. All the runconfigurations still use it, so this change is still noticeable. Change-Id: I9f5e238ab1ef7165fd4fef1b0f80d4e5daa9a7e8 Reviewed-by: Eike Ziller <eike.ziller@qt.io> Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -43,6 +43,7 @@
|
|||||||
#include <qtsupport/profilereader.h>
|
#include <qtsupport/profilereader.h>
|
||||||
|
|
||||||
#include <utils/algorithm.h>
|
#include <utils/algorithm.h>
|
||||||
|
#include <utils/asconst.h>
|
||||||
#include <utils/qtcprocess.h>
|
#include <utils/qtcprocess.h>
|
||||||
#include <utils/mimetypes/mimedatabase.h>
|
#include <utils/mimetypes/mimedatabase.h>
|
||||||
#include <utils/stringutils.h>
|
#include <utils/stringutils.h>
|
||||||
@@ -199,12 +200,22 @@ QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName)
|
|||||||
{
|
{
|
||||||
if (fileName == filePath())
|
if (fileName == filePath())
|
||||||
return this;
|
return this;
|
||||||
for (QmakePriFile *n : children()) {
|
for (QmakePriFile *n : Utils::asConst(m_children)) {
|
||||||
if (QmakePriFile *result = n->findPriFile(fileName))
|
if (QmakePriFile *result = n->findPriFile(fileName))
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
const QmakePriFile *QmakePriFile::findPriFile(const FileName &fileName) const
|
||||||
|
{
|
||||||
|
if (fileName == filePath())
|
||||||
|
return this;
|
||||||
|
for (const QmakePriFile *n : Utils::asConst(m_children)) {
|
||||||
|
if (const QmakePriFile *result = n->findPriFile(fileName))
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
void QmakePriFile::makeEmpty()
|
void QmakePriFile::makeEmpty()
|
||||||
@@ -1007,7 +1018,12 @@ static ProjectType proFileTemplateTypeToProjectType(ProFileEvaluator::TemplateTy
|
|||||||
|
|
||||||
QmakeProFile *QmakeProFile::findProFile(const FileName &fileName)
|
QmakeProFile *QmakeProFile::findProFile(const FileName &fileName)
|
||||||
{
|
{
|
||||||
return dynamic_cast<QmakeProFile *>(findPriFile(fileName));
|
return static_cast<QmakeProFile *>(findPriFile(fileName));
|
||||||
|
}
|
||||||
|
|
||||||
|
const QmakeProFile *QmakeProFile::findProFile(const FileName &fileName) const
|
||||||
|
{
|
||||||
|
return static_cast<const QmakeProFile *>(findPriFile(fileName));
|
||||||
}
|
}
|
||||||
|
|
||||||
QString QmakeProFile::makefile() const
|
QString QmakeProFile::makefile() const
|
||||||
|
|||||||
@@ -121,6 +121,7 @@ public:
|
|||||||
QVector<QmakePriFile *> children() const;
|
QVector<QmakePriFile *> children() const;
|
||||||
|
|
||||||
QmakePriFile *findPriFile(const Utils::FileName &fileName);
|
QmakePriFile *findPriFile(const Utils::FileName &fileName);
|
||||||
|
const QmakePriFile *findPriFile(const Utils::FileName &fileName) const;
|
||||||
|
|
||||||
bool knowsFile(const Utils::FileName &filePath) const;
|
bool knowsFile(const Utils::FileName &filePath) const;
|
||||||
|
|
||||||
@@ -280,6 +281,7 @@ public:
|
|||||||
|
|
||||||
QList<QmakeProFile *> allProFiles();
|
QList<QmakeProFile *> allProFiles();
|
||||||
QmakeProFile *findProFile(const Utils::FileName &fileName);
|
QmakeProFile *findProFile(const Utils::FileName &fileName);
|
||||||
|
const QmakeProFile *findProFile(const Utils::FileName &fileName) const;
|
||||||
|
|
||||||
ProjectType projectType() const;
|
ProjectType projectType() const;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user