2013-12-10 14:37:32 +01:00
|
|
|
/****************************************************************************
|
|
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** Copyright (C) 2016 The Qt Company Ltd.
|
|
|
|
|
** Contact: https://www.qt.io/licensing/
|
2013-12-10 14:37:32 +01:00
|
|
|
**
|
|
|
|
|
** 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
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2013-12-10 14:37:32 +01:00
|
|
|
**
|
2016-01-15 14:57:40 +01:00
|
|
|
** 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.
|
2013-12-10 14:37:32 +01:00
|
|
|
**
|
|
|
|
|
****************************************************************************/
|
|
|
|
|
|
2016-03-18 07:55:01 +01:00
|
|
|
#pragma once
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2014-08-19 15:59:29 +02:00
|
|
|
#include "clangeditordocumentparser.h"
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2022-04-28 12:10:53 +02:00
|
|
|
#include <clangsupport/sourcerangecontainer.h>
|
|
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
#include <cppeditor/builtineditordocumentprocessor.h>
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2021-05-12 15:12:48 +02:00
|
|
|
#include <utils/futuresynchronizer.h>
|
2020-06-26 13:59:38 +02:00
|
|
|
#include <utils/id.h>
|
|
|
|
|
|
2014-08-19 15:59:29 +02:00
|
|
|
#include <QFutureWatcher>
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2015-08-31 16:28:26 +02:00
|
|
|
namespace ClangBackEnd {
|
|
|
|
|
class DiagnosticContainer;
|
2017-12-05 09:42:35 +01:00
|
|
|
class TokenInfoContainer;
|
2015-10-05 11:17:03 +02:00
|
|
|
class FileContainer;
|
2015-08-31 16:28:26 +02:00
|
|
|
}
|
|
|
|
|
|
2013-12-10 14:37:32 +01:00
|
|
|
namespace ClangCodeModel {
|
2015-05-08 15:48:17 +02:00
|
|
|
namespace Internal {
|
|
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
class ClangEditorDocumentProcessor : public CppEditor::BaseEditorDocumentProcessor
|
2013-12-10 14:37:32 +01:00
|
|
|
{
|
2014-08-19 15:59:29 +02:00
|
|
|
Q_OBJECT
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2014-08-19 15:59:29 +02:00
|
|
|
public:
|
2022-04-28 17:15:39 +02:00
|
|
|
ClangEditorDocumentProcessor(TextEditor::TextDocument *document);
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2014-08-19 15:59:29 +02:00
|
|
|
// BaseEditorDocumentProcessor interface
|
2021-08-30 10:58:08 +02:00
|
|
|
void runImpl(const CppEditor::BaseEditorDocumentParser::UpdateParams &updateParams) override;
|
2015-06-19 14:43:41 +02:00
|
|
|
void semanticRehighlight() override;
|
2015-06-19 14:37:26 +02:00
|
|
|
void recalculateSemanticInfoDetached(bool force) override;
|
2021-08-30 10:58:08 +02:00
|
|
|
CppEditor::SemanticInfo recalculateSemanticInfo() override;
|
|
|
|
|
CppEditor::BaseEditorDocumentParser::Ptr parser() override;
|
2015-06-03 15:33:22 +02:00
|
|
|
CPlusPlus::Snapshot snapshot() override;
|
|
|
|
|
bool isParserRunning() const override;
|
2013-12-10 14:37:32 +01:00
|
|
|
|
2015-09-28 15:15:25 +02:00
|
|
|
bool hasProjectPart() const;
|
2021-08-30 10:58:08 +02:00
|
|
|
CppEditor::ProjectPart::ConstPtr projectPart() const;
|
2015-09-18 12:19:46 +02:00
|
|
|
void clearProjectPart();
|
2015-07-14 19:01:32 +02:00
|
|
|
|
2020-06-26 13:59:38 +02:00
|
|
|
::Utils::Id diagnosticConfigId() const;
|
2018-01-19 16:57:18 +01:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
void setParserConfig(const CppEditor::BaseEditorDocumentParser::Configuration &config) override;
|
2022-02-08 11:49:37 +01:00
|
|
|
CppEditor::BaseEditorDocumentParser::Configuration parserConfig() const;
|
2017-01-18 15:05:46 +01:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
QFuture<CppEditor::CursorInfo> cursorInfo(const CppEditor::CursorInfoParams ¶ms) override;
|
2017-05-24 13:23:01 +02:00
|
|
|
|
2015-07-14 19:01:32 +02:00
|
|
|
public:
|
|
|
|
|
static ClangEditorDocumentProcessor *get(const QString &filePath);
|
|
|
|
|
|
2018-03-22 13:05:59 +01:00
|
|
|
signals:
|
2022-02-08 11:49:37 +01:00
|
|
|
void parserConfigChanged(const Utils::FilePath &filePath,
|
|
|
|
|
const CppEditor::BaseEditorDocumentParser::Configuration &config);
|
2018-03-22 13:05:59 +01:00
|
|
|
|
2015-08-31 16:28:26 +02:00
|
|
|
private:
|
2017-06-09 12:19:09 +02:00
|
|
|
TextEditor::TextDocument &m_document;
|
2015-09-01 17:34:07 +02:00
|
|
|
QSharedPointer<ClangEditorDocumentParser> m_parser;
|
2021-08-30 10:58:08 +02:00
|
|
|
CppEditor::ProjectPart::ConstPtr m_projectPart;
|
2020-06-26 13:59:38 +02:00
|
|
|
::Utils::Id m_diagnosticConfigId;
|
2014-08-19 15:59:29 +02:00
|
|
|
|
2021-08-30 10:58:08 +02:00
|
|
|
CppEditor::BuiltinEditorDocumentProcessor m_builtinProcessor;
|
2021-05-12 15:12:48 +02:00
|
|
|
Utils::FutureSynchronizer m_parserSynchronizer;
|
2013-12-10 14:37:32 +01:00
|
|
|
};
|
|
|
|
|
|
2015-05-08 15:48:17 +02:00
|
|
|
} // namespace Internal
|
2013-12-10 14:37:32 +01:00
|
|
|
} // namespace ClangCodeModel
|