QmakeProjectManager: Do not keep an IDocument in QmakePriFile

Instead, we keep the IDocuments as "extra project files" in the Project
class, like the other project managers do it.
This has two advantages:
    - The document is no longer created in a parser thread
      callback, improving Qt Creator responsiveness while
      loading a project.
    - The IDocuments no longer get needlessly destroyed
      and re-created on a re-parse.
This is relevant because adding these objects to the DocumentManager
results in the creation of file watchers, which is expensive.

Task-number: QTCREATORBUG-18533
Change-Id: I49c03377974e6b33340234dbabbbd82b8d0c827c
Reviewed-by: hjk <hjk@qt.io>
This commit is contained in:
Christian Kandeler
2020-02-03 12:38:08 +01:00
parent 9fbdeca35c
commit 37aecdd112
4 changed files with 11 additions and 3 deletions

View File

@@ -259,6 +259,15 @@ void QmakeBuildSystem::updateCodeModels()
updateQmlJSCodeModel();
}
void QmakeBuildSystem::updateDocuments()
{
QVector<FilePath> projectDocuments;
project()->rootProjectNode()->forEachProjectNode([&projectDocuments](const ProjectNode *n) {
projectDocuments << n->filePath();
});
project()->setExtraProjectFiles(projectDocuments);
}
void QmakeBuildSystem::updateCppCodeModel()
{
m_toolChainWarnings.clear();
@@ -528,6 +537,7 @@ void QmakeBuildSystem::decrementPendingEvaluateFutures()
m_asyncUpdateState = Base;
updateBuildSystemData();
updateCodeModels();
updateDocuments();
target()->updateDefaultDeployConfigurations();
m_guard.markAsSuccess(); // Qmake always returns (some) data, even when it failed:-)
m_guard = {}; // This triggers emitParsingFinished by destroying the previous guard.