forked from qt-creator/qt-creator
Clang: Send less data on unregisterTranslationUnit
For unregisterTranslationUnit only the file path and the project part id is needed. Change-Id: I882d2fe07af094c07ea42413d6874539535a48ea Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -101,10 +101,8 @@ ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor()
|
|||||||
m_parserWatcher.cancel();
|
m_parserWatcher.cancel();
|
||||||
m_parserWatcher.waitForFinished();
|
m_parserWatcher.waitForFinished();
|
||||||
|
|
||||||
if (m_projectPart) {
|
if (m_projectPart)
|
||||||
m_communicator.unregisterTranslationUnitsForEditor(
|
unregisterTranslationUnitForEditor();
|
||||||
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ClangEditorDocumentProcessor::runImpl(
|
void ClangEditorDocumentProcessor::runImpl(
|
||||||
@@ -384,11 +382,6 @@ QFuture<CppTools::ToolTipInfo> ClangEditorDocumentProcessor::toolTipInfo(const Q
|
|||||||
static_cast<quint32>(column));
|
static_cast<quint32>(column));
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangBackEnd::FileContainer ClangEditorDocumentProcessor::fileContainerWithArguments() const
|
|
||||||
{
|
|
||||||
return fileContainerWithArguments(m_projectPart.data());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangEditorDocumentProcessor::clearDiagnosticsWithFixIts()
|
void ClangEditorDocumentProcessor::clearDiagnosticsWithFixIts()
|
||||||
{
|
{
|
||||||
m_diagnosticManager.clearDiagnosticsWithFixIts();
|
m_diagnosticManager.clearDiagnosticsWithFixIts();
|
||||||
@@ -442,7 +435,7 @@ void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(CppTools::Pr
|
|||||||
if (m_projectPart) {
|
if (m_projectPart) {
|
||||||
if (projectPart->id() == m_projectPart->id())
|
if (projectPart->id() == m_projectPart->id())
|
||||||
return;
|
return;
|
||||||
m_communicator.unregisterTranslationUnitsForEditor({fileContainerWithArguments()});
|
unregisterTranslationUnitForEditor();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_communicator.registerTranslationUnitsForEditor(
|
m_communicator.registerTranslationUnitsForEditor(
|
||||||
@@ -450,6 +443,13 @@ void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(CppTools::Pr
|
|||||||
ClangCodeModel::Utils::setLastSentDocumentRevision(filePath(), revision());
|
ClangCodeModel::Utils::setLastSentDocumentRevision(filePath(), revision());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ClangEditorDocumentProcessor::unregisterTranslationUnitForEditor()
|
||||||
|
{
|
||||||
|
QTC_ASSERT(m_projectPart, return);
|
||||||
|
m_communicator.unregisterTranslationUnitsForEditor(
|
||||||
|
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
|
||||||
|
}
|
||||||
|
|
||||||
void ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists()
|
void ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists()
|
||||||
{
|
{
|
||||||
if (m_projectPart) {
|
if (m_projectPart) {
|
||||||
@@ -621,17 +621,6 @@ static QStringList fileArguments(const QString &filePath, CppTools::ProjectPart
|
|||||||
+ precompiledHeaderOptions(filePath, projectPart);
|
+ precompiledHeaderOptions(filePath, projectPart);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangBackEnd::FileContainer
|
|
||||||
ClangEditorDocumentProcessor::fileContainerWithArguments(CppTools::ProjectPart *projectPart) const
|
|
||||||
{
|
|
||||||
const auto projectPartId = projectPart
|
|
||||||
? Utf8String::fromString(projectPart->id())
|
|
||||||
: Utf8String();
|
|
||||||
const QStringList theFileArguments = fileArguments(filePath(), projectPart);
|
|
||||||
|
|
||||||
return {filePath(), projectPartId, Utf8StringVector(theFileArguments), revision()};
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangBackEnd::FileContainer
|
ClangBackEnd::FileContainer
|
||||||
ClangEditorDocumentProcessor::fileContainerWithArgumentsAndDocumentContent(
|
ClangEditorDocumentProcessor::fileContainerWithArgumentsAndDocumentContent(
|
||||||
CppTools::ProjectPart *projectPart) const
|
CppTools::ProjectPart *projectPart) const
|
||||||
|
@@ -92,7 +92,7 @@ public:
|
|||||||
int line,
|
int line,
|
||||||
int column) override;
|
int column) override;
|
||||||
|
|
||||||
ClangBackEnd::FileContainer fileContainerWithArguments() const;
|
void unregisterTranslationUnitForEditor();
|
||||||
|
|
||||||
void clearDiagnosticsWithFixIts();
|
void clearDiagnosticsWithFixIts();
|
||||||
|
|
||||||
@@ -110,7 +110,6 @@ private:
|
|||||||
HeaderErrorDiagnosticWidgetCreator creatorForHeaderErrorDiagnosticWidget(
|
HeaderErrorDiagnosticWidgetCreator creatorForHeaderErrorDiagnosticWidget(
|
||||||
const ClangBackEnd::DiagnosticContainer &firstHeaderErrorDiagnostic);
|
const ClangBackEnd::DiagnosticContainer &firstHeaderErrorDiagnostic);
|
||||||
ClangBackEnd::FileContainer simpleFileContainer(const QByteArray &codecName = QByteArray()) const;
|
ClangBackEnd::FileContainer simpleFileContainer(const QByteArray &codecName = QByteArray()) const;
|
||||||
ClangBackEnd::FileContainer fileContainerWithArguments(CppTools::ProjectPart *projectPart) const;
|
|
||||||
ClangBackEnd::FileContainer fileContainerWithArgumentsAndDocumentContent(
|
ClangBackEnd::FileContainer fileContainerWithArgumentsAndDocumentContent(
|
||||||
CppTools::ProjectPart *projectPart) const;
|
CppTools::ProjectPart *projectPart) const;
|
||||||
ClangBackEnd::FileContainer fileContainerWithDocumentContent(const QString &projectpartId) const;
|
ClangBackEnd::FileContainer fileContainerWithDocumentContent(const QString &projectpartId) const;
|
||||||
|
@@ -376,7 +376,7 @@ void ModelManagerSupportClang::unregisterTranslationUnitsWithProjectParts(
|
|||||||
{
|
{
|
||||||
const auto processors = clangProcessorsWithProjectParts(projectPartIds);
|
const auto processors = clangProcessorsWithProjectParts(projectPartIds);
|
||||||
foreach (ClangEditorDocumentProcessor *processor, processors) {
|
foreach (ClangEditorDocumentProcessor *processor, processors) {
|
||||||
m_communicator.unregisterTranslationUnitsForEditor({processor->fileContainerWithArguments()});
|
processor->unregisterTranslationUnitForEditor();
|
||||||
processor->clearProjectPart();
|
processor->clearProjectPart();
|
||||||
processor->run();
|
processor->run();
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user