Commit c4ace441 authored by Nikolai Kosjar's avatar Nikolai Kosjar

CppTools/Clang: Remove QScopedPointers in *EditorDocumentParsers

...since they are pointless.

Change-Id: I1c7925d3b1ad33ac0f1dc372797e3ab9a4bdc4b3
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 45570d40
......@@ -92,7 +92,7 @@ namespace ClangCodeModel {
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::BaseTextDocument *document)
: BaseEditorDocumentProcessor(document)
, m_parser(new ClangEditorDocumentParser(document->filePath()))
, m_parser(document->filePath())
, m_parserRevision(0)
, m_semanticHighlighter(document)
, m_builtinProcessor(document, /*enableSemanticHighlighter=*/ false)
......@@ -109,7 +109,7 @@ ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::BaseTextD
const int firstLine = 1;
const int lastLine = baseTextDocument()->document()->blockCount();
CreateMarkers *createMarkers = CreateMarkers::create(m_parser->semanticMarker(),
CreateMarkers *createMarkers = CreateMarkers::create(m_parser.semanticMarker(),
baseTextDocument()->filePath(),
firstLine, lastLine);
return createMarkers->start();
......@@ -155,7 +155,7 @@ CppTools::SemanticInfo ClangEditorDocumentProcessor::recalculateSemanticInfo()
CppTools::BaseEditorDocumentParser *ClangEditorDocumentProcessor::parser()
{
return m_parser.data();
return &m_parser;
}
bool ClangEditorDocumentProcessor::isParserRunning() const
......@@ -169,11 +169,11 @@ void ClangEditorDocumentProcessor::onParserFinished()
return;
// Emit ifdefed out blocks
const auto ifdefoutBlocks = toTextEditorBlocks(m_parser->ifdefedOutBlocks());
const auto ifdefoutBlocks = toTextEditorBlocks(m_parser.ifdefedOutBlocks());
emit ifdefedOutBlocksUpdated(revision(), ifdefoutBlocks);
// Emit code warnings
const auto diagnostics = toCppToolsDiagnostics(filePath(), m_parser->diagnostics());
const auto diagnostics = toCppToolsDiagnostics(filePath(), m_parser.diagnostics());
const auto codeWarnings = toTextEditorSelections(diagnostics, textDocument());
emit codeWarningsUpdated(revision(), codeWarnings);
......
......@@ -61,7 +61,7 @@ private slots:
void onParserFinished();
private:
QScopedPointer<ClangEditorDocumentParser> m_parser;
ClangEditorDocumentParser m_parser;
QFutureWatcher<void> m_parserWatcher;
unsigned m_parserRevision;
......
......@@ -131,7 +131,7 @@ BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor(
TextEditor::BaseTextDocument *document,
bool enableSemanticHighlighter)
: BaseEditorDocumentProcessor(document)
, m_parser(new BuiltinEditorDocumentParser(document->filePath()))
, m_parser(document->filePath())
, m_semanticHighlighter(enableSemanticHighlighter
? new CppTools::SemanticHighlighter(document)
: 0)
......@@ -139,7 +139,7 @@ BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor(
using namespace Internal;
QSharedPointer<CppCodeModelSettings> cms = CppToolsPlugin::instance()->codeModelSettings();
m_parser->setUsePrecompiledHeaders(cms->pchUsage() != CppCodeModelSettings::PchUse_None);
m_parser.setUsePrecompiledHeaders(cms->pchUsage() != CppCodeModelSettings::PchUse_None);
if (m_semanticHighlighter) {
m_semanticHighlighter->setHighlightingRunner(
......@@ -150,7 +150,7 @@ BuiltinEditorDocumentProcessor::BuiltinEditorDocumentProcessor(
});
}
connect(m_parser.data(), &BuiltinEditorDocumentParser::finished,
connect(&m_parser, &BuiltinEditorDocumentParser::finished,
this, &BuiltinEditorDocumentProcessor::onParserFinished);
connect(&m_semanticInfoUpdater, &SemanticInfoUpdater::updated,
this, &BuiltinEditorDocumentProcessor::onSemanticInfoUpdated);
......@@ -169,7 +169,7 @@ void BuiltinEditorDocumentProcessor::run()
BaseEditorDocumentParser *BuiltinEditorDocumentProcessor::parser()
{
return m_parser.data();
return &m_parser;
}
void BuiltinEditorDocumentProcessor::semanticRehighlight(bool force)
......@@ -189,13 +189,6 @@ bool BuiltinEditorDocumentProcessor::isParserRunning() const
return m_parserFuture.isRunning();
}
BuiltinEditorDocumentProcessor *BuiltinEditorDocumentProcessor::get(const QString &filePath)
{
if (BaseEditorDocumentProcessor *b = BaseEditorDocumentProcessor::get(filePath))
return qobject_cast<BuiltinEditorDocumentProcessor *>(b);
return 0;
}
void BuiltinEditorDocumentProcessor::onParserFinished(CPlusPlus::Document::Ptr document,
CPlusPlus::Snapshot snapshot)
{
......
......@@ -57,9 +57,6 @@ public:
BaseEditorDocumentParser *parser() QTC_OVERRIDE;
bool isParserRunning() const QTC_OVERRIDE;
public:
static BuiltinEditorDocumentProcessor *get(const QString &filePath);
private:
void onParserFinished(CPlusPlus::Document::Ptr document, CPlusPlus::Snapshot snapshot);
void onSemanticInfoUpdated(const CppTools::SemanticInfo semanticInfo);
......@@ -67,7 +64,7 @@ private:
SemanticInfo::Source createSemanticInfoSource(bool force) const;
private:
QScopedPointer<BuiltinEditorDocumentParser> m_parser;
BuiltinEditorDocumentParser m_parser;
QFuture<void> m_parserFuture;
CPlusPlus::Snapshot m_documentSnapshot;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment