From 13d2d499ab95de10330fdfd44d53e50bf5a853b9 Mon Sep 17 00:00:00 2001 From: Erik Verbruggen Date: Fri, 6 Jun 2014 14:41:19 +0200 Subject: C++: move post-sourceprocessing action into callback. Change-Id: Iac6c9fe1ada27ac0d96417e490cc5723e6969541 Reviewed-by: Nikolai Kosjar --- src/plugins/cpptools/cppsourceprocessor.cpp | 32 +++++++---------------------- 1 file changed, 7 insertions(+), 25 deletions(-) (limited to 'src/plugins/cpptools/cppsourceprocessor.cpp') diff --git a/src/plugins/cpptools/cppsourceprocessor.cpp b/src/plugins/cpptools/cppsourceprocessor.cpp index 5ddbfcfcd3..64fa8dca0b 100644 --- a/src/plugins/cpptools/cppsourceprocessor.cpp +++ b/src/plugins/cpptools/cppsourceprocessor.cpp @@ -17,9 +17,8 @@ * \class CppTools::Internal::CppSourceProcessor * \brief The CppSourceProcessor class updates set of indexed C++ files. * - * Indexed file is truncated version of fully parsed document: copy of source - * code and full AST will be dropped when indexing is done. Working copy ensures - * that documents with most recent copy placed in memory will be parsed correctly. + * Working copy ensures that documents with most recent copy placed in memory will be parsed + * correctly. * * \sa CPlusPlus::Document * \sa CppTools::CppModelManagerInterface::WorkingCopy @@ -79,24 +78,10 @@ inline const Macro revision(const CppModelManagerInterface::WorkingCopy &working } // anonymous namespace -CppSourceProcessor::CppSourceProcessor(QPointer modelManager, - bool dumpFileNameWhileParsing) - : m_snapshot(modelManager->snapshot()), - m_modelManager(modelManager), - m_dumpFileNameWhileParsing(dumpFileNameWhileParsing), - m_preprocess(this, &m_env), - m_revision(0), - m_defaultCodec(Core::EditorManager::defaultTextCodec()) -{ - m_preprocess.setKeepComments(true); -} - -CppSourceProcessor::CppSourceProcessor(QPointer modelManager, - const Snapshot &snapshot, - bool dumpFileNameWhileParsing) +CppSourceProcessor::CppSourceProcessor(const Snapshot &snapshot, DocumentCallback documentFinished) : m_snapshot(snapshot), - m_modelManager(modelManager), - m_dumpFileNameWhileParsing(dumpFileNameWhileParsing), + m_documentFinished(documentFinished), + m_dumpFileNameWhileParsing(false), m_preprocess(this, &m_env), m_revision(0), m_defaultCodec(Core::EditorManager::defaultTextCodec()) @@ -417,7 +402,7 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In } if (m_included.contains(absoluteFileName)) return; // We've already seen this file. - if (absoluteFileName != modelManager()->configurationFileName()) + if (!isInjectedFile(absoluteFileName)) m_included.insert(absoluteFileName); // Already in snapshot? Use it! @@ -470,10 +455,7 @@ void CppSourceProcessor::sourceNeeded(unsigned line, const QString &fileName, In document->check(m_workingCopy.contains(document->fileName()) ? Document::FullCheck : Document::FastCheck); - if (m_modelManager) { - m_modelManager->emitDocumentUpdated(document); - document->releaseSourceAndAST(); - } + m_documentFinished(document); m_snapshot.insert(document); m_todo.remove(absoluteFileName); -- cgit v1.2.1