diff options
author | Marco Bubke <marco.bubke@qt.io> | 2018-09-11 17:02:45 +0200 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2018-09-24 14:33:05 +0000 |
commit | 4e6d09d8e1e9ba776ee20000d5a39b46ce2c25af (patch) | |
tree | 423e880fb98d221db033127d51917942854c7b92 /src/tools/clangrefactoringbackend/source/symbolindexer.cpp | |
parent | a334650953880e29219e28bda89b4136875f3dc2 (diff) | |
download | qt-creator-4e6d09d8e1e9ba776ee20000d5a39b46ce2c25af.tar.gz |
Clang: Reuse thread based pipeline for pch creation
The pch creation so far used signal and slots but there was no explicit
pipeline. This patch is introducing the same architecture like the
refactoring plugin. It is filtering out older project parts from the
pipeline.
Change-Id: Iaa6bd2ca1272231b97ebe1f5f7b2ce8e43bc590c
Task-number: QTCREATORBUG-21111
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/tools/clangrefactoringbackend/source/symbolindexer.cpp')
-rw-r--r-- | src/tools/clangrefactoringbackend/source/symbolindexer.cpp | 46 |
1 files changed, 21 insertions, 25 deletions
diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp index 5c9f0cbccc..272e89fa89 100644 --- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp +++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp @@ -101,27 +101,25 @@ void SymbolIndexer::updateProjectPart(V2::ProjectPartContainer &&projectPart) std::vector<SymbolIndexerTask> symbolIndexerTask; symbolIndexerTask.reserve(projectPart.sourcePathIds.size()); for (FilePathId sourcePathId : projectPart.sourcePathIds) { - auto indexing = [projectPartId, arguments, sourcePathId] - (SymbolsCollectorInterface &symbolsCollector, - SymbolStorageInterface &symbolStorage, - Sqlite::TransactionInterface &transactionInterface) { + auto indexing = [projectPartId, arguments, sourcePathId, this] + (SymbolsCollectorInterface &symbolsCollector) { symbolsCollector.setFile(sourcePathId, arguments); symbolsCollector.collectSymbols(); - Sqlite::ImmediateTransaction transaction{transactionInterface}; + Sqlite::ImmediateTransaction transaction{m_transactionInterface}; - symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(), - symbolsCollector.sourceLocations()); + m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(), + symbolsCollector.sourceLocations()); - symbolStorage.updateProjectPartSources(projectPartId, - symbolsCollector.sourceFiles()); + m_symbolStorage.updateProjectPartSources(projectPartId, + symbolsCollector.sourceFiles()); - symbolStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros()); + m_symbolStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros()); - symbolStorage.insertFileStatuses(symbolsCollector.fileStatuses()); + m_symbolStorage.insertFileStatuses(symbolsCollector.fileStatuses()); - symbolStorage.insertOrUpdateSourceDependencies(symbolsCollector.sourceDependencies()); + m_symbolStorage.insertOrUpdateSourceDependencies(symbolsCollector.sourceDependencies()); transaction.commit(); }; @@ -130,7 +128,7 @@ void SymbolIndexer::updateProjectPart(V2::ProjectPartContainer &&projectPart) } m_symbolIndexerTaskQueue.addOrUpdateTasks(std::move(symbolIndexerTask)); - m_symbolIndexerTaskQueue.processTasks(); + m_symbolIndexerTaskQueue.processEntries(); } void SymbolIndexer::pathsWithIdsChanged(const Utils::SmallStringVector &) @@ -146,7 +144,7 @@ void SymbolIndexer::pathsChanged(const FilePathIds &filePathIds) updateChangedPath(filePathId, symbolIndexerTask); m_symbolIndexerTaskQueue.addOrUpdateTasks(std::move(symbolIndexerTask)); - m_symbolIndexerTaskQueue.processTasks(); + m_symbolIndexerTaskQueue.processEntries(); } void SymbolIndexer::updateChangedPath(FilePathId filePathId, @@ -169,26 +167,24 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId, const Utils::SmallStringVector arguments = compilerArguments(artefact.compilerArguments, optionalProjectPartPch); - auto indexing = [projectPartId=artefact.projectPartId, arguments, filePathId] - (SymbolsCollectorInterface &symbolsCollector, - SymbolStorageInterface &symbolStorage, - Sqlite::TransactionInterface &transactionInterface) { + auto indexing = [projectPartId=artefact.projectPartId, arguments, filePathId, this] + (SymbolsCollectorInterface &symbolsCollector) { symbolsCollector.setFile(filePathId, arguments); symbolsCollector.collectSymbols(); - Sqlite::ImmediateTransaction transaction{transactionInterface}; + Sqlite::ImmediateTransaction transaction{m_transactionInterface}; - symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(), - symbolsCollector.sourceLocations()); + m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(), + symbolsCollector.sourceLocations()); - symbolStorage.updateProjectPartSources(projectPartId, symbolsCollector.sourceFiles()); + m_symbolStorage.updateProjectPartSources(projectPartId, symbolsCollector.sourceFiles()); - symbolStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros()); + m_symbolStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros()); - symbolStorage.insertFileStatuses(symbolsCollector.fileStatuses()); + m_symbolStorage.insertFileStatuses(symbolsCollector.fileStatuses()); - symbolStorage.insertOrUpdateSourceDependencies(symbolsCollector.sourceDependencies()); + m_symbolStorage.insertOrUpdateSourceDependencies(symbolsCollector.sourceDependencies()); transaction.commit(); }; |