Commit 89bd4ee3 authored by Nikolai Kosjar's avatar Nikolai Kosjar

C++: Base parsing on editor document instead of widget

This mainly takes CppEditorSupport apart.

* Parsing is now invoked by CPPEditorDocument itself by listening to
  QTextDocument::contentsChanged().

* Upon construction and destruction CPPEditorDocument creates and
  deletes an EditorDocumentHandle for (un)registration in the model
  manager. This handle provides everything to generate the working copy
  and to access the editor document processor.

* A CPPEditorDocument owns a BaseEditorDocumentProcessor instance that
  controls parsing, semantic info recalculation and the semantic
  highlighting for the document. This is more or less what is left from
  CppEditorSupport and can be considered as the backend of a
  CPPEditorDocument. CPPEditorDocument itself is quite small.

    * BuiltinEditorDocumentProcessor and ClangEditorDocumentProcessor
      derive from BaseEditorDocumentProcessor and implement the gaps.

    * Since the semantic info calculation was bound to the widget, it
      also calculated the local uses, which depend on the cursor
      position. This calculation got moved into the extracted class
      UseSeletionsUpdater in the cppeditor plugin, which is run once the
      cursor position changes or the semantic info document is updated.

    * Some more logic got extracted:
	- SemanticInfoUpdater (logic was in CppEditorSupport)
	- SemanticHighlighter (logic was in CppEditorSupport)

    * The *Parser and *Processor classes can be easily accessed by the
      static function get().

* CppHighlightingSupport is gone since it turned out to be useless.

* The editor dependency in CompletionAssistProviders is gone since we
  actually only need the file path now.

