Clang: Remove project tracking on clangbackend side

...as it is not needed. Just provide the compilation arguments as part
of the Document.

As a side effect, re-initializing the backend after a crash is cheaper
and will not freeze the UI anymore (referenced bug).

Task-number: QTCREATORBUG-21097
Change-Id: I866e25ef1fd5e4d318df16612a7564469e6baa11
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-09-25 09:41:32 +02:00
parent 25ea9a4d24
commit aa290912b8
102 changed files with 394 additions and 2388 deletions

View File

@@ -50,8 +50,6 @@
#include <projectexplorer/session.h>
#include <clangsupport/filecontainer.h>
#include <clangsupport/projectpartcontainer.h>
#include <clangsupport/projectpartsupdatedmessage.h>
#include <utils/algorithm.h>
#include <utils/qtcassert.h>
@@ -107,8 +105,6 @@ ModelManagerSupportClang::ModelManagerSupportClang()
CppTools::CppCodeModelSettings *settings = CppTools::codeModelSettings().data();
connect(settings, &CppTools::CppCodeModelSettings::clangDiagnosticConfigsInvalidated,
this, &ModelManagerSupportClang::onDiagnosticConfigsInvalidated);
m_communicator.projectPartsUpdatedForFallback();
}
ModelManagerSupportClang::~ModelManagerSupportClang()
@@ -411,17 +407,16 @@ void ModelManagerSupportClang::onProjectPartsUpdated(ProjectExplorer::Project *p
const CppTools::ProjectInfo projectInfo = cppModelManager()->projectInfo(project);
QTC_ASSERT(projectInfo.isValid(), return);
m_communicator.projectPartsUpdated(projectInfo.projectParts());
m_communicator.projectPartsUpdatedForFallback();
QStringList projectPartIds;
for (const CppTools::ProjectPart::Ptr &projectPart : projectInfo.projectParts())
projectPartIds.append(projectPart->id());
onProjectPartsRemoved(projectPartIds);
}
void ModelManagerSupportClang::onProjectPartsRemoved(const QStringList &projectPartIds)
{
if (!projectPartIds.isEmpty()) {
closeBackendDocumentsWithProjectParts(projectPartIds);
m_communicator.projectPartsRemoved(projectPartIds);
m_communicator.projectPartsUpdatedForFallback();
}
if (!projectPartIds.isEmpty())
reinitializeBackendDocuments(projectPartIds);
}
static ClangEditorDocumentProcessors clangProcessorsWithDiagnosticConfig(
@@ -445,8 +440,7 @@ clangProcessorsWithProjectParts(const QStringList &projectPartIds)
});
}
void ModelManagerSupportClang::closeBackendDocumentsWithProjectParts(
const QStringList &projectPartIds)
void ModelManagerSupportClang::reinitializeBackendDocuments(const QStringList &projectPartIds)
{
const auto processors = clangProcessorsWithProjectParts(projectPartIds);
foreach (ClangEditorDocumentProcessor *processor, processors) {