LanguageClient: Pass out a mutable Project object

Callers can have legitimate reasons to use it in a non-const manner.

Change-Id: Id91a4708dd95845661b291ce7cc9ee1581bdade8
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-09-23 12:11:31 +02:00
parent dde5a52693
commit c47312a836
3 changed files with 4 additions and 7 deletions

View File

@@ -433,10 +433,7 @@ void ClangModelManagerSupport::watchForExternalChanges()
if (client && client->state() != Client::Shutdown
&& client->state() != Client::ShutdownRequested
&& !projectIsParsing(client->project())) {
// FIXME: Lots of const-incorrectness along the call chain of updateLanguageClient().
const auto project = const_cast<ProjectExplorer::Project *>(client->project());
ProjectExplorer::Project * const project = client->project();
updateLanguageClient(project, CppModelManager::instance()->projectInfo(project));
}
}

View File

@@ -928,7 +928,7 @@ void Client::executeCommand(const Command &command)
sendContent(ExecuteCommandRequest(ExecuteCommandParams(command)));
}
const ProjectExplorer::Project *Client::project() const
ProjectExplorer::Project *Client::project() const
{
return m_project;
}

View File

@@ -157,7 +157,7 @@ public:
// workspace control
virtual void setCurrentProject(ProjectExplorer::Project *project);
const ProjectExplorer::Project *project() const;
ProjectExplorer::Project *project() const;
virtual void projectOpened(ProjectExplorer::Project *project);
virtual void projectClosed(ProjectExplorer::Project *project);
@@ -280,7 +280,7 @@ private:
DocumentSymbolCache m_documentSymbolCache;
HoverHandler m_hoverHandler;
QHash<LanguageServerProtocol::DocumentUri, TextEditor::HighlightingResults> m_highlights;
const ProjectExplorer::Project *m_project = nullptr;
ProjectExplorer::Project *m_project = nullptr;
QSet<TextEditor::IAssistProcessor *> m_runningAssistProcessors;
SymbolSupport m_symbolSupport;
ProgressManager m_progressManager;