Change-Id: I49d3a7bd138c5ed9620123e34480772535156508
Reviewed-by: Orgad Shaneh's avatarOrgad Shaneh <orgads@gmail.com>
Reviewed-by: default avatarErik Verbruggen <erik.verbruggen@digia.com>
parent 2fa15f22
......@@ -17,18 +17,14 @@ contains(DEFINES, CLANG_COMPLETION) {
}
contains(DEFINES, CLANG_HIGHLIGHTING) {
HEADERS += cppcreatemarkers.h clanghighlightingsupport.h
SOURCES += cppcreatemarkers.cpp clanghighlightingsupport.cpp
HEADERS += cppcreatemarkers.h
SOURCES += cppcreatemarkers.cpp
}
HEADERS += clangutils.h \
cxprettyprinter.h
SOURCES += clangutils.cpp \
cxprettyprinter.cpp
SOURCES += \
$$PWD/clangcodemodelplugin.cpp \
$$PWD/clangeditordocumentparser.cpp \
$$PWD/clangeditordocumentprocessor.cpp \
$$PWD/sourcemarker.cpp \
$$PWD/symbol.cpp \
$$PWD/sourcelocation.cpp \
......@@ -48,6 +44,8 @@ SOURCES += \
HEADERS += \
$$PWD/clangcodemodelplugin.h \
$$PWD/clangeditordocumentparser.h \
$$PWD/clangeditordocumentprocessor.h \
$$PWD/clang_global.h \
$$PWD/sourcemarker.h \
$$PWD/constants.h \
......@@ -68,6 +66,12 @@ HEADERS += \
$$PWD/raii/scopedclangoptions.h \
$$PWD/clangmodelmanagersupport.h
HEADERS += clangutils.h \
cxprettyprinter.h
SOURCES += clangutils.cpp \
cxprettyprinter.cpp
contains(DEFINES, CLANG_INDEXING) {
HEADERS += \
$$PWD/clangindexer.h \
......
......@@ -94,8 +94,6 @@ QtcPlugin {
name: "Highlighting support"
condition: product.clangHighlighting
files: [
"clanghighlightingsupport.cpp",
"clanghighlightingsupport.h",
"cppcreatemarkers.cpp",
"cppcreatemarkers.h",
]
......@@ -156,6 +154,10 @@ QtcPlugin {
files: [
"clang_global.h",
"clangeditordocumentparser.cpp",
"clangeditordocumentparser.h",
"clangeditordocumentprocessor.cpp",
"clangeditordocumentprocessor.h",
"clangmodelmanagersupport.cpp",
"clangmodelmanagersupport.h",
"clangcodemodelplugin.cpp",
......
......@@ -29,7 +29,6 @@
#include "clangcodemodelplugin.h"
#include "clangprojectsettingspropertiespage.h"
#include "fastindexer.h"
#include "pchmanager.h"
#include "utils.h"
......@@ -65,11 +64,9 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err
ClangCodeModel::Internal::initializeClang();
PchManager *pchManager = new PchManager(this);
FastIndexer *fastIndexer = 0;
#ifdef CLANG_INDEXING
m_indexer.reset(new ClangIndexer);
fastIndexer = m_indexer.data();
CppTools::CppModelManagerInterface::instance()->setIndexingSupport(m_indexer->indexingSupport());
#endif // CLANG_INDEXING
......@@ -80,7 +77,7 @@ bool ClangCodeModelPlugin::initialize(const QStringList &arguments, QString *err
connect(CppTools::CppModelManagerInterface::instance(), SIGNAL(projectPartsUpdated(ProjectExplorer::Project*)),
pchManager, SLOT(onProjectPartsUpdated(ProjectExplorer::Project*)));
m_modelManagerSupport.reset(new ModelManagerSupport(fastIndexer));
m_modelManagerSupport.reset(new ModelManagerSupport);
CppTools::CppModelManagerInterface::instance()->addModelManagerSupport(
m_modelManagerSupport.data());
......
......@@ -203,15 +203,14 @@ IAssistProcessor *ClangCompletionAssistProvider::createProcessor() const
}
IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
ProjectExplorer::Project *project, TextEditor::BaseTextEditor *editor,
ProjectExplorer::Project *project, const QString &filePath,
QTextDocument *document, bool isObjCEnabled, int position, AssistReason reason) const
{
Q_UNUSED(project);
Q_UNUSED(isObjCEnabled);
QString fileName = editor->document()->filePath();
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
QList<ProjectPart::Ptr> parts = modelManager->projectPart(fileName);
QList<ProjectPart::Ptr> parts = modelManager->projectPart(filePath);
if (parts.isEmpty())
parts += modelManager->fallbackProjectPart();
ProjectPart::HeaderPaths headerPaths;
......@@ -220,7 +219,7 @@ IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
foreach (ProjectPart::Ptr part, parts) {
if (part.isNull())
continue;
options = ClangCodeModel::Utils::createClangOptions(part, fileName);
options = ClangCodeModel::Utils::createClangOptions(part, filePath);
pchInfo = PchManager::instance()->pchInfo(part);
if (!pchInfo.isNull())
options.append(ClangCodeModel::Utils::createPCHInclusionOptions(pchInfo->fileName()));
......@@ -230,7 +229,7 @@ IAssistInterface *ClangCompletionAssistProvider::createAssistInterface(
return new ClangCodeModel::ClangCompletionAssistInterface(
m_clangCompletionWrapper,
document, position, fileName, reason,
document, position, filePath, reason,
options, headerPaths, pchInfo);
}
......
......@@ -58,7 +58,7 @@ public:
virtual TextEditor::IAssistProcessor *createProcessor() const;
virtual TextEditor::IAssistInterface *createAssistInterface(
ProjectExplorer::Project *project, TextEditor::BaseTextEditor *editor,
ProjectExplorer::Project *project, const QString &filePath,
QTextDocument *document, bool isObjCEnabled, int position,
TextEditor::AssistReason reason) const;
......
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** 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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "clangeditordocumentparser.h"
#include "clangutils.h"
#include "pchinfo.h"
#include "pchmanager.h"
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppprojects.h>
#include <cpptools/cppworkingcopy.h>
#include <utils/hostosinfo.h>
#include <utils/qtcassert.h>
static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1";
namespace {
QStringList createOptions(const QString &filePath, const CppTools::ProjectPart::Ptr &part)
{
using namespace ClangCodeModel;
QStringList options;
if (part.isNull())
return options;
options += QLatin1String("-fspell-checking");
options += ClangCodeModel::Utils::createClangOptions(part, filePath);
if (Internal::PchInfo::Ptr pchInfo = Internal::PchManager::instance()->pchInfo(part))
options.append(ClangCodeModel::Utils::createPCHInclusionOptions(pchInfo->fileName()));
return options;
}
QString commandLine(const QStringList &options, const QString &fileName)
{
const QStringList allOptions = QStringList(options)
<< QLatin1String("-fsyntax-only") << fileName;
QStringList allOptionsQuoted;
foreach (const QString &option, allOptions)
allOptionsQuoted.append(QLatin1Char('\'') + option + QLatin1Char('\''));
return ::Utils::HostOsInfo::withExecutableSuffix(QLatin1String("clang"))
+ QLatin1Char(' ') + allOptionsQuoted.join(QLatin1Char(' '));
}
} // anonymous namespace
namespace ClangCodeModel {
ClangEditorDocumentParser::ClangEditorDocumentParser(const QString &filePath)
: BaseEditorDocumentParser(filePath)
, m_marker(new ClangCodeModel::SemanticMarker)
{
}
void ClangEditorDocumentParser::update(CppTools::WorkingCopy workingCopy)
{
QTC_ASSERT(m_marker, return);
QMutexLocker lock(m_marker->mutex());
QMutexLocker lock2(&m_mutex);
updateProjectPart();
const QStringList options = createOptions(filePath(), projectPart());
QTime t;
if (DebugTiming) {
qDebug("*** Reparse options (cmd line equivalent): %s",
commandLine(options, filePath()).toUtf8().constData());
t.start();
}
m_marker->setFileName(filePath());
m_marker->setCompilationOptions(options);
const Internal::UnsavedFiles unsavedFiles = Utils::createUnsavedFiles(workingCopy);
m_marker->reparse(unsavedFiles);
if (DebugTiming)
qDebug() << "*** Reparse took" << t.elapsed() << "ms.";
}
QList<Diagnostic> ClangEditorDocumentParser::diagnostics() const
{
QTC_ASSERT(m_marker, return QList<Diagnostic>());
QMutexLocker(m_marker->mutex());
return m_marker->diagnostics();
}
QList<SemanticMarker::Range> ClangEditorDocumentParser::ifdefedOutBlocks() const
{
QTC_ASSERT(m_marker, return QList<SemanticMarker::Range>());
QMutexLocker(m_marker->mutex());
return m_marker->ifdefedOutBlocks();
}
SemanticMarker::Ptr ClangEditorDocumentParser::semanticMarker() const
{
return m_marker;
}
} // namespace ClangCodeModel
......@@ -27,43 +27,42 @@
**
****************************************************************************/
#ifndef CLANG_CLANGHIGHLIGHTINGSUPPORT_H
#define CLANG_CLANGHIGHLIGHTINGSUPPORT_H
#include "clangutils.h"
#include "cppcreatemarkers.h"
#include "fastindexer.h"
#ifndef CLANGEDITORDOCUMENTPARSER_H
#define CLANGEDITORDOCUMENTPARSER_H
#include <cpptools/cpphighlightingsupport.h>
#include "semanticmarker.h"
#include <QObject>
#include <QScopedPointer>
#include <cpptools/baseeditordocumentparser.h>
#include <utils/qtcoverride.h>
namespace CppTools { class WorkingCopy; }
namespace ClangCodeModel {
class ClangHighlightingSupport: public CppTools::CppHighlightingSupport
class ClangEditorDocumentParser : public CppTools::BaseEditorDocumentParser
{
public:
ClangHighlightingSupport(TextEditor::BaseTextDocument *baseTextDocument,
Internal::FastIndexer *fastIndexer);
~ClangHighlightingSupport();
Q_OBJECT
virtual bool requiresSemanticInfo() const
{ return false; }
public:
typedef QSharedPointer<ClangEditorDocumentParser> Ptr;
virtual bool hightlighterHandlesDiagnostics() const
{ return true; }
public:
ClangEditorDocumentParser(const QString &filePath);
virtual bool hightlighterHandlesIfdefedOutBlocks() const;
void update(CppTools::WorkingCopy workingCopy) QTC_OVERRIDE;
virtual QFuture<TextEditor::HighlightingResult> highlightingFuture(
const CPlusPlus::Document::Ptr &doc, const CPlusPlus::Snapshot &snapshot) const;
QList<Diagnostic> diagnostics() const;
QList<SemanticMarker::Range> ifdefedOutBlocks() const;
SemanticMarker::Ptr semanticMarker() const;
private:
Internal::FastIndexer *m_fastIndexer;
ClangCodeModel::SemanticMarker::Ptr m_semanticMarker;
SemanticMarker::Ptr m_marker;
QStringList m_options;
Internal::UnsavedFiles m_unsavedFiles;
};
} // namespace ClangCodeModel
#endif // CLANG_CLANGHIGHLIGHTINGSUPPORT_H
#endif // CLANGEDITORDOCUMENTPARSER_H
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** 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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#include "clangeditordocumentprocessor.h"
#include "cppcreatemarkers.h"
#include "diagnostic.h"
#include "pchinfo.h"
#include <cpptools/cpptoolsplugin.h>
#include <cpptools/cppworkingcopy.h>
#include <cplusplus/CppDocument.h>
#include <utils/qtcassert.h>
#include <utils/QtConcurrentTools>
static const bool DebugTiming = qgetenv("QTC_CLANG_VERBOSE") == "1";
namespace {
typedef CPlusPlus::Document::DiagnosticMessage CppToolsDiagnostic;
QList<CppToolsDiagnostic> toCppToolsDiagnostics(
const QString &filePath,
const QList<ClangCodeModel::Diagnostic> &diagnostics)
{
using namespace ClangCodeModel;
QList<CppToolsDiagnostic> converted;
foreach (const ClangCodeModel::Diagnostic &d, diagnostics) {
if (DebugTiming)
qDebug() << d.severityAsString() << d.location() << d.spelling();
if (d.location().fileName() != filePath)
continue;
// TODO: retrieve fix-its for this diagnostic
int level;
switch (d.severity()) {
case Diagnostic::Fatal: level = CppToolsDiagnostic::Fatal; break;
case Diagnostic::Error: level = CppToolsDiagnostic::Error; break;
case Diagnostic::Warning: level = CppToolsDiagnostic::Warning; break;
default: continue;
}
converted.append(CppToolsDiagnostic(level, d.location().fileName(), d.location().line(),
d.location().column(), d.spelling(), d.length()));
}
return converted;
}
QList<TextEditor::BlockRange> toTextEditorBlocks(
const QList<ClangCodeModel::SemanticMarker::Range> &ranges)
{
QList<TextEditor::BlockRange> result;
result.reserve(ranges.size());
foreach (const ClangCodeModel::SemanticMarker::Range &range, ranges)
result.append(TextEditor::BlockRange(range.first, range.last));
return result;
}
} // anonymous namespace
namespace ClangCodeModel {
ClangEditorDocumentProcessor::ClangEditorDocumentProcessor(TextEditor::BaseTextDocument *document)
: BaseEditorDocumentProcessor(document)
, m_parser(new ClangEditorDocumentParser(document->filePath()))
, m_parserRevision(0)
, m_semanticHighlighter(document)
, m_builtinProcessor(document, /*enableSemanticHighlighter=*/ false)
{
// 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, &CppTools::BuiltinEditorDocumentProcessor::cppDocumentUpdated,
this, &ClangEditorDocumentProcessor::cppDocumentUpdated);
connect(&m_builtinProcessor, &CppTools::BuiltinEditorDocumentProcessor::semanticInfoUpdated,
this, &ClangEditorDocumentProcessor::semanticInfoUpdated);
m_semanticHighlighter.setHighlightingRunner(
[this]() -> QFuture<TextEditor::HighlightingResult> {
const int firstLine = 1;
const int lastLine = baseTextDocument()->document()->blockCount();
CreateMarkers *createMarkers = CreateMarkers::create(m_parser->semanticMarker(),
baseTextDocument()->filePath(),
firstLine, lastLine);
return createMarkers->start();
});
}
ClangEditorDocumentProcessor::~ClangEditorDocumentProcessor()
{
m_parserWatcher.cancel();
m_parserWatcher.waitForFinished();
}
void ClangEditorDocumentProcessor::run()
{
// Run clang parser
const CppTools::WorkingCopy workingCopy
= CppTools::CppModelManagerInterface::instance()->workingCopy();
disconnect(&m_parserWatcher, &QFutureWatcher<void>::finished,
this, &ClangEditorDocumentProcessor::onParserFinished);
m_parserWatcher.cancel();
m_parserWatcher.setFuture(QFuture<void>());
m_parserRevision = revision();
connect(&m_parserWatcher, &QFutureWatcher<void>::finished,
this, &ClangEditorDocumentProcessor::onParserFinished);
const QFuture<void> future = QtConcurrent::run(&runParser, parser(), workingCopy);
m_parserWatcher.setFuture(future);
// Run builtin processor
m_builtinProcessor.run();
}
void ClangEditorDocumentProcessor::semanticRehighlight(bool force)
{
m_builtinProcessor.semanticRehighlight(force);
}
CppTools::SemanticInfo ClangEditorDocumentProcessor::recalculateSemanticInfo()
{
return m_builtinProcessor.recalculateSemanticInfo();
}
CppTools::BaseEditorDocumentParser *ClangEditorDocumentProcessor::parser()
{
return m_parser.data();
}
bool ClangEditorDocumentProcessor::isParserRunning() const
{
return m_parserWatcher.isRunning();
}
void ClangEditorDocumentProcessor::onParserFinished()
{
if (revision() != m_parserRevision)
return;
// Emit ifdefed out blocks
const auto ifdefoutBlocks = toTextEditorBlocks(m_parser->ifdefedOutBlocks());
emit ifdefedOutBlocksUpdated(revision(), ifdefoutBlocks);
// Emit code warnings
const auto diagnostics = toCppToolsDiagnostics(filePath(), m_parser->diagnostics());
const auto codeWarnings = toTextEditorSelections(diagnostics, textDocument());
emit codeWarningsUpdated(revision(), codeWarnings);
// Run semantic highlighter
m_semanticHighlighter.run();
}
} // namespace ClangCodeModel
/****************************************************************************
**
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
** Contact: http://www.qt-project.org/legal
**
** 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 Digia. For licensing terms and
** conditions see http://qt.digia.com/licensing. For further information
** use the contact form at http://qt.digia.com/contact-us.
**
** GNU Lesser General Public License Usage
** Alternatively, this file may be used under the terms of the GNU Lesser
** General Public License version 2.1 as published by the Free Software
** Foundation and appearing in the file LICENSE.LGPL included in the
** packaging of this file. Please review the following information to
** ensure the GNU Lesser General Public License version 2.1 requirements
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
**
** In addition, as a special exception, Digia gives you certain additional
** rights. These rights are described in the Digia Qt LGPL Exception
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
**
****************************************************************************/
#ifndef CLANGEDITORDOCUMENTPROCESSOR_H
#define CLANGEDITORDOCUMENTPROCESSOR_H
#include "clangeditordocumentparser.h"
#include <cpptools/baseeditordocumentprocessor.h>
#include <cpptools/builtineditordocumentprocessor.h>
#include <cpptools/semantichighlighter.h>
#include <utils/qtcoverride.h>
#include <QFutureWatcher>
namespace ClangCodeModel {
class ClangEditorDocumentProcessor : public CppTools::BaseEditorDocumentProcessor
{
Q_OBJECT
public:
ClangEditorDocumentProcessor(TextEditor::BaseTextDocument *document);
~ClangEditorDocumentProcessor();
// BaseEditorDocumentProcessor interface
void run() QTC_OVERRIDE;
void semanticRehighlight(bool force) QTC_OVERRIDE;
CppTools::SemanticInfo recalculateSemanticInfo() QTC_OVERRIDE;
CppTools::BaseEditorDocumentParser *parser() QTC_OVERRIDE;
bool isParserRunning() const QTC_OVERRIDE;
private slots:
void onParserFinished();
private:
QScopedPointer<ClangEditorDocumentParser> m_parser;
QFutureWatcher<void> m_parserWatcher;
unsigned m_parserRevision;
CppTools::SemanticHighlighter m_semanticHighlighter;
CppTools::BuiltinEditorDocumentProcessor m_builtinProcessor;
};
} // namespace ClangCodeModel
#endif // CLANGEDITORDOCUMENTPROCESSOR_H
......@@ -28,7 +28,7 @@
****************************************************************************/
#include "clangcompletion.h"
#include "clanghighlightingsupport.h"
#include "clangeditordocumentprocessor.h"
#include "clangmodelmanagersupport.h"
#include <QCoreApplication>
......@@ -36,9 +36,8 @@
using namespace ClangCodeModel;
using namespace ClangCodeModel::Internal;
ModelManagerSupport::ModelManagerSupport(FastIndexer *fastIndexer)
ModelManagerSupport::ModelManagerSupport()
: m_completionAssistProvider(new ClangCompletionAssistProvider)
, m_fastIndexer(fastIndexer)
{
}
......@@ -63,8 +62,8 @@ CppTools::CppCompletionAssistProvider *ModelManagerSupport::completionAssistProv
return m_completionAssistProvider.data();
}
CppTools::CppHighlightingSupport *ModelManagerSupport::highlightingSupport(
CppTools::BaseEditorDocumentProcessor *ModelManagerSupport::editorDocumentProcessor(
TextEditor::BaseTextDocument *baseTextDocument)
{
return new ClangHighlightingSupport(baseTextDocument, m_fastIndexer);
return new ClangCodeModel::ClangEditorDocumentProcessor(baseTextDocument);
}
......@@ -37,26 +37,23 @@
namespace ClangCodeModel {
namespace Internal {
class FastIndexer;
class ModelManagerSupport: public CppTools::ModelManagerSupport
{
Q_DISABLE_COPY(ModelManagerSupport)
public:
ModelManagerSupport(FastIndexer *fastIndexer);
ModelManagerSupport();
virtual ~ModelManagerSupport();
virtual QString id() const;
virtual QString displayName() const;
virtual CppTools::CppCompletionAssistProvider *completionAssistProvider();
virtual CppTools::CppHighlightingSupport *highlightingSupport(
TextEditor::BaseTextDocument *baseTextDocument);
virtual CppTools::BaseEditorDocumentProcessor *editorDocumentProcessor(
TextEditor::BaseTextDocument *baseTextDocument);
private:
QScopedPointer<CppTools::CppCompletionAssistProvider> m_completionAssistProvider;
FastIndexer *m_fastIndexer;
};
} // namespace Internal
......
......@@ -30,11 +30,7 @@
#include "clangutils.h"
#include "cppcreatemarkers.h"
#include <cpptools/cppmodelmanagerinterface.h>
#include <cpptools/cppworkingcopy.h>
#include <cplusplus/CppDocument.h>
#include <utils/hostosinfo.h>
#include <utils/runextensions.h>
#include <QCoreApplication>
......@@ -51,119 +47,52 @@ using namespace CppTools;
CreateMarkers *CreateMarkers::create(SemanticMarker::Ptr semanticMarker,
const QString &fileName,
const QStringList &options,
unsigned firstLine, unsigned lastLine,
FastIndexer *fastIndexer,
const Internal::PchInfo::Ptr &pchInfo)
unsigned firstLine