Clang: Move fetchPrecompiledHeader to PrecompiledHeaderStorage

It went for historical reasons in the symbol storage.

Change-Id: If05edb868901884f3951d0eb2f152566e99b4d1a
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2019-02-22 16:44:40 +01:00
parent 211aef94e6
commit 2358415b58
12 changed files with 80 additions and 64 deletions

View File

@@ -60,18 +60,20 @@ private:
SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
SymbolStorageInterface &symbolStorage,
BuildDependenciesStorageInterface &usedMacroAndSourceStorage,
BuildDependenciesStorageInterface &buildDependenciesStorage,
PrecompiledHeaderStorageInterface &precompiledHeaderStorage,
ClangPathWatcherInterface &pathWatcher,
FilePathCachingInterface &filePathCache,
FileStatusCache &fileStatusCache,
Sqlite::TransactionInterface &transactionInterface)
: m_symbolIndexerTaskQueue(symbolIndexerTaskQueue),
m_symbolStorage(symbolStorage),
m_buildDependencyStorage(usedMacroAndSourceStorage),
m_pathWatcher(pathWatcher),
m_filePathCache(filePathCache),
m_fileStatusCache(fileStatusCache),
m_transactionInterface(transactionInterface)
: m_symbolIndexerTaskQueue(symbolIndexerTaskQueue)
, m_symbolStorage(symbolStorage)
, m_buildDependencyStorage(buildDependenciesStorage)
, m_precompiledHeaderStorage(precompiledHeaderStorage)
, m_pathWatcher(pathWatcher)
, m_filePathCache(filePathCache)
, m_fileStatusCache(fileStatusCache)
, m_transactionInterface(transactionInterface)
{
pathWatcher.setNotifier(this);
}
@@ -97,7 +99,8 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
projectPart.languageExtension);
if (optionalArtefact)
projectPartId = optionalArtefact->projectPartId;
const Utils::optional<ProjectPartPch> optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader(projectPartId);
const Utils::optional<ProjectPartPch> optionalProjectPartPch
= m_precompiledHeaderStorage.fetchPrecompiledHeader(projectPartId);
FilePathIds sourcePathIds = updatableFilePathIds(projectPart, optionalArtefact);
transaction.commit();
@@ -179,8 +182,8 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
if (!optionalArtefact)
return;
const Utils::optional<ProjectPartPch> optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader(
optionalArtefact->projectPartId);
const Utils::optional<ProjectPartPch> optionalProjectPartPch
= m_precompiledHeaderStorage.fetchPrecompiledHeader(optionalArtefact->projectPartId);
transaction.commit();
const ProjectPartArtefact &artefact = optionalArtefact.value();

View File

@@ -31,6 +31,7 @@
#include "builddependenciesstorageinterface.h"
#include "clangpathwatcher.h"
#include <precompiledheaderstorageinterface.h>
#include <projectpartcontainer.h>
#include <filecontainerv2.h>
@@ -43,7 +44,8 @@ class SymbolIndexer final : public ClangPathWatcherNotifier
public:
SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
SymbolStorageInterface &symbolStorage,
BuildDependenciesStorageInterface &usedMacroAndSourceStorage,
BuildDependenciesStorageInterface &buildDependenciesStorage,
PrecompiledHeaderStorageInterface &precompiledHeaderStorage,
ClangPathWatcherInterface &pathWatcher,
FilePathCachingInterface &filePathCache,
FileStatusCache &fileStatusCache,
@@ -71,6 +73,7 @@ private:
SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue;
SymbolStorageInterface &m_symbolStorage;
BuildDependenciesStorageInterface &m_buildDependencyStorage;
PrecompiledHeaderStorageInterface &m_precompiledHeaderStorage;
ClangPathWatcherInterface &m_pathWatcher;
FilePathCachingInterface &m_filePathCache;
FileStatusCache &m_fileStatusCache;

View File

@@ -35,6 +35,7 @@
#include "symbolstorage.h"
#include <builddependenciesstorage.h>
#include <precompiledheaderstorage.h>
#include <refactoringdatabaseinitializer.h>
#include <filepathcachingfwd.h>
@@ -83,6 +84,7 @@ public:
ProgressCounter::SetProgressCallback &&setProgressCallback)
: m_filePathCache(filePathCache)
, m_buildDependencyStorage(database)
, m_recompiledHeaderStorage(database)
, m_symbolStorage(database)
, m_collectorManger(generatedFiles, database)
, m_progressCounter(std::move(setProgressCallback))
@@ -119,6 +121,7 @@ private:
using SymbolIndexerTaskScheduler = TaskScheduler<SymbolsCollectorManager, SymbolIndexerTask::Callable>;
FilePathCachingInterface &m_filePathCache;
BuildDependenciesStorage m_buildDependencyStorage;
PrecompiledHeaderStorage<Sqlite::Database> m_recompiledHeaderStorage;
SymbolStorage m_symbolStorage;
ClangPathWatcher<QFileSystemWatcher, QTimer> m_sourceWatcher{m_filePathCache};
FileStatusCache m_fileStatusCache{m_filePathCache};
@@ -127,6 +130,7 @@ private:
SymbolIndexer m_indexer{m_indexerQueue,
m_symbolStorage,
m_buildDependencyStorage,
m_recompiledHeaderStorage,
m_sourceWatcher,
m_filePathCache,
m_fileStatusCache,

View File

@@ -223,11 +223,6 @@ public:
m_deleteNewLocationsTableStatement.execute();
}
Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const
{
return m_getPrecompiledHeader.template value<ProjectPartPch, 2>(projectPartId);
}
SourceLocationEntries sourceLocations() const
{
return SourceLocationEntries();
@@ -350,10 +345,6 @@ public:
"projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension "
"FROM projectParts WHERE projectPartName = ?",
m_database};
mutable ReadStatement m_getPrecompiledHeader{
"SELECT projectPchPath, projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?",
m_database
};
};
} // namespace ClangBackEnd

View File

@@ -27,7 +27,6 @@
#include "filestatus.h"
#include "projectpartentry.h"
#include "projectpartpch.h"
#include "projectpartartefact.h"
#include "sourcelocationentry.h"
#include "sourcedependency.h"
@@ -67,7 +66,6 @@ public:
FilePathId sourceId) const = 0;
virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(
Utils::SmallStringView projectPartName) const = 0;
virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
protected:
~SymbolStorageInterface() = default;