forked from qt-creator/qt-creator
CppTools: Rename SnapshotUpdater to BuiltinEditorDocumentParser
Change-Id: I554b5e9e3f1ef7c167fa45b5cd0c230fdf63073b Reviewed-by: Erik Verbruggen <erik.verbruggen@digia.com>
This commit is contained in:
committed by
Erik Verbruggen
parent
7e71a299ef
commit
7d35212f60
@@ -1362,7 +1362,7 @@ void CppCodeModelInspectorDialog::refresh()
|
||||
if (editor) {
|
||||
editorSupport = cmmi->cppEditorSupport(editor);
|
||||
if (editorSupport) {
|
||||
const CPlusPlus::Snapshot editorSnapshot = editorSupport->snapshotUpdater()->snapshot();
|
||||
const CPlusPlus::Snapshot editorSnapshot = editorSupport->documentParser()->snapshot();
|
||||
m_snapshotInfos->append(SnapshotInfo(editorSnapshot, SnapshotInfo::EditorSnapshot));
|
||||
const QString editorSnapshotTitle
|
||||
= QString::fromLatin1("Current Editor's Snapshot (%1 Documents)")
|
||||
@@ -1413,7 +1413,7 @@ void CppCodeModelInspectorDialog::refresh()
|
||||
|
||||
// Project Parts
|
||||
const ProjectPart::Ptr editorsProjectPart = editorSupport
|
||||
? editorSupport->snapshotUpdater()->projectPart()
|
||||
? editorSupport->documentParser()->projectPart()
|
||||
: ProjectPart::Ptr();
|
||||
|
||||
const QList<ProjectInfo> projectInfos = cmmi->projectInfos();
|
||||
|
||||
@@ -1020,10 +1020,10 @@ void CppEditorWidget::onFilePathChanged()
|
||||
additionalDirectives = ProjectExplorer::SessionManager::value(
|
||||
projectFile + QLatin1Char(',') + filePath).toString().toUtf8();
|
||||
|
||||
QSharedPointer<SnapshotUpdater> updater
|
||||
= d->m_modelManager->cppEditorSupport(editor())->snapshotUpdater();
|
||||
updater->setProjectPart(d->m_modelManager->projectPartForProjectFile(projectFile));
|
||||
updater->setEditorDefines(additionalDirectives);
|
||||
QSharedPointer<BuiltinEditorDocumentParser> parser
|
||||
= d->m_modelManager->cppEditorSupport(editor())->documentParser();
|
||||
parser->setProjectPart(d->m_modelManager->projectPartForProjectFile(projectFile));
|
||||
parser->setEditorDefines(additionalDirectives);
|
||||
}
|
||||
d->m_preprocessorButton->setProperty("highlightWidget", !additionalDirectives.trimmed().isEmpty());
|
||||
d->m_preprocessorButton->update();
|
||||
@@ -1088,12 +1088,12 @@ void CppEditorWidget::showPreProcessorWidget()
|
||||
|
||||
CppPreProcessorDialog preProcessorDialog(this, textDocument()->filePath(), projectParts);
|
||||
if (preProcessorDialog.exec() == QDialog::Accepted) {
|
||||
QSharedPointer<SnapshotUpdater> updater
|
||||
= d->m_modelManager->cppEditorSupport(editor())->snapshotUpdater();
|
||||
QSharedPointer<BuiltinEditorDocumentParser> parser
|
||||
= d->m_modelManager->cppEditorSupport(editor())->documentParser();
|
||||
const QString &additionals = preProcessorDialog.additionalPreProcessorDirectives();
|
||||
updater->setProjectPart(preProcessorDialog.projectPart());
|
||||
updater->setEditorDefines(additionals.toUtf8());
|
||||
updater->update(d->m_modelManager->workingCopy());
|
||||
parser->setProjectPart(preProcessorDialog.projectPart());
|
||||
parser->setEditorDefines(additionals.toUtf8());
|
||||
parser->update(d->m_modelManager->workingCopy());
|
||||
|
||||
d->m_preprocessorButton->setProperty("highlightWidget", !additionals.trimmed().isEmpty());
|
||||
d->m_preprocessorButton->update();
|
||||
|
||||
@@ -243,7 +243,7 @@ void CppIncludeHierarchyModel::buildHierarchyIncludes_helper(const QString &file
|
||||
return;
|
||||
|
||||
CppModelManagerInterface *cppMM = CppModelManagerInterface::instance();
|
||||
const Snapshot &snapshot = cppMM->cppEditorSupport(m_editor)->snapshotUpdater()->snapshot();
|
||||
const Snapshot &snapshot = cppMM->cppEditorSupport(m_editor)->documentParser()->snapshot();
|
||||
Document::Ptr doc = snapshot.document(filePath);
|
||||
if (!doc)
|
||||
return;
|
||||
|
||||
@@ -27,8 +27,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#include "builtineditordocumentparser.h"
|
||||
#include "cppsourceprocessor.h"
|
||||
#include "cppsnapshotupdater.h"
|
||||
|
||||
#include <utils/qtcassert.h>
|
||||
|
||||
@@ -36,14 +36,14 @@ using namespace CPlusPlus;
|
||||
using namespace CppTools;
|
||||
using namespace CppTools::Internal;
|
||||
|
||||
SnapshotUpdater::SnapshotUpdater(const QString &filePath)
|
||||
BuiltinEditorDocumentParser::BuiltinEditorDocumentParser(const QString &filePath)
|
||||
: BaseEditorDocumentParser(filePath)
|
||||
, m_forceSnapshotInvalidation(false)
|
||||
, m_releaseSourceAndAST(true)
|
||||
{
|
||||
}
|
||||
|
||||
void SnapshotUpdater::update(WorkingCopy workingCopy)
|
||||
void BuiltinEditorDocumentParser::update(WorkingCopy workingCopy)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
|
||||
@@ -189,7 +189,7 @@ void SnapshotUpdater::update(WorkingCopy workingCopy)
|
||||
}
|
||||
}
|
||||
|
||||
void SnapshotUpdater::releaseResources()
|
||||
void BuiltinEditorDocumentParser::releaseResources()
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
m_snapshot = Snapshot();
|
||||
@@ -197,31 +197,32 @@ void SnapshotUpdater::releaseResources()
|
||||
m_forceSnapshotInvalidation = true;
|
||||
}
|
||||
|
||||
Document::Ptr SnapshotUpdater::document() const
|
||||
Document::Ptr BuiltinEditorDocumentParser::document() const
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
return m_snapshot.document(filePath());
|
||||
}
|
||||
|
||||
Snapshot SnapshotUpdater::snapshot() const
|
||||
Snapshot BuiltinEditorDocumentParser::snapshot() const
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
return m_snapshot;
|
||||
}
|
||||
|
||||
ProjectPart::HeaderPaths SnapshotUpdater::headerPaths() const
|
||||
ProjectPart::HeaderPaths BuiltinEditorDocumentParser::headerPaths() const
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
return m_headerPaths;
|
||||
}
|
||||
|
||||
void SnapshotUpdater::setReleaseSourceAndAST(bool onoff)
|
||||
void BuiltinEditorDocumentParser::setReleaseSourceAndAST(bool onoff)
|
||||
{
|
||||
QMutexLocker locker(&m_mutex);
|
||||
m_releaseSourceAndAST = onoff;
|
||||
}
|
||||
|
||||
void SnapshotUpdater::addFileAndDependencies(QSet<QString> *toRemove, const QString &fileName) const
|
||||
void BuiltinEditorDocumentParser::addFileAndDependencies(QSet<QString> *toRemove,
|
||||
const QString &fileName) const
|
||||
{
|
||||
toRemove->insert(fileName);
|
||||
if (fileName != filePath()) {
|
||||
@@ -27,8 +27,8 @@
|
||||
**
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef CPPTOOLS_INTERNAL_SNAPSHOTUPDATER_H
|
||||
#define CPPTOOLS_INTERNAL_SNAPSHOTUPDATER_H
|
||||
#ifndef BUILTINEDITORDOCUMENTPARSER_H
|
||||
#define BUILTINEDITORDOCUMENTPARSER_H
|
||||
|
||||
#include "baseeditordocumentparser.h"
|
||||
#include "cpptools_global.h"
|
||||
@@ -43,10 +43,10 @@
|
||||
|
||||
namespace CppTools {
|
||||
|
||||
class CPPTOOLS_EXPORT SnapshotUpdater : public BaseEditorDocumentParser
|
||||
class CPPTOOLS_EXPORT BuiltinEditorDocumentParser : public BaseEditorDocumentParser
|
||||
{
|
||||
public:
|
||||
SnapshotUpdater(const QString &filePath);
|
||||
BuiltinEditorDocumentParser(const QString &filePath);
|
||||
|
||||
void update(WorkingCopy workingCopy) QTC_OVERRIDE;
|
||||
void releaseResources();
|
||||
@@ -75,4 +75,4 @@ private:
|
||||
|
||||
} // namespace CppTools
|
||||
|
||||
#endif // CPPTOOLS_INTERNAL_SNAPSHOTUPDATER_H
|
||||
#endif // BUILTINEDITORDOCUMENTPARSER_H
|
||||
@@ -1,9 +1,9 @@
|
||||
#include "builtinindexingsupport.h"
|
||||
|
||||
#include "builtineditordocumentparser.h"
|
||||
#include "cppchecksymbols.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cppprojectfile.h"
|
||||
#include "cppsnapshotupdater.h"
|
||||
#include "cppsourceprocessor.h"
|
||||
#include "cpptoolsconstants.h"
|
||||
#include "cpptoolsplugin.h"
|
||||
@@ -136,17 +136,17 @@ void indexFindErrors(QFutureInterface<void> &future, const ParseParams params)
|
||||
qDebug("FindErrorsIndexing: \"%s\"", qPrintable(file));
|
||||
|
||||
// Parse the file as precisely as possible
|
||||
SnapshotUpdater updater(file);
|
||||
updater.setReleaseSourceAndAST(false);
|
||||
updater.update(params.workingCopy);
|
||||
CPlusPlus::Document::Ptr document = updater.document();
|
||||
BuiltinEditorDocumentParser parser(file);
|
||||
parser.setReleaseSourceAndAST(false);
|
||||
parser.update(params.workingCopy);
|
||||
CPlusPlus::Document::Ptr document = parser.document();
|
||||
QTC_ASSERT(document, return);
|
||||
|
||||
// Write diagnostic messages
|
||||
taskFileWriter.process(document);
|
||||
|
||||
// Look up symbols
|
||||
CPlusPlus::LookupContext context(document, updater.snapshot());
|
||||
CPlusPlus::LookupContext context(document, parser.snapshot());
|
||||
CheckSymbols::go(document, context, QList<CheckSymbols::Result>()).waitForFinished();
|
||||
|
||||
document->releaseSourceAndAST();
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
#include "cppcompletionassist.h"
|
||||
|
||||
#include "builtineditordocumentparser.h"
|
||||
#include "cppdoxygen.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cppmodelmanagerinterface.h"
|
||||
#include "cppsnapshotupdater.h"
|
||||
#include "cpptoolsconstants.h"
|
||||
#include "cpptoolseditorsupport.h"
|
||||
#include "cpptoolsreuse.h"
|
||||
@@ -1959,10 +1959,10 @@ void CppCompletionAssistInterface::getCppSpecifics() const
|
||||
|
||||
CppModelManagerInterface *modelManager = CppModelManagerInterface::instance();
|
||||
if (CppEditorSupport *supp = modelManager->cppEditorSupport(m_editor)) {
|
||||
if (QSharedPointer<SnapshotUpdater> updater = supp->snapshotUpdater()) {
|
||||
updater->update(m_workingCopy);
|
||||
m_snapshot = updater->snapshot();
|
||||
m_headerPaths = updater->headerPaths();
|
||||
if (QSharedPointer<BuiltinEditorDocumentParser> parser = supp->documentParser()) {
|
||||
parser->update(m_workingCopy);
|
||||
m_snapshot = parser->snapshot();
|
||||
m_headerPaths = parser->headerPaths();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -947,16 +947,15 @@ void CppToolsPlugin::test_modelmanager_precompiled_headers()
|
||||
while (sup->lastSemanticInfoDocument().isNull())
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
const QSharedPointer<SnapshotUpdater> updater = sup->snapshotUpdater();
|
||||
updater->setUsePrecompiledHeaders(true);
|
||||
updater->update(mm->workingCopy());
|
||||
sup->documentParser()->setUsePrecompiledHeaders(true);
|
||||
sup->documentParser()->update(mm->workingCopy());
|
||||
|
||||
// Check if defines from pch are considered
|
||||
Document::Ptr document = mm->document(fileName);
|
||||
QCOMPARE(nameOfFirstDeclaration(document), firstDeclarationName);
|
||||
|
||||
// Check if declarations from pch are considered
|
||||
CPlusPlus::LookupContext context(document, updater->snapshot());
|
||||
CPlusPlus::LookupContext context(document, sup->documentParser()->snapshot());
|
||||
const CPlusPlus::Identifier *identifier
|
||||
= document->control()->identifier(firstClassInPchFile.data());
|
||||
const QList<CPlusPlus::LookupItem> results = context.lookup(identifier,
|
||||
@@ -1031,8 +1030,8 @@ void CppToolsPlugin::test_modelmanager_defines_per_editor()
|
||||
while (sup->lastSemanticInfoDocument().isNull())
|
||||
QCoreApplication::processEvents();
|
||||
|
||||
sup->snapshotUpdater()->setEditorDefines(editorDefines.toUtf8());
|
||||
sup->snapshotUpdater()->update(mm->workingCopy());
|
||||
sup->documentParser()->setEditorDefines(editorDefines.toUtf8());
|
||||
sup->documentParser()->update(mm->workingCopy());
|
||||
|
||||
Document::Ptr doc = mm->document(main1File);
|
||||
QCOMPARE(nameOfFirstDeclaration(doc), firstDeclarationName);
|
||||
|
||||
@@ -29,10 +29,10 @@
|
||||
|
||||
#include "cpptoolsplugin.h"
|
||||
|
||||
#include "builtineditordocumentparser.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cppsourceprocessertesthelper.h"
|
||||
#include "cppsourceprocessor.h"
|
||||
#include "cppsnapshotupdater.h"
|
||||
#include "cpptoolseditorsupport.h"
|
||||
#include "cpptoolstestcase.h"
|
||||
|
||||
@@ -131,7 +131,7 @@ void CppToolsPlugin::test_cppsourceprocessor_includes_cyclic()
|
||||
const QString fileName2 = TestIncludePaths::testFilePath(QLatin1String("cyclic2.h"));
|
||||
const QStringList sourceFiles = QStringList() << fileName1 << fileName2;
|
||||
|
||||
// Create global snapshot (needed in SnapshotUpdater)
|
||||
// Create global snapshot (needed in BuiltinEditorDocumentParser)
|
||||
TestCase testCase;
|
||||
testCase.parseFiles(sourceFiles);
|
||||
|
||||
@@ -144,9 +144,10 @@ void CppToolsPlugin::test_cppsourceprocessor_includes_cyclic()
|
||||
CppEditorSupport *cppEditorSupport = CppModelManagerInterface::instance()
|
||||
->cppEditorSupport(editor);
|
||||
QVERIFY(cppEditorSupport);
|
||||
QSharedPointer<SnapshotUpdater> snapshotUpdater = cppEditorSupport->snapshotUpdater();
|
||||
QVERIFY(snapshotUpdater);
|
||||
Snapshot snapshot = snapshotUpdater->snapshot();
|
||||
QSharedPointer<BuiltinEditorDocumentParser> documentParser
|
||||
= cppEditorSupport->documentParser();
|
||||
QVERIFY(documentParser);
|
||||
Snapshot snapshot = documentParser->snapshot();
|
||||
QCOMPARE(snapshot.size(), 3); // Configuration file included
|
||||
|
||||
// Check includes
|
||||
|
||||
@@ -5,6 +5,7 @@ include(../../qtcreatorplugin.pri)
|
||||
HEADERS += \
|
||||
abstracteditorsupport.h \
|
||||
baseeditordocumentparser.h \
|
||||
builtineditordocumentparser.h \
|
||||
builtinindexingsupport.h \
|
||||
commentssettings.h \
|
||||
completionsettingspage.h \
|
||||
@@ -41,7 +42,6 @@ HEADERS += \
|
||||
cppqtstyleindenter.h \
|
||||
cpprefactoringchanges.h \
|
||||
cppsemanticinfo.h \
|
||||
cppsnapshotupdater.h \
|
||||
cppsourceprocessor.h \
|
||||
cpptools_global.h \
|
||||
cpptoolsconstants.h \
|
||||
@@ -64,6 +64,7 @@ HEADERS += \
|
||||
SOURCES += \
|
||||
abstracteditorsupport.cpp \
|
||||
baseeditordocumentparser.cpp \
|
||||
builtineditordocumentparser.cpp \
|
||||
builtinindexingsupport.cpp \
|
||||
commentssettings.cpp \
|
||||
completionsettingspage.cpp \
|
||||
@@ -100,7 +101,6 @@ SOURCES += \
|
||||
cppqtstyleindenter.cpp \
|
||||
cpprefactoringchanges.cpp \
|
||||
cppsemanticinfo.cpp \
|
||||
cppsnapshotupdater.cpp \
|
||||
cppsourceprocessor.cpp \
|
||||
cpptoolseditorsupport.cpp \
|
||||
cpptoolsplugin.cpp \
|
||||
|
||||
@@ -25,6 +25,7 @@ QtcPlugin {
|
||||
files: [
|
||||
"abstracteditorsupport.cpp", "abstracteditorsupport.h",
|
||||
"baseeditordocumentparser.cpp", "baseeditordocumentparser.h",
|
||||
"builtineditordocumentparser.cpp", "builtineditordocumentparser.h",
|
||||
"builtinindexingsupport.cpp", "builtinindexingsupport.h",
|
||||
"commentssettings.cpp", "commentssettings.h",
|
||||
"completionsettingspage.cpp", "completionsettingspage.h", "completionsettingspage.ui",
|
||||
@@ -61,7 +62,6 @@ QtcPlugin {
|
||||
"cppqtstyleindenter.cpp", "cppqtstyleindenter.h",
|
||||
"cpprefactoringchanges.cpp", "cpprefactoringchanges.h",
|
||||
"cppsemanticinfo.cpp", "cppsemanticinfo.h",
|
||||
"cppsnapshotupdater.cpp", "cppsnapshotupdater.h",
|
||||
"cppsourceprocessor.cpp", "cppsourceprocessor.h",
|
||||
"cpptools.qrc",
|
||||
"cpptools_global.h",
|
||||
|
||||
@@ -171,11 +171,11 @@ CppEditorSupport::CppEditorSupport(CppModelManager *modelManager, BaseTextEditor
|
||||
|
||||
CppEditorSupport::~CppEditorSupport()
|
||||
{
|
||||
m_documentParser.cancel();
|
||||
m_documentParserFuture.cancel();
|
||||
m_highlighter.cancel();
|
||||
m_futureSemanticInfo.cancel();
|
||||
|
||||
m_documentParser.waitForFinished();
|
||||
m_documentParserFuture.waitForFinished();
|
||||
m_highlighter.waitForFinished();
|
||||
m_futureSemanticInfo.waitForFinished();
|
||||
}
|
||||
@@ -259,12 +259,12 @@ CppCompletionAssistProvider *CppEditorSupport::completionAssistProvider() const
|
||||
return m_completionAssistProvider;
|
||||
}
|
||||
|
||||
QSharedPointer<SnapshotUpdater> CppEditorSupport::snapshotUpdater()
|
||||
QSharedPointer<BuiltinEditorDocumentParser> CppEditorSupport::documentParser()
|
||||
{
|
||||
QSharedPointer<SnapshotUpdater> updater = snapshotUpdater_internal();
|
||||
QSharedPointer<BuiltinEditorDocumentParser> updater = documentParser_internal();
|
||||
if (!updater || updater->filePath() != fileName()) {
|
||||
updater = QSharedPointer<SnapshotUpdater>(new SnapshotUpdater(fileName()));
|
||||
setSnapshotUpdater_internal(updater);
|
||||
updater = QSharedPointer<BuiltinEditorDocumentParser>(new BuiltinEditorDocumentParser(fileName()));
|
||||
setDocumentParser_internal(updater);
|
||||
|
||||
QSharedPointer<CppCodeModelSettings> cms = CppToolsPlugin::instance()->codeModelSettings();
|
||||
updater->setUsePrecompiledHeaders(cms->pchUsage() != CppCodeModelSettings::PchUse_None);
|
||||
@@ -282,7 +282,7 @@ void CppEditorSupport::updateDocument()
|
||||
m_updateDocumentTimer->start(m_updateDocumentInterval);
|
||||
}
|
||||
|
||||
static void parse(QFutureInterface<void> &future, QSharedPointer<SnapshotUpdater> updater,
|
||||
static void parse(QFutureInterface<void> &future, QSharedPointer<BuiltinEditorDocumentParser> updater,
|
||||
WorkingCopy workingCopy)
|
||||
{
|
||||
future.setProgressRange(0, 1);
|
||||
@@ -300,7 +300,7 @@ static void parse(QFutureInterface<void> &future, QSharedPointer<SnapshotUpdater
|
||||
|
||||
void CppEditorSupport::updateDocumentNow()
|
||||
{
|
||||
if (m_documentParser.isRunning() || m_revision != editorRevision()) {
|
||||
if (m_documentParserFuture.isRunning() || m_revision != editorRevision()) {
|
||||
m_updateDocumentTimer->start(m_updateDocumentInterval);
|
||||
} else {
|
||||
m_updateDocumentTimer->stop();
|
||||
@@ -311,14 +311,14 @@ void CppEditorSupport::updateDocumentNow()
|
||||
if (m_highlightingSupport && !m_highlightingSupport->requiresSemanticInfo())
|
||||
startHighlighting();
|
||||
|
||||
m_documentParser = QtConcurrent::run(&parse, snapshotUpdater(),
|
||||
m_documentParserFuture = QtConcurrent::run(&parse, documentParser(),
|
||||
CppModelManager::instance()->workingCopy());
|
||||
}
|
||||
}
|
||||
|
||||
bool CppEditorSupport::isUpdatingDocument()
|
||||
{
|
||||
return m_updateDocumentTimer->isActive() || m_documentParser.isRunning();
|
||||
return m_updateDocumentTimer->isActive() || m_documentParserFuture.isRunning();
|
||||
}
|
||||
|
||||
void CppEditorSupport::onDocumentUpdated(Document::Ptr doc)
|
||||
@@ -488,7 +488,7 @@ void CppEditorSupport::releaseResources()
|
||||
{
|
||||
m_highlighter.cancel();
|
||||
m_highlighter = QFuture<TextEditor::HighlightingResult>();
|
||||
snapshotUpdater()->releaseResources();
|
||||
documentParser()->releaseResources();
|
||||
setSemanticInfo(SemanticInfo(), /*emitSignal=*/ false);
|
||||
m_lastHighlightOnCompleteSemanticInfo = true;
|
||||
}
|
||||
@@ -524,11 +524,12 @@ SemanticInfo CppEditorSupport::recalculateSemanticInfoNow(const SemanticInfo::So
|
||||
|
||||
// Otherwise reprocess document
|
||||
} else {
|
||||
const QSharedPointer<SnapshotUpdater> snapshotUpdater = snapshotUpdater_internal();
|
||||
QTC_ASSERT(snapshotUpdater, return newSemanticInfo);
|
||||
newSemanticInfo.snapshot = snapshotUpdater->snapshot();
|
||||
const QSharedPointer<BuiltinEditorDocumentParser> documentParser
|
||||
= documentParser_internal();
|
||||
QTC_ASSERT(documentParser, return newSemanticInfo);
|
||||
newSemanticInfo.snapshot = documentParser->snapshot();
|
||||
if (!newSemanticInfo.snapshot.contains(source.fileName))
|
||||
return newSemanticInfo; // SnapshotUpdater::update() not yet started.
|
||||
return newSemanticInfo; // BuiltinEditorDocumentParser::update() not yet started.
|
||||
Document::Ptr doc = newSemanticInfo.snapshot.preprocessedDocument(source.code,
|
||||
source.fileName);
|
||||
if (processor)
|
||||
@@ -583,16 +584,17 @@ void CppEditorSupport::setSemanticInfo(const SemanticInfo &semanticInfo, bool em
|
||||
emit semanticInfoUpdated(semanticInfo);
|
||||
}
|
||||
|
||||
QSharedPointer<SnapshotUpdater> CppEditorSupport::snapshotUpdater_internal() const
|
||||
QSharedPointer<BuiltinEditorDocumentParser> CppEditorSupport::documentParser_internal() const
|
||||
{
|
||||
QMutexLocker locker(&m_snapshotUpdaterLock);
|
||||
return m_snapshotUpdater;
|
||||
QMutexLocker locker(&m_documentParserLock);
|
||||
return m_documentParser;
|
||||
}
|
||||
|
||||
void CppEditorSupport::setSnapshotUpdater_internal(const QSharedPointer<SnapshotUpdater> &updater)
|
||||
void CppEditorSupport::setDocumentParser_internal(
|
||||
const QSharedPointer<BuiltinEditorDocumentParser> &updater)
|
||||
{
|
||||
QMutexLocker locker(&m_snapshotUpdaterLock);
|
||||
m_snapshotUpdater = updater;
|
||||
QMutexLocker locker(&m_documentParserLock);
|
||||
m_documentParser = updater;
|
||||
}
|
||||
|
||||
void CppEditorSupport::onMimeTypeChanged()
|
||||
|
||||
@@ -30,10 +30,10 @@
|
||||
#ifndef CPPTOOLSEDITORSUPPORT_H
|
||||
#define CPPTOOLSEDITORSUPPORT_H
|
||||
|
||||
#include "builtineditordocumentparser.h"
|
||||
#include "cpphighlightingsupport.h"
|
||||
#include "cppmodelmanager.h"
|
||||
#include "cppsemanticinfo.h"
|
||||
#include "cppsnapshotupdater.h"
|
||||
|
||||
#include <cplusplus/Control.h>
|
||||
#include <cplusplus/CppDocument.h>
|
||||
@@ -133,7 +133,7 @@ public:
|
||||
|
||||
CppCompletionAssistProvider *completionAssistProvider() const;
|
||||
|
||||
QSharedPointer<SnapshotUpdater> snapshotUpdater();
|
||||
QSharedPointer<BuiltinEditorDocumentParser> documentParser();
|
||||
|
||||
/// Checks whether the document is (re)parsed or about to be (re)parsed.
|
||||
bool isUpdatingDocument();
|
||||
@@ -202,8 +202,8 @@ private:
|
||||
SemanticInfo semanticInfo() const;
|
||||
void setSemanticInfo(const SemanticInfo &semanticInfo, bool emitSignal = true);
|
||||
|
||||
QSharedPointer<SnapshotUpdater> snapshotUpdater_internal() const;
|
||||
void setSnapshotUpdater_internal(const QSharedPointer<SnapshotUpdater> &updater);
|
||||
QSharedPointer<BuiltinEditorDocumentParser> documentParser_internal() const;
|
||||
void setDocumentParser_internal(const QSharedPointer<BuiltinEditorDocumentParser> &updater);
|
||||
|
||||
private:
|
||||
Internal::CppModelManager *m_modelManager;
|
||||
@@ -212,7 +212,6 @@ private:
|
||||
QTimer *m_updateDocumentTimer;
|
||||
int m_updateDocumentInterval;
|
||||
unsigned m_revision;
|
||||
QFuture<void> m_documentParser;
|
||||
|
||||
QTimer *m_editorGCTimer;
|
||||
bool m_editorVisible;
|
||||
@@ -234,8 +233,9 @@ private:
|
||||
mutable QMutex m_lastSemanticInfoLock;
|
||||
SemanticInfo m_lastSemanticInfo;
|
||||
QFuture<void> m_futureSemanticInfo;
|
||||
mutable QMutex m_snapshotUpdaterLock;
|
||||
QSharedPointer<SnapshotUpdater> m_snapshotUpdater;
|
||||
mutable QMutex m_documentParserLock;
|
||||
QSharedPointer<BuiltinEditorDocumentParser> m_documentParser;
|
||||
QFuture<void> m_documentParserFuture;
|
||||
|
||||
// Highlighting:
|
||||
unsigned m_lastHighlightRevision;
|
||||
|
||||
@@ -195,10 +195,10 @@ public:
|
||||
|
||||
// Compare
|
||||
const Document::Ptr cppDocument
|
||||
= m_modelManager->cppEditorSupport(cppFileEditor)->snapshotUpdater()->document();
|
||||
= m_modelManager->cppEditorSupport(cppFileEditor)->documentParser()->document();
|
||||
QVERIFY(checkDiagsnosticMessages(cppDocument));
|
||||
const Document::Ptr hDocument
|
||||
= m_modelManager->cppEditorSupport(hFileEditor)->snapshotUpdater()->document();
|
||||
= m_modelManager->cppEditorSupport(hFileEditor)->documentParser()->document();
|
||||
QVERIFY(checkDiagsnosticMessages(hDocument));
|
||||
|
||||
QVERIFY(documentContainsFunctionDefinition(cppDocument,
|
||||
|
||||
Reference in New Issue
Block a user