summaryrefslogtreecommitdiff
path: root/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
diff options
context:
space:
mode:
authorOrgad Shaneh <orgad.shaneh@audiocodes.com>2019-02-15 13:42:44 +0200
committerOrgad Shaneh <orgad.shaneh@audiocodes.com>2019-02-15 13:42:44 +0200
commit6fc532f812f62b7206ec5e958d251f7389cd6ecf (patch)
tree285bab3ac533c84a77dc173b195e8af4d8435869 /src/tools/clangrefactoringbackend/source/symbolindexer.cpp
parent72d962e949564fc963f91e1b48350a091aea1bb2 (diff)
parent603191ba77852b64e5438c339bc39fcdc608cfb8 (diff)
downloadqt-creator-6fc532f812f62b7206ec5e958d251f7389cd6ecf.tar.gz
Merge remote-tracking branch 'origin/4.9'
Change-Id: If4e8f52fc94c4e5fd9ec69c9000436d4ded913ff
Diffstat (limited to 'src/tools/clangrefactoringbackend/source/symbolindexer.cpp')
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolindexer.cpp62
1 files changed, 36 insertions, 26 deletions
diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
index 2ee454eadb..2b4e90cf5a 100644
--- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
+++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
@@ -107,6 +107,7 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
Builder commandLineBuilder{projectPart,
projectPart.toolChainArguments,
+ InputFileType::Source,
{},
{},
optionalProjectPartPch
@@ -116,27 +117,32 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
std::vector<SymbolIndexerTask> symbolIndexerTask;
symbolIndexerTask.reserve(projectPart.sourcePathIds.size());
for (FilePathId sourcePathId : projectPart.sourcePathIds) {
- auto indexing = [projectPartId, arguments = commandLineBuilder.commandLine, sourcePathId, this](
- SymbolsCollectorInterface &symbolsCollector) {
+ auto indexing = [projectPartId,
+ arguments = commandLineBuilder.commandLine,
+ sourcePathId,
+ this](SymbolsCollectorInterface &symbolsCollector) {
symbolsCollector.setFile(sourcePathId, arguments);
- symbolsCollector.collectSymbols();
+ bool success = symbolsCollector.collectSymbols();
- Sqlite::ImmediateTransaction transaction{m_transactionInterface};
+ if (success) {
+ Sqlite::ImmediateTransaction transaction{m_transactionInterface};
- m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
- symbolsCollector.sourceLocations());
+ m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
+ symbolsCollector.sourceLocations());
- m_symbolStorage.updateProjectPartSources(projectPartId, symbolsCollector.sourceFiles());
+ m_symbolStorage.updateProjectPartSources(projectPartId,
+ symbolsCollector.sourceFiles());
- m_buildDependencyStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros());
+ m_buildDependencyStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros());
- m_buildDependencyStorage.insertFileStatuses(symbolsCollector.fileStatuses());
+ m_buildDependencyStorage.insertFileStatuses(symbolsCollector.fileStatuses());
- m_buildDependencyStorage.insertOrUpdateSourceDependencies(
- symbolsCollector.sourceDependencies());
+ m_buildDependencyStorage.insertOrUpdateSourceDependencies(
+ symbolsCollector.sourceDependencies());
- transaction.commit();
+ transaction.commit();
+ }
};
symbolIndexerTask.emplace_back(sourcePathId, projectPartId, std::move(indexing));
@@ -181,30 +187,34 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
auto pchPath = optionalProjectPartPch ? optionalProjectPartPch.value().pchPath : FilePath{};
- CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector> builder{
- artefact, artefact.toolChainArguments, {}, {}, pchPath};
+ CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector>
+ builder{artefact, artefact.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
- auto indexing = [projectPartId = artefact.projectPartId, arguments=builder.commandLine, filePathId, this](
- SymbolsCollectorInterface &symbolsCollector) {
+ auto indexing = [projectPartId = artefact.projectPartId,
+ arguments = builder.commandLine,
+ filePathId,
+ this](SymbolsCollectorInterface &symbolsCollector) {
symbolsCollector.setFile(filePathId, arguments);
- symbolsCollector.collectSymbols();
+ bool success = symbolsCollector.collectSymbols();
- Sqlite::ImmediateTransaction transaction{m_transactionInterface};
+ if (success) {
+ Sqlite::ImmediateTransaction transaction{m_transactionInterface};
- m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
- symbolsCollector.sourceLocations());
+ m_symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
+ symbolsCollector.sourceLocations());
- m_symbolStorage.updateProjectPartSources(projectPartId, symbolsCollector.sourceFiles());
+ m_symbolStorage.updateProjectPartSources(projectPartId, symbolsCollector.sourceFiles());
- m_buildDependencyStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros());
+ m_buildDependencyStorage.insertOrUpdateUsedMacros(symbolsCollector.usedMacros());
- m_buildDependencyStorage.insertFileStatuses(symbolsCollector.fileStatuses());
+ m_buildDependencyStorage.insertFileStatuses(symbolsCollector.fileStatuses());
- m_buildDependencyStorage.insertOrUpdateSourceDependencies(
- symbolsCollector.sourceDependencies());
+ m_buildDependencyStorage.insertOrUpdateSourceDependencies(
+ symbolsCollector.sourceDependencies());
- transaction.commit();
+ transaction.commit();
+ }
};
symbolIndexerTask.emplace_back(filePathId, optionalArtefact->projectPartId, std::move(indexing));