From 4e6d09d8e1e9ba776ee20000d5a39b46ce2c25af Mon Sep 17 00:00:00 2001 From: Marco Bubke Date: Tue, 11 Sep 2018 17:02:45 +0200 Subject: 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 --- .../source/symbolindexer.cpp | 46 ++++++++++------------ 1 file changed, 21 insertions(+), 25 deletions(-) (limited to 'src/tools/clangrefactoringbackend/source/symbolindexer.cpp') 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.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(); }; -- cgit v1.2.1