forked from qt-creator/qt-creator
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:
@@ -22,7 +22,6 @@ add_qtc_plugin(ClangCodeModel
|
|||||||
clangdiagnostictooltipwidget.cpp clangdiagnostictooltipwidget.h
|
clangdiagnostictooltipwidget.cpp clangdiagnostictooltipwidget.h
|
||||||
clangdquickfixfactory.cpp clangdquickfixfactory.h
|
clangdquickfixfactory.cpp clangdquickfixfactory.h
|
||||||
clangdqpropertyhighlighter.cpp clangdqpropertyhighlighter.h
|
clangdqpropertyhighlighter.cpp clangdqpropertyhighlighter.h
|
||||||
clangeditordocumentparser.cpp clangeditordocumentparser.h
|
|
||||||
clangeditordocumentprocessor.cpp clangeditordocumentprocessor.h
|
clangeditordocumentprocessor.cpp clangeditordocumentprocessor.h
|
||||||
clangfixitoperation.cpp clangfixitoperation.h
|
clangfixitoperation.cpp clangfixitoperation.h
|
||||||
clangfixitoperationsextractor.cpp clangfixitoperationsextractor.h
|
clangfixitoperationsextractor.cpp clangfixitoperationsextractor.h
|
||||||
|
@@ -52,8 +52,6 @@ QtcPlugin {
|
|||||||
"clangdqpropertyhighlighter.h",
|
"clangdqpropertyhighlighter.h",
|
||||||
"clangdquickfixfactory.cpp",
|
"clangdquickfixfactory.cpp",
|
||||||
"clangdquickfixfactory.h",
|
"clangdquickfixfactory.h",
|
||||||
"clangeditordocumentparser.cpp",
|
|
||||||
"clangeditordocumentparser.h",
|
|
||||||
"clangeditordocumentprocessor.cpp",
|
"clangeditordocumentprocessor.cpp",
|
||||||
"clangeditordocumentprocessor.h",
|
"clangeditordocumentprocessor.h",
|
||||||
"clangfixitoperation.cpp",
|
"clangfixitoperation.cpp",
|
||||||
|
@@ -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
|
|
@@ -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
|
|
@@ -25,7 +25,6 @@
|
|||||||
|
|
||||||
#include "clangeditordocumentprocessor.h"
|
#include "clangeditordocumentprocessor.h"
|
||||||
|
|
||||||
#include "clangbackendcommunicator.h"
|
|
||||||
#include "clangprojectsettings.h"
|
#include "clangprojectsettings.h"
|
||||||
#include "clangdiagnostictooltipwidget.h"
|
#include "clangdiagnostictooltipwidget.h"
|
||||||
#include "clangfixitoperation.h"
|
#include "clangfixitoperation.h"
|
||||||
@@ -33,11 +32,6 @@
|
|||||||
#include "clangmodelmanagersupport.h"
|
#include "clangmodelmanagersupport.h"
|
||||||
#include "clangutils.h"
|
#include "clangutils.h"
|
||||||
|
|
||||||
#include <diagnosticcontainer.h>
|
|
||||||
#include <sourcelocationcontainer.h>
|
|
||||||
|
|
||||||
#include <clangsupport/tokeninfocontainer.h>
|
|
||||||
|
|
||||||
#include <cppeditor/builtincursorinfo.h>
|
#include <cppeditor/builtincursorinfo.h>
|
||||||
#include <cppeditor/clangdiagnosticconfigsmodel.h>
|
#include <cppeditor/clangdiagnosticconfigsmodel.h>
|
||||||
#include <cppeditor/compileroptionsbuilder.h>
|
#include <cppeditor/compileroptionsbuilder.h>
|
||||||
@@ -67,38 +61,13 @@ namespace ClangCodeModel {
|
|||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocument *document)
|
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::TextDocument *document)
|
||||||
: BaseEditorDocumentProcessor(document->document(), document->filePath().toString())
|
: BuiltinEditorDocumentProcessor(document), m_document(*document)
|
||||||
, m_document(*document)
|
|
||||||
, m_parser(new ClangEditorDocumentParser(document->filePath().toString()))
|
|
||||||
, m_builtinProcessor(document)
|
|
||||||
{
|
{
|
||||||
connect(m_parser.data(), &ClangEditorDocumentParser::projectPartInfoUpdated,
|
connect(parser().data(), &CppEditor::BaseEditorDocumentParser::projectPartInfoUpdated,
|
||||||
this, &BaseEditorDocumentProcessor::projectPartInfoUpdated);
|
this, &BaseEditorDocumentProcessor::projectPartInfoUpdated);
|
||||||
|
setSemanticHighlightingChecker([this] {
|
||||||
// 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] {
|
|
||||||
return !ClangModelManagerSupport::instance()->clientForFile(m_document.filePath());
|
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()
|
void ClangEditorDocumentProcessor::semanticRehighlight()
|
||||||
@@ -110,27 +79,7 @@ void ClangEditorDocumentProcessor::semanticRehighlight()
|
|||||||
return;
|
return;
|
||||||
if (ClangModelManagerSupport::instance()->clientForFile(m_document.filePath()))
|
if (ClangModelManagerSupport::instance()->clientForFile(m_document.filePath()))
|
||||||
return;
|
return;
|
||||||
m_builtinProcessor.semanticRehighlight();
|
BuiltinEditorDocumentProcessor::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();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ClangEditorDocumentProcessor::hasProjectPart() const
|
bool ClangEditorDocumentProcessor::hasProjectPart() const
|
||||||
@@ -156,20 +105,13 @@ void ClangEditorDocumentProcessor::clearProjectPart()
|
|||||||
void ClangEditorDocumentProcessor::setParserConfig(
|
void ClangEditorDocumentProcessor::setParserConfig(
|
||||||
const CppEditor::BaseEditorDocumentParser::Configuration &config)
|
const CppEditor::BaseEditorDocumentParser::Configuration &config)
|
||||||
{
|
{
|
||||||
m_parser->setConfiguration(config);
|
CppEditor::BuiltinEditorDocumentProcessor::setParserConfig(config);
|
||||||
m_builtinProcessor.parser()->setConfiguration(config);
|
|
||||||
emit parserConfigChanged(Utils::FilePath::fromString(filePath()), config);
|
emit parserConfigChanged(Utils::FilePath::fromString(filePath()), config);
|
||||||
}
|
}
|
||||||
|
|
||||||
CppEditor::BaseEditorDocumentParser::Configuration ClangEditorDocumentProcessor::parserConfig() const
|
CppEditor::BaseEditorDocumentParser::Configuration ClangEditorDocumentProcessor::parserConfig()
|
||||||
{
|
{
|
||||||
return m_parser->configuration();
|
return parser()->configuration();
|
||||||
}
|
|
||||||
|
|
||||||
QFuture<CppEditor::CursorInfo>
|
|
||||||
ClangEditorDocumentProcessor::cursorInfo(const CppEditor::CursorInfoParams ¶ms)
|
|
||||||
{
|
|
||||||
return m_builtinProcessor.cursorInfo(params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath)
|
ClangEditorDocumentProcessor *ClangEditorDocumentProcessor::get(const QString &filePath)
|
||||||
|
@@ -25,41 +25,21 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "clangeditordocumentparser.h"
|
|
||||||
|
|
||||||
#include <clangsupport/sourcerangecontainer.h>
|
|
||||||
|
|
||||||
#include <cppeditor/builtineditordocumentprocessor.h>
|
#include <cppeditor/builtineditordocumentprocessor.h>
|
||||||
|
|
||||||
#include <utils/futuresynchronizer.h>
|
|
||||||
#include <utils/id.h>
|
#include <utils/id.h>
|
||||||
|
|
||||||
#include <QFutureWatcher>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
class DiagnosticContainer;
|
|
||||||
class TokenInfoContainer;
|
|
||||||
class FileContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ClangCodeModel {
|
namespace ClangCodeModel {
|
||||||
namespace Internal {
|
namespace Internal {
|
||||||
|
|
||||||
class ClangEditorDocumentProcessor : public CppEditor::BaseEditorDocumentProcessor
|
class ClangEditorDocumentProcessor : public CppEditor::BuiltinEditorDocumentProcessor
|
||||||
{
|
{
|
||||||
Q_OBJECT
|
Q_OBJECT
|
||||||
|
|
||||||
public:
|
public:
|
||||||
ClangEditorDocumentProcessor(TextEditor::TextDocument *document);
|
ClangEditorDocumentProcessor(TextEditor::TextDocument *document);
|
||||||
|
|
||||||
// BaseEditorDocumentProcessor interface
|
|
||||||
void runImpl(const CppEditor::BaseEditorDocumentParser::UpdateParams &updateParams) override;
|
|
||||||
void semanticRehighlight() 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;
|
bool hasProjectPart() const;
|
||||||
CppEditor::ProjectPart::ConstPtr projectPart() const;
|
CppEditor::ProjectPart::ConstPtr projectPart() const;
|
||||||
@@ -68,9 +48,7 @@ public:
|
|||||||
::Utils::Id diagnosticConfigId() const;
|
::Utils::Id diagnosticConfigId() const;
|
||||||
|
|
||||||
void setParserConfig(const CppEditor::BaseEditorDocumentParser::Configuration &config) override;
|
void setParserConfig(const CppEditor::BaseEditorDocumentParser::Configuration &config) override;
|
||||||
CppEditor::BaseEditorDocumentParser::Configuration parserConfig() const;
|
CppEditor::BaseEditorDocumentParser::Configuration parserConfig();
|
||||||
|
|
||||||
QFuture<CppEditor::CursorInfo> cursorInfo(const CppEditor::CursorInfoParams ¶ms) override;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
static ClangEditorDocumentProcessor *get(const QString &filePath);
|
static ClangEditorDocumentProcessor *get(const QString &filePath);
|
||||||
@@ -81,12 +59,8 @@ signals:
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
TextEditor::TextDocument &m_document;
|
TextEditor::TextDocument &m_document;
|
||||||
QSharedPointer<ClangEditorDocumentParser> m_parser;
|
|
||||||
CppEditor::ProjectPart::ConstPtr m_projectPart;
|
CppEditor::ProjectPart::ConstPtr m_projectPart;
|
||||||
::Utils::Id m_diagnosticConfigId;
|
::Utils::Id m_diagnosticConfigId;
|
||||||
|
|
||||||
CppEditor::BuiltinEditorDocumentProcessor m_builtinProcessor;
|
|
||||||
Utils::FutureSynchronizer m_parserSynchronizer;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace Internal
|
} // namespace Internal
|
||||||
|
Reference in New Issue
Block a user