diff options
author | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-06-06 14:41:19 +0200 |
---|---|---|
committer | Erik Verbruggen <erik.verbruggen@digia.com> | 2014-06-18 11:04:35 +0200 |
commit | 13d2d499ab95de10330fdfd44d53e50bf5a853b9 (patch) | |
tree | 15b3f33646e333e44ea10c65d859f22e878c574a /src/plugins/cpptools/cppsourceprocessor.cpp | |
parent | 528fa525bc415a071d6a69d12f2f2c8c4f406b97 (diff) | |
download | qt-creator-13d2d499ab95de10330fdfd44d53e50bf5a853b9.tar.gz |
C++: move post-sourceprocessing action into callback.
Change-Id: Iac6c9fe1ada27ac0d96417e490cc5723e6969541
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@digia.com>
Diffstat (limited to 'src/plugins/cpptools/cppsourceprocessor.cpp')
-rw-r--r-- | src/plugins/cpptools/cppsourceprocessor.cpp | 32 |
1 files changed, 7 insertions, 25 deletions
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<CppModelManager> 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<CppModelManager> 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); |