ClangRefactoring: Move transaction in fetchPrecompiledHeader

Prepare the move of fetchPrecompiledHeader in the lambda to execute it in
the thread.

Change-Id: I00f906196dabfdb5cd38f4b9752d92678236b849
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2019-04-10 18:21:22 +02:00
parent 3fc8217113
commit 16d5bf0afc
4 changed files with 35 additions and 19 deletions

View File

@@ -90,13 +90,9 @@ void SymbolIndexer::updateProjectParts(ProjectPartContainers &&projectParts)
void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
{
Sqlite::DeferredTransaction transaction{m_transactionInterface};
ProjectPartId projectPartId = projectPart.projectPartId;
const FilePath pchPath = m_precompiledHeaderStorage.fetchPrecompiledHeader(projectPartId);
transaction.commit();
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
Builder commandLineBuilder{
projectPart, projectPart.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
@@ -157,17 +153,16 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
optionalArtefact = m_projectPartsStorage.fetchProjectPartArtefact(filePathId);
if (!optionalArtefact)
return;
transaction.commit();
const FilePath pchPath = m_precompiledHeaderStorage.fetchPrecompiledHeader(
optionalArtefact->projectPartId);
transaction.commit();
SourceTimeStamps dependentTimeStamps = m_symbolStorage.fetchIncludedIndexingTimeStamps(filePathId);
const ProjectPartArtefact &artefact = *optionalArtefact;
CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector>
builder{artefact, artefact.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector> builder{
artefact, artefact.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
auto indexing = [arguments = builder.commandLine, filePathId, this](
SymbolsCollectorInterface &symbolsCollector) {