forked from qt-creator/qt-creator
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:
@@ -126,6 +126,11 @@ public:
|
|||||||
return FilePath("");
|
return FilePath("");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const
|
||||||
|
{
|
||||||
|
return m_getPrecompiledHeader.template value<ProjectPartPch, 2>(projectPartId);
|
||||||
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
Sqlite::ImmediateNonThrowingDestructorTransaction m_transaction;
|
Sqlite::ImmediateNonThrowingDestructorTransaction m_transaction;
|
||||||
Database &m_database;
|
Database &m_database;
|
||||||
@@ -155,6 +160,9 @@ public:
|
|||||||
"SELECT systemPchPath FROM precompiledHeaders WHERE projectPartId = (SELECT projectPartId "
|
"SELECT systemPchPath FROM precompiledHeaders WHERE projectPartId = (SELECT projectPartId "
|
||||||
"FROM projectParts WHERE projectPartName = ?)",
|
"FROM projectParts WHERE projectPartName = ?)",
|
||||||
m_database};
|
m_database};
|
||||||
|
mutable ReadStatement m_getPrecompiledHeader{"SELECT projectPchPath, projectPchBuildTime FROM "
|
||||||
|
"precompiledHeaders WHERE projectPartId = ?",
|
||||||
|
m_database};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@@ -25,9 +25,12 @@
|
|||||||
|
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
|
#include "projectpartpch.h"
|
||||||
|
|
||||||
#include <filepath.h>
|
#include <filepath.h>
|
||||||
|
|
||||||
#include <utils/smallstringvector.h>
|
#include <utils/smallstringvector.h>
|
||||||
|
#include <utils/optional.h>
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
namespace ClangBackEnd {
|
||||||
|
|
||||||
@@ -50,6 +53,7 @@ public:
|
|||||||
= 0;
|
= 0;
|
||||||
virtual void deleteSystemPrecompiledHeaders(const Utils::SmallStringVector &projectPartNames) = 0;
|
virtual void deleteSystemPrecompiledHeaders(const Utils::SmallStringVector &projectPartNames) = 0;
|
||||||
virtual FilePath fetchSystemPrecompiledHeaderPath(Utils::SmallStringView projectPartName) = 0;
|
virtual FilePath fetchSystemPrecompiledHeaderPath(Utils::SmallStringView projectPartName) = 0;
|
||||||
|
virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~PrecompiledHeaderStorageInterface() = default;
|
~PrecompiledHeaderStorageInterface() = default;
|
||||||
|
@@ -60,18 +60,20 @@ private:
|
|||||||
|
|
||||||
SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
|
SymbolIndexer::SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
|
||||||
SymbolStorageInterface &symbolStorage,
|
SymbolStorageInterface &symbolStorage,
|
||||||
BuildDependenciesStorageInterface &usedMacroAndSourceStorage,
|
BuildDependenciesStorageInterface &buildDependenciesStorage,
|
||||||
|
PrecompiledHeaderStorageInterface &precompiledHeaderStorage,
|
||||||
ClangPathWatcherInterface &pathWatcher,
|
ClangPathWatcherInterface &pathWatcher,
|
||||||
FilePathCachingInterface &filePathCache,
|
FilePathCachingInterface &filePathCache,
|
||||||
FileStatusCache &fileStatusCache,
|
FileStatusCache &fileStatusCache,
|
||||||
Sqlite::TransactionInterface &transactionInterface)
|
Sqlite::TransactionInterface &transactionInterface)
|
||||||
: m_symbolIndexerTaskQueue(symbolIndexerTaskQueue),
|
: m_symbolIndexerTaskQueue(symbolIndexerTaskQueue)
|
||||||
m_symbolStorage(symbolStorage),
|
, m_symbolStorage(symbolStorage)
|
||||||
m_buildDependencyStorage(usedMacroAndSourceStorage),
|
, m_buildDependencyStorage(buildDependenciesStorage)
|
||||||
m_pathWatcher(pathWatcher),
|
, m_precompiledHeaderStorage(precompiledHeaderStorage)
|
||||||
m_filePathCache(filePathCache),
|
, m_pathWatcher(pathWatcher)
|
||||||
m_fileStatusCache(fileStatusCache),
|
, m_filePathCache(filePathCache)
|
||||||
m_transactionInterface(transactionInterface)
|
, m_fileStatusCache(fileStatusCache)
|
||||||
|
, m_transactionInterface(transactionInterface)
|
||||||
{
|
{
|
||||||
pathWatcher.setNotifier(this);
|
pathWatcher.setNotifier(this);
|
||||||
}
|
}
|
||||||
@@ -97,7 +99,8 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
|
|||||||
projectPart.languageExtension);
|
projectPart.languageExtension);
|
||||||
if (optionalArtefact)
|
if (optionalArtefact)
|
||||||
projectPartId = optionalArtefact->projectPartId;
|
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);
|
FilePathIds sourcePathIds = updatableFilePathIds(projectPart, optionalArtefact);
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
@@ -179,8 +182,8 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
|
|||||||
if (!optionalArtefact)
|
if (!optionalArtefact)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
const Utils::optional<ProjectPartPch> optionalProjectPartPch = m_symbolStorage.fetchPrecompiledHeader(
|
const Utils::optional<ProjectPartPch> optionalProjectPartPch
|
||||||
optionalArtefact->projectPartId);
|
= m_precompiledHeaderStorage.fetchPrecompiledHeader(optionalArtefact->projectPartId);
|
||||||
transaction.commit();
|
transaction.commit();
|
||||||
|
|
||||||
const ProjectPartArtefact &artefact = optionalArtefact.value();
|
const ProjectPartArtefact &artefact = optionalArtefact.value();
|
||||||
|
@@ -31,6 +31,7 @@
|
|||||||
#include "builddependenciesstorageinterface.h"
|
#include "builddependenciesstorageinterface.h"
|
||||||
#include "clangpathwatcher.h"
|
#include "clangpathwatcher.h"
|
||||||
|
|
||||||
|
#include <precompiledheaderstorageinterface.h>
|
||||||
#include <projectpartcontainer.h>
|
#include <projectpartcontainer.h>
|
||||||
#include <filecontainerv2.h>
|
#include <filecontainerv2.h>
|
||||||
|
|
||||||
@@ -43,7 +44,8 @@ class SymbolIndexer final : public ClangPathWatcherNotifier
|
|||||||
public:
|
public:
|
||||||
SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
|
SymbolIndexer(SymbolIndexerTaskQueueInterface &symbolIndexerTaskQueue,
|
||||||
SymbolStorageInterface &symbolStorage,
|
SymbolStorageInterface &symbolStorage,
|
||||||
BuildDependenciesStorageInterface &usedMacroAndSourceStorage,
|
BuildDependenciesStorageInterface &buildDependenciesStorage,
|
||||||
|
PrecompiledHeaderStorageInterface &precompiledHeaderStorage,
|
||||||
ClangPathWatcherInterface &pathWatcher,
|
ClangPathWatcherInterface &pathWatcher,
|
||||||
FilePathCachingInterface &filePathCache,
|
FilePathCachingInterface &filePathCache,
|
||||||
FileStatusCache &fileStatusCache,
|
FileStatusCache &fileStatusCache,
|
||||||
@@ -71,6 +73,7 @@ private:
|
|||||||
SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue;
|
SymbolIndexerTaskQueueInterface &m_symbolIndexerTaskQueue;
|
||||||
SymbolStorageInterface &m_symbolStorage;
|
SymbolStorageInterface &m_symbolStorage;
|
||||||
BuildDependenciesStorageInterface &m_buildDependencyStorage;
|
BuildDependenciesStorageInterface &m_buildDependencyStorage;
|
||||||
|
PrecompiledHeaderStorageInterface &m_precompiledHeaderStorage;
|
||||||
ClangPathWatcherInterface &m_pathWatcher;
|
ClangPathWatcherInterface &m_pathWatcher;
|
||||||
FilePathCachingInterface &m_filePathCache;
|
FilePathCachingInterface &m_filePathCache;
|
||||||
FileStatusCache &m_fileStatusCache;
|
FileStatusCache &m_fileStatusCache;
|
||||||
|
@@ -35,6 +35,7 @@
|
|||||||
#include "symbolstorage.h"
|
#include "symbolstorage.h"
|
||||||
|
|
||||||
#include <builddependenciesstorage.h>
|
#include <builddependenciesstorage.h>
|
||||||
|
#include <precompiledheaderstorage.h>
|
||||||
|
|
||||||
#include <refactoringdatabaseinitializer.h>
|
#include <refactoringdatabaseinitializer.h>
|
||||||
#include <filepathcachingfwd.h>
|
#include <filepathcachingfwd.h>
|
||||||
@@ -83,6 +84,7 @@ public:
|
|||||||
ProgressCounter::SetProgressCallback &&setProgressCallback)
|
ProgressCounter::SetProgressCallback &&setProgressCallback)
|
||||||
: m_filePathCache(filePathCache)
|
: m_filePathCache(filePathCache)
|
||||||
, m_buildDependencyStorage(database)
|
, m_buildDependencyStorage(database)
|
||||||
|
, m_recompiledHeaderStorage(database)
|
||||||
, m_symbolStorage(database)
|
, m_symbolStorage(database)
|
||||||
, m_collectorManger(generatedFiles, database)
|
, m_collectorManger(generatedFiles, database)
|
||||||
, m_progressCounter(std::move(setProgressCallback))
|
, m_progressCounter(std::move(setProgressCallback))
|
||||||
@@ -119,6 +121,7 @@ private:
|
|||||||
using SymbolIndexerTaskScheduler = TaskScheduler<SymbolsCollectorManager, SymbolIndexerTask::Callable>;
|
using SymbolIndexerTaskScheduler = TaskScheduler<SymbolsCollectorManager, SymbolIndexerTask::Callable>;
|
||||||
FilePathCachingInterface &m_filePathCache;
|
FilePathCachingInterface &m_filePathCache;
|
||||||
BuildDependenciesStorage m_buildDependencyStorage;
|
BuildDependenciesStorage m_buildDependencyStorage;
|
||||||
|
PrecompiledHeaderStorage<Sqlite::Database> m_recompiledHeaderStorage;
|
||||||
SymbolStorage m_symbolStorage;
|
SymbolStorage m_symbolStorage;
|
||||||
ClangPathWatcher<QFileSystemWatcher, QTimer> m_sourceWatcher{m_filePathCache};
|
ClangPathWatcher<QFileSystemWatcher, QTimer> m_sourceWatcher{m_filePathCache};
|
||||||
FileStatusCache m_fileStatusCache{m_filePathCache};
|
FileStatusCache m_fileStatusCache{m_filePathCache};
|
||||||
@@ -127,6 +130,7 @@ private:
|
|||||||
SymbolIndexer m_indexer{m_indexerQueue,
|
SymbolIndexer m_indexer{m_indexerQueue,
|
||||||
m_symbolStorage,
|
m_symbolStorage,
|
||||||
m_buildDependencyStorage,
|
m_buildDependencyStorage,
|
||||||
|
m_recompiledHeaderStorage,
|
||||||
m_sourceWatcher,
|
m_sourceWatcher,
|
||||||
m_filePathCache,
|
m_filePathCache,
|
||||||
m_fileStatusCache,
|
m_fileStatusCache,
|
||||||
|
@@ -223,11 +223,6 @@ public:
|
|||||||
m_deleteNewLocationsTableStatement.execute();
|
m_deleteNewLocationsTableStatement.execute();
|
||||||
}
|
}
|
||||||
|
|
||||||
Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const
|
|
||||||
{
|
|
||||||
return m_getPrecompiledHeader.template value<ProjectPartPch, 2>(projectPartId);
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceLocationEntries sourceLocations() const
|
SourceLocationEntries sourceLocations() const
|
||||||
{
|
{
|
||||||
return SourceLocationEntries();
|
return SourceLocationEntries();
|
||||||
@@ -350,10 +345,6 @@ public:
|
|||||||
"projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension "
|
"projectIncludeSearchPaths, projectPartId, language, languageVersion, languageExtension "
|
||||||
"FROM projectParts WHERE projectPartName = ?",
|
"FROM projectParts WHERE projectPartName = ?",
|
||||||
m_database};
|
m_database};
|
||||||
mutable ReadStatement m_getPrecompiledHeader{
|
|
||||||
"SELECT projectPchPath, projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?",
|
|
||||||
m_database
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
} // namespace ClangBackEnd
|
||||||
|
@@ -27,7 +27,6 @@
|
|||||||
|
|
||||||
#include "filestatus.h"
|
#include "filestatus.h"
|
||||||
#include "projectpartentry.h"
|
#include "projectpartentry.h"
|
||||||
#include "projectpartpch.h"
|
|
||||||
#include "projectpartartefact.h"
|
#include "projectpartartefact.h"
|
||||||
#include "sourcelocationentry.h"
|
#include "sourcelocationentry.h"
|
||||||
#include "sourcedependency.h"
|
#include "sourcedependency.h"
|
||||||
@@ -67,7 +66,6 @@ public:
|
|||||||
FilePathId sourceId) const = 0;
|
FilePathId sourceId) const = 0;
|
||||||
virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(
|
virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(
|
||||||
Utils::SmallStringView projectPartName) const = 0;
|
Utils::SmallStringView projectPartName) const = 0;
|
||||||
virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
~SymbolStorageInterface() = default;
|
~SymbolStorageInterface() = default;
|
||||||
|
@@ -45,4 +45,6 @@ public:
|
|||||||
void(const Utils::SmallStringVector &projectPartNames));
|
void(const Utils::SmallStringVector &projectPartNames));
|
||||||
MOCK_METHOD1(fetchSystemPrecompiledHeaderPath,
|
MOCK_METHOD1(fetchSystemPrecompiledHeaderPath,
|
||||||
ClangBackEnd::FilePath(Utils::SmallStringView projectPartName));
|
ClangBackEnd::FilePath(Utils::SmallStringView projectPartName));
|
||||||
|
MOCK_CONST_METHOD1(fetchPrecompiledHeader,
|
||||||
|
Utils::optional<ClangBackEnd::ProjectPartPch>(int projectPartId));
|
||||||
};
|
};
|
||||||
|
@@ -53,6 +53,4 @@ public:
|
|||||||
Utils::optional<ClangBackEnd::ProjectPartArtefact> (ClangBackEnd::FilePathId sourceId));
|
Utils::optional<ClangBackEnd::ProjectPartArtefact> (ClangBackEnd::FilePathId sourceId));
|
||||||
MOCK_CONST_METHOD1(fetchProjectPartArtefact,
|
MOCK_CONST_METHOD1(fetchProjectPartArtefact,
|
||||||
Utils::optional<ClangBackEnd::ProjectPartArtefact> (Utils::SmallStringView projectPartName));
|
Utils::optional<ClangBackEnd::ProjectPartArtefact> (Utils::SmallStringView projectPartName));
|
||||||
MOCK_CONST_METHOD1(fetchPrecompiledHeader,
|
|
||||||
Utils::optional<ClangBackEnd::ProjectPartPch> (int projectPartId));
|
|
||||||
};
|
};
|
||||||
|
@@ -43,16 +43,12 @@ protected:
|
|||||||
NiceMock<MockSqliteDatabase> database;
|
NiceMock<MockSqliteDatabase> database;
|
||||||
Storage storage{database};
|
Storage storage{database};
|
||||||
MockSqliteWriteStatement &insertProjectPartStatement = storage.m_insertProjectPartStatement;
|
MockSqliteWriteStatement &insertProjectPartStatement = storage.m_insertProjectPartStatement;
|
||||||
MockSqliteWriteStatement &insertProjectPrecompiledHeaderStatement
|
MockSqliteWriteStatement &insertProjectPrecompiledHeaderStatement = storage.m_insertProjectPrecompiledHeaderStatement;
|
||||||
= storage.m_insertProjectPrecompiledHeaderStatement;
|
MockSqliteWriteStatement &deleteProjectPrecompiledHeaderStatement = storage.m_deleteProjectPrecompiledHeaderStatement;
|
||||||
MockSqliteWriteStatement &deleteProjectPrecompiledHeaderStatement
|
MockSqliteWriteStatement &insertSystemPrecompiledHeaderStatement = storage.m_insertSystemPrecompiledHeaderStatement;
|
||||||
= storage.m_deleteProjectPrecompiledHeaderStatement;
|
MockSqliteWriteStatement &deleteSystemPrecompiledHeaderStatement = storage.m_deleteSystemPrecompiledHeaderStatement;
|
||||||
MockSqliteWriteStatement &insertSystemPrecompiledHeaderStatement
|
MockSqliteReadStatement &fetchSystemPrecompiledHeaderPathStatement = storage.m_fetchSystemPrecompiledHeaderPathStatement;
|
||||||
= storage.m_insertSystemPrecompiledHeaderStatement;
|
MockSqliteReadStatement &getPrecompiledHeader = storage.m_getPrecompiledHeader;
|
||||||
MockSqliteWriteStatement &deleteSystemPrecompiledHeaderStatement
|
|
||||||
= storage.m_deleteSystemPrecompiledHeaderStatement;
|
|
||||||
MockSqliteReadStatement &fetchSystemPrecompiledHeaderPathStatement
|
|
||||||
= storage.m_fetchSystemPrecompiledHeaderPathStatement;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
TEST_F(PrecompiledHeaderStorage, UseTransaction)
|
TEST_F(PrecompiledHeaderStorage, UseTransaction)
|
||||||
@@ -241,4 +237,21 @@ TEST_F(PrecompiledHeaderStorage, FetchSystemPrecompiledHeaderReturnsNullOptional
|
|||||||
|
|
||||||
ASSERT_THAT(path, IsEmpty());
|
ASSERT_THAT(path, IsEmpty());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TEST_F(PrecompiledHeaderStorage, FetchPrecompiledHeaderCallsValueInStatement)
|
||||||
|
{
|
||||||
|
EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25)));
|
||||||
|
|
||||||
|
storage.fetchPrecompiledHeader(25);
|
||||||
|
}
|
||||||
|
|
||||||
|
TEST_F(PrecompiledHeaderStorage, FetchPrecompiledHeader)
|
||||||
|
{
|
||||||
|
ClangBackEnd::ProjectPartPch pch{"", "/path/to/pch", 131};
|
||||||
|
EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25))).WillRepeatedly(Return(pch));
|
||||||
|
|
||||||
|
auto precompiledHeader = storage.fetchPrecompiledHeader(25);
|
||||||
|
|
||||||
|
ASSERT_THAT(precompiledHeader.value(), Eq(pch));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@@ -26,6 +26,7 @@
|
|||||||
#include "googletest.h"
|
#include "googletest.h"
|
||||||
#include "filesystem-utilities.h"
|
#include "filesystem-utilities.h"
|
||||||
#include "mockclangpathwatcher.h"
|
#include "mockclangpathwatcher.h"
|
||||||
|
#include "mockprecompiledheaderstorage.h"
|
||||||
#include "mocksymbolscollector.h"
|
#include "mocksymbolscollector.h"
|
||||||
#include "mocksymbolstorage.h"
|
#include "mocksymbolstorage.h"
|
||||||
#include "mockfilepathcaching.h"
|
#include "mockfilepathcaching.h"
|
||||||
@@ -237,6 +238,7 @@ protected:
|
|||||||
NiceMock<MockSqliteTransactionBackend> mockSqliteTransactionBackend;
|
NiceMock<MockSqliteTransactionBackend> mockSqliteTransactionBackend;
|
||||||
NiceMock<MockSymbolStorage> mockSymbolStorage;
|
NiceMock<MockSymbolStorage> mockSymbolStorage;
|
||||||
NiceMock<MockBuildDependenciesStorage> mockBuildDependenciesStorage;
|
NiceMock<MockBuildDependenciesStorage> mockBuildDependenciesStorage;
|
||||||
|
NiceMock<MockPrecompiledHeaderStorage> mockPrecompiledHeaderStorage;
|
||||||
NiceMock<MockClangPathWatcher> mockPathWatcher;
|
NiceMock<MockClangPathWatcher> mockPathWatcher;
|
||||||
ClangBackEnd::FileStatusCache fileStatusCache{filePathCache};
|
ClangBackEnd::FileStatusCache fileStatusCache{filePathCache};
|
||||||
ClangBackEnd::GeneratedFiles generatedFiles;
|
ClangBackEnd::GeneratedFiles generatedFiles;
|
||||||
@@ -246,6 +248,7 @@ protected:
|
|||||||
ClangBackEnd::SymbolIndexer indexer{indexerQueue,
|
ClangBackEnd::SymbolIndexer indexer{indexerQueue,
|
||||||
mockSymbolStorage,
|
mockSymbolStorage,
|
||||||
mockBuildDependenciesStorage,
|
mockBuildDependenciesStorage,
|
||||||
|
mockPrecompiledHeaderStorage,
|
||||||
mockPathWatcher,
|
mockPathWatcher,
|
||||||
filePathCache,
|
filePathCache,
|
||||||
fileStatusCache,
|
fileStatusCache,
|
||||||
@@ -292,7 +295,8 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesInCollector)
|
|||||||
TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithPrecompiledHeaderInCollector)
|
TEST_F(SymbolIndexer, UpdateProjectPartsCallsAddFilesWithPrecompiledHeaderInCollector)
|
||||||
{
|
{
|
||||||
ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<Utils::SmallStringView>(projectPart1.projectPartId))).WillByDefault(Return(emptyArtefact));
|
ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<Utils::SmallStringView>(projectPart1.projectPartId))).WillByDefault(Return(emptyArtefact));
|
||||||
ON_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId))).WillByDefault(Return(projectPartPch));
|
ON_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)))
|
||||||
|
.WillByDefault(Return(projectPartPch));
|
||||||
|
|
||||||
EXPECT_CALL(mockCollector,
|
EXPECT_CALL(mockCollector,
|
||||||
setFile(main1PathId,
|
setFile(main1PathId,
|
||||||
@@ -506,7 +510,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithoutProjectPartArtifact)
|
|||||||
Eq(Utils::LanguageVersion::CXX14),
|
Eq(Utils::LanguageVersion::CXX14),
|
||||||
Eq(Utils::LanguageExtension::None)))
|
Eq(Utils::LanguageExtension::None)))
|
||||||
.WillOnce(Return(12));
|
.WillOnce(Return(12));
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(12)));
|
EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(12)));
|
||||||
EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0);
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0);
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
||||||
EXPECT_CALL(mockCollector,
|
EXPECT_CALL(mockCollector,
|
||||||
@@ -559,7 +563,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderWithProjectPartArtifact)
|
|||||||
Eq(Utils::LanguageVersion::CXX14),
|
Eq(Utils::LanguageVersion::CXX14),
|
||||||
Eq(Utils::LanguageExtension::None)))
|
Eq(Utils::LanguageExtension::None)))
|
||||||
.WillOnce(Return(-1));
|
.WillOnce(Return(-1));
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)));
|
EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)));
|
||||||
EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).WillOnce(Return(-1));
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).WillOnce(Return(-1));
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
||||||
EXPECT_CALL(mockCollector,
|
EXPECT_CALL(mockCollector,
|
||||||
@@ -614,7 +618,7 @@ TEST_F(SymbolIndexer, UpdateProjectPartsCallsInOrderButGetsAnErrorForCollectingS
|
|||||||
Eq(Utils::LanguageVersion::CXX14),
|
Eq(Utils::LanguageVersion::CXX14),
|
||||||
Eq(Utils::LanguageExtension::None)))
|
Eq(Utils::LanguageExtension::None)))
|
||||||
.WillOnce(Return(12));
|
.WillOnce(Return(12));
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(12)));
|
EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(12)));
|
||||||
EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0);
|
EXPECT_CALL(mockBuildDependenciesStorage, fetchLowestLastModifiedTime(Eq(main1PathId))).Times(0);
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
||||||
EXPECT_CALL(mockCollector,
|
EXPECT_CALL(mockCollector,
|
||||||
@@ -656,7 +660,14 @@ TEST_F(SymbolIndexer, CallSetNotifier)
|
|||||||
{
|
{
|
||||||
EXPECT_CALL(mockPathWatcher, setNotifier(_));
|
EXPECT_CALL(mockPathWatcher, setNotifier(_));
|
||||||
|
|
||||||
ClangBackEnd::SymbolIndexer indexer{indexerQueue, mockSymbolStorage, mockBuildDependenciesStorage, mockPathWatcher, filePathCache, fileStatusCache, mockSqliteTransactionBackend};
|
ClangBackEnd::SymbolIndexer indexer{indexerQueue,
|
||||||
|
mockSymbolStorage,
|
||||||
|
mockBuildDependenciesStorage,
|
||||||
|
mockPrecompiledHeaderStorage,
|
||||||
|
mockPathWatcher,
|
||||||
|
filePathCache,
|
||||||
|
fileStatusCache,
|
||||||
|
mockSqliteTransactionBackend};
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolIndexer, PathChangedCallsFetchProjectPartArtefactInStorage)
|
TEST_F(SymbolIndexer, PathChangedCallsFetchProjectPartArtefactInStorage)
|
||||||
@@ -673,7 +684,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrder)
|
|||||||
|
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
|
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0]))).WillOnce(Return(artefact));
|
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0]))).WillOnce(Return(artefact));
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)));
|
EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)));
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
||||||
EXPECT_CALL(mockCollector,
|
EXPECT_CALL(mockCollector,
|
||||||
setFile(Eq(sourceFileIds[0]),
|
setFile(Eq(sourceFileIds[0]),
|
||||||
@@ -715,7 +726,7 @@ TEST_F(SymbolIndexer, HandleEmptyOptionalArtifactInUpdateChangedPath)
|
|||||||
|
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
|
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(sourceFileIds[0])).WillOnce(Return(nullArtefact));
|
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(sourceFileIds[0])).WillOnce(Return(nullArtefact));
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(_)).Times(0);
|
EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(_)).Times(0);
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, commit()).Times(0);
|
EXPECT_CALL(mockSqliteTransactionBackend, commit()).Times(0);
|
||||||
EXPECT_CALL(mockCollector, setFile(_, _)).Times(0);
|
EXPECT_CALL(mockCollector, setFile(_, _)).Times(0);
|
||||||
EXPECT_CALL(mockCollector, collectSymbols()).Times(0);
|
EXPECT_CALL(mockCollector, collectSymbols()).Times(0);
|
||||||
@@ -737,7 +748,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathCallsInOrderButGetsAnErrorForCollectingSy
|
|||||||
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
|
EXPECT_CALL(mockSqliteTransactionBackend, deferredBegin());
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0])))
|
EXPECT_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0])))
|
||||||
.WillOnce(Return(artefact));
|
.WillOnce(Return(artefact));
|
||||||
EXPECT_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)));
|
EXPECT_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)));
|
||||||
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
EXPECT_CALL(mockSqliteTransactionBackend, commit());
|
||||||
EXPECT_CALL(mockCollector,
|
EXPECT_CALL(mockCollector,
|
||||||
setFile(Eq(sourceFileIds[0]),
|
setFile(Eq(sourceFileIds[0]),
|
||||||
@@ -779,7 +790,7 @@ TEST_F(SymbolIndexer, UpdateChangedPathIsUsingPrecompiledHeader)
|
|||||||
{
|
{
|
||||||
ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0])))
|
ON_CALL(mockSymbolStorage, fetchProjectPartArtefact(TypedEq<FilePathId>(sourceFileIds[0])))
|
||||||
.WillByDefault(Return(artefact));
|
.WillByDefault(Return(artefact));
|
||||||
ON_CALL(mockSymbolStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)))
|
ON_CALL(mockPrecompiledHeaderStorage, fetchPrecompiledHeader(Eq(artefact.projectPartId)))
|
||||||
.WillByDefault(Return(projectPartPch));
|
.WillByDefault(Return(projectPartPch));
|
||||||
std::vector<SymbolIndexerTask> symbolIndexerTask;
|
std::vector<SymbolIndexerTask> symbolIndexerTask;
|
||||||
|
|
||||||
|
@@ -74,7 +74,6 @@ protected:
|
|||||||
MockSqliteWriteStatement &insertProjectPartSourcesStatement = storage.m_insertProjectPartSourcesStatement;
|
MockSqliteWriteStatement &insertProjectPartSourcesStatement = storage.m_insertProjectPartSourcesStatement;
|
||||||
MockSqliteReadStatement &getProjectPartArtefactsBySourceId = storage.m_getProjectPartArtefactsBySourceId;
|
MockSqliteReadStatement &getProjectPartArtefactsBySourceId = storage.m_getProjectPartArtefactsBySourceId;
|
||||||
MockSqliteReadStatement &getProjectPartArtefactsByProjectPartName = storage.m_getProjectPartArtefactsByProjectPartName;
|
MockSqliteReadStatement &getProjectPartArtefactsByProjectPartName = storage.m_getProjectPartArtefactsByProjectPartName;
|
||||||
MockSqliteReadStatement &getPrecompiledHeader = storage.m_getPrecompiledHeader;
|
|
||||||
|
|
||||||
SymbolEntries symbolEntries{{1, {"functionUSR", "function", SymbolKind::Function}},
|
SymbolEntries symbolEntries{{1, {"functionUSR", "function", SymbolKind::Function}},
|
||||||
{2, {"function2USR", "function2", SymbolKind::Function}}};
|
{2, {"function2USR", "function2", SymbolKind::Function}}};
|
||||||
@@ -261,24 +260,6 @@ TEST_F(SymbolStorage, FetchProjectPartArtefactByProjectNameReturnArtefact)
|
|||||||
ASSERT_THAT(result, Eq(artefact));
|
ASSERT_THAT(result, Eq(artefact));
|
||||||
}
|
}
|
||||||
|
|
||||||
TEST_F(SymbolStorage, FetchPrecompiledHeaderCallsValueInStatement)
|
|
||||||
{
|
|
||||||
EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25)));
|
|
||||||
|
|
||||||
storage.fetchPrecompiledHeader(25);
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolStorage, FetchPrecompiledHeader)
|
|
||||||
{
|
|
||||||
ClangBackEnd::ProjectPartPch pch{"", "/path/to/pch", 131};
|
|
||||||
EXPECT_CALL(getPrecompiledHeader, valueReturnProjectPartPch(Eq(25)))
|
|
||||||
.WillRepeatedly(Return(pch));
|
|
||||||
|
|
||||||
auto precompiledHeader = storage.fetchPrecompiledHeader(25);
|
|
||||||
|
|
||||||
ASSERT_THAT(precompiledHeader.value(), Eq(pch));
|
|
||||||
}
|
|
||||||
|
|
||||||
TEST_F(SymbolStorage, AddNewSymbolsTable)
|
TEST_F(SymbolStorage, AddNewSymbolsTable)
|
||||||
{
|
{
|
||||||
InSequence s;
|
InSequence s;
|
||||||
|
Reference in New Issue
Block a user