summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-07-24 16:13:10 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-08-27 11:48:54 +0000
commitcdda56494605035ecca52747c221c32ff75c8b23 (patch)
tree3cbd999d061f2635444b1f272c66a1292d93fcbd /src/tools
parentac2276004392f83e6f3b3eba9bf0aced5f08e0a5 (diff)
downloadqt-creator-cdda56494605035ecca52747c221c32ff75c8b23.tar.gz
Clang: Set indexing time stamp by dependent sources
Instead of using the time stamp from clang we simply set one time stamp for all dependent sources. Change-Id: I0adbe59d46c88ddd1ac491a7f7db568bcf2ac540 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h9
-rw-r--r--src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h4
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolindexer.cpp54
3 files changed, 53 insertions, 14 deletions
diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h
index da07808440..aac518af5a 100644
--- a/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h
+++ b/src/tools/clangpchmanagerbackend/source/builddependenciesstorage.h
@@ -177,11 +177,12 @@ public:
}
}
- void insertOrUpdateIndexingTimeStamps(const FileStatuses &fileStatuses) override
+ void insertOrUpdateIndexingTimeStampsWithoutTransaction(const FilePathIds &filePathIds,
+ TimeStamp indexingTimeStamp) override
{
- for (FileStatus fileStatus : fileStatuses) {
- inserOrUpdateIndexingTimesStampStatement.write(fileStatus.filePathId.filePathId,
- fileStatus.lastModified);
+ for (FilePathId filePathId : filePathIds) {
+ inserOrUpdateIndexingTimesStampStatement.write(filePathId.filePathId,
+ indexingTimeStamp.value);
}
}
diff --git a/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h b/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h
index 953f2cca42..c4d102246e 100644
--- a/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h
+++ b/src/tools/clangpchmanagerbackend/source/builddependenciesstorageinterface.h
@@ -59,7 +59,9 @@ public:
virtual FilePathIds fetchPchSources(ProjectPartId projectPartId) const = 0;
virtual FilePathIds fetchSources(ProjectPartId projectPartId) const = 0;
virtual void insertOrUpdateIndexingTimeStamps(const FilePathIds &filePathIds, TimeStamp indexingTimeStamp) = 0;
- virtual void insertOrUpdateIndexingTimeStamps(const FileStatuses &fileStatuses) = 0;
+ virtual void insertOrUpdateIndexingTimeStampsWithoutTransaction(const FilePathIds &filePathIds,
+ TimeStamp indexingTimeStamp)
+ = 0;
virtual SourceTimeStamps fetchIndexingTimeStamps() const = 0;
virtual SourceTimeStamps fetchIncludedIndexingTimeStamps(FilePathId sourcePathId) const = 0;
virtual FilePathIds fetchDependentSourceIds(const FilePathIds &sourcePathIds) const = 0;
diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
index e3af925464..fb53a9d3a0 100644
--- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
+++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
@@ -92,21 +92,40 @@ void SymbolIndexer::updateProjectParts(ProjectPartContainers &&projectParts)
}
namespace {
+
void store(SymbolStorageInterface &symbolStorage,
BuildDependenciesStorageInterface &buildDependencyStorage,
Sqlite::TransactionInterface &transactionInterface,
- SymbolsCollectorInterface &symbolsCollector)
+ SymbolsCollectorInterface &symbolsCollector,
+ const FilePathIds &dependentSources)
{
try {
+ long long now = std::chrono::duration_cast<std::chrono::seconds>(
+ std::chrono::system_clock::now().time_since_epoch())
+ .count();
+
Sqlite::ImmediateTransaction transaction{transactionInterface};
- buildDependencyStorage.insertOrUpdateIndexingTimeStamps(symbolsCollector.fileStatuses());
+ buildDependencyStorage.insertOrUpdateIndexingTimeStampsWithoutTransaction(dependentSources,
+ now);
+
symbolStorage.addSymbolsAndSourceLocations(symbolsCollector.symbols(),
symbolsCollector.sourceLocations());
transaction.commit();
} catch (const Sqlite::StatementIsBusy &) {
- store(symbolStorage, buildDependencyStorage, transactionInterface, symbolsCollector);
+ store(symbolStorage,
+ buildDependencyStorage,
+ transactionInterface,
+ symbolsCollector,
+ dependentSources);
}
}
+
+FilePathIds toFilePathIds(const SourceTimeStamps &sourceTimeStamps)
+{
+ return Utils::transform<FilePathIds>(sourceTimeStamps, [](SourceTimeStamp sourceTimeStamp) {
+ return sourceTimeStamp.sourceId;
+ });
+}
} // namespace
void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
@@ -124,6 +143,7 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
auto indexing = [projectPart,
sourcePathId,
preIncludeSearchPath = m_environment.preIncludeSearchPath(),
+ dependentSources = toFilePathIds(dependentTimeStamps),
this](SymbolsCollectorInterface &symbolsCollector) {
auto collect = [&](const FilePath &pchPath) {
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
@@ -147,17 +167,20 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
store(m_symbolStorage,
m_buildDependencyStorage,
m_transactionInterface,
- symbolsCollector);
+ symbolsCollector,
+ dependentSources);
} else if (pchPaths.systemPchPath.size() && collect(pchPaths.systemPchPath)) {
store(m_symbolStorage,
m_buildDependencyStorage,
m_transactionInterface,
- symbolsCollector);
+ symbolsCollector,
+ dependentSources);
} else if (collect({})) {
store(m_symbolStorage,
m_buildDependencyStorage,
m_transactionInterface,
- symbolsCollector);
+ symbolsCollector,
+ dependentSources);
}
};
@@ -196,6 +219,7 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
auto indexing = [optionalArtefact = std::move(optionalArtefact),
filePathId,
preIncludeSearchPath = m_environment.preIncludeSearchPath(),
+ dependentSources = toFilePathIds(dependentTimeStamps),
this](SymbolsCollectorInterface &symbolsCollector) {
auto collect = [&](const FilePath &pchPath) {
const ProjectPartArtefact &artefact = *optionalArtefact;
@@ -218,11 +242,23 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
optionalArtefact->projectPartId);
if (pchPaths.projectPchPath.size() && collect(pchPaths.projectPchPath)) {
- store(m_symbolStorage, m_buildDependencyStorage, m_transactionInterface, symbolsCollector);
+ store(m_symbolStorage,
+ m_buildDependencyStorage,
+ m_transactionInterface,
+ symbolsCollector,
+ dependentSources);
} else if (pchPaths.systemPchPath.size() && collect(pchPaths.systemPchPath)) {
- store(m_symbolStorage, m_buildDependencyStorage, m_transactionInterface, symbolsCollector);
+ store(m_symbolStorage,
+ m_buildDependencyStorage,
+ m_transactionInterface,
+ symbolsCollector,
+ dependentSources);
} else if (collect({})) {
- store(m_symbolStorage, m_buildDependencyStorage, m_transactionInterface, symbolsCollector);
+ store(m_symbolStorage,
+ m_buildDependencyStorage,
+ m_transactionInterface,
+ symbolsCollector,
+ dependentSources);
}
};