ClangCodeModel: Remove ClangModelManagerSupport::instance()

Not needed.

Change-Id: I46ee3a493ddb59c4b5f0e3eb4443d7f348a6b074
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2022-08-02 16:15:38 +02:00
parent 3a53eebcfd
commit c9b1e3a744
3 changed files with 3 additions and 15 deletions

View File

@@ -32,6 +32,7 @@
#include "tasktimers.h" #include "tasktimers.h"
#include <cppeditor/semantichighlighter.h> #include <cppeditor/semantichighlighter.h>
#include <languageclient/languageclientmanager.h>
#include <languageclient/semantichighlightsupport.h> #include <languageclient/semantichighlightsupport.h>
#include <languageserverprotocol/lsptypes.h> #include <languageserverprotocol/lsptypes.h>
#include <texteditor/blockrange.h> #include <texteditor/blockrange.h>
@@ -381,7 +382,7 @@ void doSemanticHighlighting(
const Position startPos(r.line - 1, r.column - 1); const Position startPos(r.line - 1, r.column - 1);
virtualRanges << Range(startPos, startPos.withOffset(r.length, &doc)); virtualRanges << Range(startPos, startPos.withOffset(r.length, &doc));
} }
QMetaObject::invokeMethod(ClangModelManagerSupport::instance(), QMetaObject::invokeMethod(LanguageClientManager::instance(),
[filePath, virtualRanges, docRevision] { [filePath, virtualRanges, docRevision] {
if (ClangdClient * const client = ClangModelManagerSupport::clientForFile(filePath)) if (ClangdClient * const client = ClangModelManagerSupport::clientForFile(filePath))
client->setVirtualRanges(filePath, virtualRanges, docRevision); client->setVirtualRanges(filePath, virtualRanges, docRevision);

View File

@@ -79,8 +79,6 @@ using namespace LanguageClient;
namespace ClangCodeModel { namespace ClangCodeModel {
namespace Internal { namespace Internal {
static ClangModelManagerSupport *m_instance = nullptr;
static CppEditor::CppModelManager *cppModelManager() static CppEditor::CppModelManager *cppModelManager()
{ {
return CppEditor::CppModelManager::instance(); return CppEditor::CppModelManager::instance();
@@ -162,9 +160,6 @@ static void checkSystemForClangdSuitability()
ClangModelManagerSupport::ClangModelManagerSupport() ClangModelManagerSupport::ClangModelManagerSupport()
{ {
QTC_CHECK(!m_instance);
m_instance = this;
watchForExternalChanges(); watchForExternalChanges();
watchForInternalChanges(); watchForInternalChanges();
setupClangdConfigFile(); setupClangdConfigFile();
@@ -214,7 +209,6 @@ ClangModelManagerSupport::ClangModelManagerSupport()
ClangModelManagerSupport::~ClangModelManagerSupport() ClangModelManagerSupport::~ClangModelManagerSupport()
{ {
m_generatorSynchronizer.waitForFinished(); m_generatorSynchronizer.waitForFinished();
m_instance = nullptr;
} }
void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data, void ClangModelManagerSupport::followSymbol(const CppEditor::CursorInEditor &data,
@@ -806,10 +800,5 @@ void ClangModelManagerSupport::reinitializeBackendDocuments(const QStringList &p
} }
} }
ClangModelManagerSupport *ClangModelManagerSupport::instance()
{
return m_instance;
}
} // Internal } // Internal
} // ClangCodeModel } // ClangCodeModel

View File

@@ -69,8 +69,6 @@ public:
static ClangdClient *clientForProject(const ProjectExplorer::Project *project); static ClangdClient *clientForProject(const ProjectExplorer::Project *project);
static ClangdClient *clientForFile(const Utils::FilePath &file); static ClangdClient *clientForFile(const Utils::FilePath &file);
static ClangModelManagerSupport *instance();
private: private:
void followSymbol(const CppEditor::CursorInEditor &data, void followSymbol(const CppEditor::CursorInEditor &data,
const Utils::LinkHandler &processLinkCallback, bool resolveTarget, const Utils::LinkHandler &processLinkCallback, bool resolveTarget,