Commit 802f9f47 authored by Nikolai Kosjar's avatar Nikolai Kosjar

Clang: Pass IpcCommunicator directly to ClangEditorDocumentProcessor

Change-Id: I666c56f304522a3edc2a21055df4ef70aecb0e0e
Reviewed-by: default avatarMarco Bubke <marco.bubke@theqtcompany.com>
parent cbdcd1e4
......@@ -30,10 +30,10 @@
#include "clangeditordocumentprocessor.h"
#include "clangbackendipcintegration.h"
#include "clangfixitoperation.h"
#include "clangfixitoperationsextractor.h"
#include "clanghighlightingmarksreporter.h"
#include "clangmodelmanagersupport.h"
#include "clangutils.h"
#include <diagnosticcontainer.h>
......@@ -62,11 +62,11 @@ namespace ClangCodeModel {
namespace Internal {
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(
ModelManagerSupportClang *modelManagerSupport,
IpcCommunicator &ipcCommunicator,
TextEditor::TextDocument *document)
: BaseEditorDocumentProcessor(document)
, m_diagnosticManager(document)
, m_modelManagerSupport(modelManagerSupport)
, m_ipcCommunicator(ipcCommunicator)
, m_parser(new ClangEditorDocumentParser(document->filePath().toString()))
, m_parserRevision(0)
, m_semanticHighlighter(document)
......@@ -86,8 +86,7 @@ ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor()
m_parserWatcher.waitForFinished();
if (m_projectPart) {
QTC_ASSERT(m_modelManagerSupport, return);
m_modelManagerSupport->ipcCommunicator().unregisterTranslationUnitsForEditor(
m_ipcCommunicator.unregisterTranslationUnitsForEditor(
{ClangBackEnd::FileContainer(filePath(), m_projectPart->id())});
}
}
......@@ -281,16 +280,13 @@ void ClangEditorDocumentProcessor::onParserFinished()
void ClangEditorDocumentProcessor::registerTranslationUnitForEditor(CppTools::ProjectPart *projectPart)
{
QTC_ASSERT(m_modelManagerSupport, return);
IpcCommunicator &ipcCommunicator = m_modelManagerSupport->ipcCommunicator();
if (m_projectPart) {
if (projectPart->id() != m_projectPart->id()) {
ipcCommunicator.unregisterTranslationUnitsForEditor({fileContainerWithArguments()});
ipcCommunicator.registerTranslationUnitsForEditor({fileContainerWithArguments(projectPart)});
m_ipcCommunicator.unregisterTranslationUnitsForEditor({fileContainerWithArguments()});
m_ipcCommunicator.registerTranslationUnitsForEditor({fileContainerWithArguments(projectPart)});
}
} else {
ipcCommunicator.registerTranslationUnitsForEditor({{fileContainerWithArguments(projectPart)}});
m_ipcCommunicator.registerTranslationUnitsForEditor({{fileContainerWithArguments(projectPart)}});
}
}
......@@ -299,7 +295,7 @@ void ClangEditorDocumentProcessor::updateTranslationUnitIfProjectPartExists()
if (m_projectPart) {
const ClangBackEnd::FileContainer fileContainer = fileContainerWithDocumentContent(m_projectPart->id());
m_modelManagerSupport->ipcCommunicator().updateTranslationUnitWithRevisionCheck(fileContainer);
m_ipcCommunicator.updateTranslationUnitWithRevisionCheck(fileContainer);
}
}
......@@ -307,9 +303,8 @@ void ClangEditorDocumentProcessor::requestDocumentAnnotations(const QString &pro
{
const auto fileContainer = fileContainerWithDocumentContent(projectpartId);
auto &ipcCommunicator = m_modelManagerSupport->ipcCommunicator();
ipcCommunicator.requestDiagnostics(fileContainer);
ipcCommunicator.requestHighlighting(fileContainer);
m_ipcCommunicator.requestDiagnostics(fileContainer);
m_ipcCommunicator.requestHighlighting(fileContainer);
}
static CppTools::ProjectPart projectPartForLanguageOption(CppTools::ProjectPart *projectPart)
......
......@@ -34,12 +34,10 @@
#include "clangdiagnosticmanager.h"
#include "clangeditordocumentparser.h"
#include <cpptools/baseeditordocumentprocessor.h>
#include <cpptools/builtineditordocumentprocessor.h>
#include <cpptools/semantichighlighter.h>
#include <QFutureWatcher>
#include <QPointer>
namespace ClangBackEnd {
class DiagnosticContainer;
......@@ -50,14 +48,14 @@ class FileContainer;
namespace ClangCodeModel {
namespace Internal {
class ModelManagerSupportClang;
class IpcCommunicator;
class ClangEditorDocumentProcessor : public CppTools::BaseEditorDocumentProcessor
{
Q_OBJECT
public:
ClangEditorDocumentProcessor(ModelManagerSupportClang *modelManagerSupport,
ClangEditorDocumentProcessor(IpcCommunicator &ipcCommunicator,
TextEditor::TextDocument *document);
~ClangEditorDocumentProcessor();
......@@ -103,7 +101,7 @@ private:
private:
ClangDiagnosticManager m_diagnosticManager;
QPointer<ModelManagerSupportClang> m_modelManagerSupport;
IpcCommunicator &m_ipcCommunicator;
QSharedPointer<ClangEditorDocumentParser> m_parser;
CppTools::ProjectPart::Ptr m_projectPart;
QFutureWatcher<void> m_parserWatcher;
......
......@@ -100,7 +100,7 @@ CppTools::CppCompletionAssistProvider *ModelManagerSupportClang::completionAssis
CppTools::BaseEditorDocumentProcessor *ModelManagerSupportClang::editorDocumentProcessor(
TextEditor::TextDocument *baseTextDocument)
{
return new ClangEditorDocumentProcessor(this, baseTextDocument);
return new ClangEditorDocumentProcessor(m_ipcCommunicator, baseTextDocument);
}
void ModelManagerSupportClang::onCurrentEditorChanged(Core::IEditor *)
......
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