ClangCodeModel: Remove ClangEditorDocumentParser

Not needed (anymore?).

Change-Id: Id4bcbb47962d92f6fffb4538dcca14b49e8104db
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-04-28 17:42:53 +02:00
parent 557957a59f
commit 4ab0edb4b5
6 changed files with 9 additions and 193 deletions

View File

@@ -22,7 +22,6 @@ add_qtc_plugin(ClangCodeModel
clangdiagnostictooltipwidget.cpp clangdiagnostictooltipwidget.h
clangdquickfixfactory.cpp clangdquickfixfactory.h
clangdqpropertyhighlighter.cpp clangdqpropertyhighlighter.h
clangeditordocumentparser.cpp clangeditordocumentparser.h
clangeditordocumentprocessor.cpp clangeditordocumentprocessor.h
clangfixitoperation.cpp clangfixitoperation.h
clangfixitoperationsextractor.cpp clangfixitoperationsextractor.h

View File

@@ -52,8 +52,6 @@ QtcPlugin {
"clangdqpropertyhighlighter.h",
"clangdquickfixfactory.cpp",
"clangdquickfixfactory.h",
"clangeditordocumentparser.cpp",
"clangeditordocumentparser.h",
"clangeditordocumentprocessor.cpp",
"clangeditordocumentprocessor.h",
"clangfixitoperation.cpp",

View File

@@ -1,51 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#include "clangeditordocumentparser.h"
namespace ClangCodeModel {
namespace Internal {
ClangEditorDocumentParser::ClangEditorDocumentParser(const QString &filePath)
: BaseEditorDocumentParser(filePath)
{
}
void ClangEditorDocumentParser::updateImpl(const QFutureInterface<void> &,
const UpdateParams &updateParams)
{
State state_ = state();
state_.projectPartInfo = determineProjectPart(filePath(),
configuration().preferredProjectPartId,
state_.projectPartInfo,
updateParams.activeProject,
updateParams.languagePreference,
updateParams.projectsUpdated);
emit projectPartInfoUpdated(state_.projectPartInfo);
setState(state_);
}
} // namespace Internal
} // namespace ClangCodeModel

View File

@@ -1,46 +0,0 @@
/****************************************************************************
**
** Copyright (C) 2016 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <cppeditor/baseeditordocumentparser.h>
namespace ClangCodeModel {
namespace Internal {
class ClangEditorDocumentParser : public CppEditor::BaseEditorDocumentParser
{
Q_OBJECT
public:
ClangEditorDocumentParser(const QString &filePath);
private:
void updateImpl(const QFutureInterface<void> &future,
const UpdateParams &updateParams) override;
};
} // namespace Internal
} // namespace ClangCodeModel

View File

@@ -25,7 +25,6 @@
#include "clangeditordocumentprocessor.h"
#include "clangbackendcommunicator.h"
#include "clangprojectsettings.h"
#include "clangdiagnostictooltipwidget.h"
#include "clangfixitoperation.h"
@@ -33,11 +32,6 @@
#include "clangmodelmanagersupport.h"
#include "clangutils.h"
#include <diagnosticcontainer.h>
#include <sourcelocationcontainer.h>
#include <clangsupport/tokeninfocontainer.h>
#include <cppeditor/builtincursorinfo.h>
#include <cppeditor/clangdiagnosticconfigsmodel.h>
#include <cppeditor/compileroptionsbuilder.h>
@@ -67,38 +61,13 @@ namespace ClangCodeModel {
namespace Internal {
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocument *document)
: BaseEditorDocumentProcessor(document->document(), document->filePath().toString())
, m_document(*document)
, m_parser(new ClangEditorDocumentParser(document->filePath().toString()))
, m_builtinProcessor(document)
: BuiltinEditorDocumentProcessor(document), m_document(*document)
{
connect(m_parser.data(), &ClangEditorDocumentParser::projectPartInfoUpdated,
connect(parser().data(), &CppEditor::BaseEditorDocumentParser::projectPartInfoUpdated,
this, &BaseEditorDocumentProcessor::projectPartInfoUpdated);
// Forwarding the semantic info from the builtin processor enables us to provide all
// editor (widget) related features that are not yet implemented by the clang plugin.
connect(&m_builtinProcessor, &CppEditor::BuiltinEditorDocumentProcessor::cppDocumentUpdated,
this, &ClangEditorDocumentProcessor::cppDocumentUpdated);
connect(&m_builtinProcessor, &CppEditor::BuiltinEditorDocumentProcessor::semanticInfoUpdated,
this, &ClangEditorDocumentProcessor::semanticInfoUpdated);
connect(&m_builtinProcessor, &CppEditor::BuiltinEditorDocumentProcessor::codeWarningsUpdated,
this, &ClangEditorDocumentProcessor::codeWarningsUpdated);
m_builtinProcessor.setSemanticHighlightingChecker([this] {
setSemanticHighlightingChecker([this] {
return !ClangModelManagerSupport::instance()->clientForFile(m_document.filePath());
});
m_parserSynchronizer.setCancelOnWait(true);
}
void ClangEditorDocumentProcessor::runImpl(
const CppEditor::BaseEditorDocumentParser::UpdateParams &updateParams)
{
m_builtinProcessor.runImpl(updateParams);
}
void ClangEditorDocumentProcessor::recalculateSemanticInfoDetached(bool force)
{
m_builtinProcessor.recalculateSemanticInfoDetached(force);
}
void ClangEditorDocumentProcessor::semanticRehighlight()
@@ -110,27 +79,7 @@ void ClangEditorDocumentProcessor::semanticRehighlight()
return;
if (ClangModelManagerSupport::instance()->clientForFile(m_document.filePath()))
return;
m_builtinProcessor.semanticRehighlight();
}
CppEditor::SemanticInfo ClangEditorDocumentProcessor::recalculateSemanticInfo()
{
return m_builtinProcessor.recalculateSemanticInfo();
}
CppEditor::BaseEditorDocumentParser::Ptr ClangEditorDocumentProcessor::parser()
{
return m_builtinProcessor.parser();
}
CPlusPlus::Snapshot ClangEditorDocumentProcessor::snapshot()
{
return m_builtinProcessor.snapshot();
}
bool ClangEditorDocumentProcessor::isParserRunning() const
{
return m_builtinProcessor.isParserRunning();
BuiltinEditorDocumentProcessor::semanticRehighlight();
}
bool ClangEditorDocumentProcessor::hasProjectPart() const
@@ -156,20 +105,13 @@ void ClangEditorDocumentProcessor::clearProjectPart()
void ClangEditorDocumentProcessor::setParserConfig(
const CppEditor::BaseEditorDocumentParser::Configuration &config)
{
m_parser->setConfiguration(config);
m_builtinProcessor.parser()->setConfiguration(config);
CppEditor::BuiltinEditorDocumentProcessor::setParserConfig(config);
emit parserConfigChanged(Utils::FilePath::fromString(filePath()), config);
}
CppEditor::BaseEditorDocumentParser::Configuration ClangEditorDocumentProcessor::parserConfig() const
CppEditor::BaseEditorDocumentParser::Configuration ClangEditorDocumentProcessor::parserConfig()
{
return m_parser->configuration();
}
QFuture<CppEditor::CursorInfo>
ClangEditorDocumentProcessor::cursorInfo(const CppEditor::CursorInfoParams &params)
{
return m_builtinProcessor.cursorInfo(params);
return parser()->configuration();
}
ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath)

View File

@@ -25,41 +25,21 @@
#pragma once
#include "clangeditordocumentparser.h"
#include <clangsupport/sourcerangecontainer.h>
#include <cppeditor/builtineditordocumentprocessor.h>
#include <utils/futuresynchronizer.h>
#include <utils/id.h>
#include <QFutureWatcher>
namespace ClangBackEnd {
class DiagnosticContainer;
class TokenInfoContainer;
class FileContainer;
}
namespace ClangCodeModel {
namespace Internal {
class ClangEditorDocumentProcessor : public CppEditor::BaseEditorDocumentProcessor
class ClangEditorDocumentProcessor : public CppEditor::BuiltinEditorDocumentProcessor
{
Q_OBJECT
public:
ClangEditorDocumentProcessor(TextEditor::TextDocument *document);
// BaseEditorDocumentProcessor interface
void runImpl(const CppEditor::BaseEditorDocumentParser::UpdateParams &updateParams) override;
void semanticRehighlight() override;
void recalculateSemanticInfoDetached(bool force) override;
CppEditor::SemanticInfo recalculateSemanticInfo() override;
CppEditor::BaseEditorDocumentParser::Ptr parser() override;
CPlusPlus::Snapshot snapshot() override;
bool isParserRunning() const override;
bool hasProjectPart() const;
CppEditor::ProjectPart::ConstPtr projectPart() const;
@@ -68,9 +48,7 @@ public:
::Utils::Id diagnosticConfigId() const;
void setParserConfig(const CppEditor::BaseEditorDocumentParser::Configuration &config) override;
CppEditor::BaseEditorDocumentParser::Configuration parserConfig() const;
QFuture<CppEditor::CursorInfo> cursorInfo(const CppEditor::CursorInfoParams &params) override;
CppEditor::BaseEditorDocumentParser::Configuration parserConfig();
public:
static ClangEditorDocumentProcessor *get(const QString &filePath);
@@ -81,12 +59,8 @@ signals:
private:
TextEditor::TextDocument &m_document;
QSharedPointer<ClangEditorDocumentParser> m_parser;
CppEditor::ProjectPart::ConstPtr m_projectPart;
::Utils::Id m_diagnosticConfigId;
CppEditor::BuiltinEditorDocumentProcessor m_builtinProcessor;
Utils::FutureSynchronizer m_parserSynchronizer;
};
} // namespace Internal