summaryrefslogtreecommitdiff
path: root/src/tools
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-04-10 17:44:34 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-04-23 09:08:44 +0000
commit3fc8217113813abd06878d46d57cc078612e9e4e (patch)
tree6188b9d7b51356f118915eee9feebae5c5dd01c8 /src/tools
parent5ab057746c662aba3308eff99e48c1e6bcc2b51e (diff)
downloadqt-creator-3fc8217113813abd06878d46d57cc078612e9e4e.tar.gz
Clang: Refactor fetchPrecompiledHeader
We don't need the other information any more. Change-Id: Ie34a646df34e336591c124093a15e90307ac88ec Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/tools')
-rw-r--r--src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h13
-rw-r--r--src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h2
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolindexer.cpp19
3 files changed, 15 insertions, 19 deletions
diff --git a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h
index 4fc893de73..c7fd859ac9 100644
--- a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h
+++ b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorage.h
@@ -142,9 +142,14 @@ public:
return FilePath("");
}
- Utils::optional<ProjectPartPch> fetchPrecompiledHeader(ProjectPartId projectPartId) const
+ FilePath fetchPrecompiledHeader(ProjectPartId projectPartId) const
{
- return getPrecompiledHeader.template value<ProjectPartPch, 3>(projectPartId.projectPathId);
+ auto value = getPrecompiledHeader.template value<FilePath>(projectPartId.projectPathId);
+
+ if (value)
+ return *value;
+
+ return FilePath("");
}
public:
@@ -171,8 +176,8 @@ public:
ReadStatement fetchSystemPrecompiledHeaderPathStatement{
"SELECT systemPchPath FROM precompiledHeaders WHERE projectPartId = ?", database};
mutable ReadStatement getPrecompiledHeader{
- "SELECT projectPartId, ifnull(nullif(projectPchPath, ''), systemPchPath), "
- "projectPchBuildTime FROM precompiledHeaders WHERE projectPartId = ?",
+ "SELECT ifnull(nullif(projectPchPath, ''), systemPchPath) "
+ "FROM precompiledHeaders WHERE projectPartId = ?",
database};
};
diff --git a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h
index b20b4a0c92..5937af3027 100644
--- a/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h
+++ b/src/tools/clangpchmanagerbackend/source/precompiledheaderstorageinterface.h
@@ -55,7 +55,7 @@ public:
= 0;
virtual void deleteSystemPrecompiledHeaders(const ProjectPartIds &projectPartIds) = 0;
virtual FilePath fetchSystemPrecompiledHeaderPath(ProjectPartId projectPartId) = 0;
- virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(ProjectPartId projectPartId) const = 0;
+ virtual FilePath fetchPrecompiledHeader(ProjectPartId projectPartId) const = 0;
protected:
~PrecompiledHeaderStorageInterface() = default;
diff --git a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
index 6d0978e54a..2fa2480a37 100644
--- a/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
+++ b/src/tools/clangrefactoringbackend/source/symbolindexer.cpp
@@ -93,20 +93,13 @@ void SymbolIndexer::updateProjectPart(ProjectPartContainer &&projectPart)
Sqlite::DeferredTransaction transaction{m_transactionInterface};
ProjectPartId projectPartId = projectPart.projectPartId;
- const Utils::optional<ProjectPartPch> optionalProjectPartPch
- = m_precompiledHeaderStorage.fetchPrecompiledHeader(projectPartId);
+ const FilePath pchPath = m_precompiledHeaderStorage.fetchPrecompiledHeader(projectPartId);
transaction.commit();
using Builder = CommandLineBuilder<ProjectPartContainer, Utils::SmallStringVector>;
- Builder commandLineBuilder{projectPart,
- projectPart.toolChainArguments,
- InputFileType::Source,
- {},
- {},
- optionalProjectPartPch
- ? FilePathView{optionalProjectPartPch->pchPath}
- : FilePathView{}};
+ Builder commandLineBuilder{
+ projectPart, projectPart.toolChainArguments, InputFileType::Source, {}, {}, pchPath};
std::vector<SymbolIndexerTask> symbolIndexerTask;
symbolIndexerTask.reserve(projectPart.sourcePathIds.size());
@@ -165,16 +158,14 @@ void SymbolIndexer::updateChangedPath(FilePathId filePathId,
if (!optionalArtefact)
return;
- const Utils::optional<ProjectPartPch> optionalProjectPartPch
- = m_precompiledHeaderStorage.fetchPrecompiledHeader(optionalArtefact->projectPartId);
+ const FilePath pchPath = m_precompiledHeaderStorage.fetchPrecompiledHeader(
+ optionalArtefact->projectPartId);
transaction.commit();
SourceTimeStamps dependentTimeStamps = m_symbolStorage.fetchIncludedIndexingTimeStamps(filePathId);
const ProjectPartArtefact &artefact = *optionalArtefact;
- auto pchPath = optionalProjectPartPch ? optionalProjectPartPch->pchPath : FilePath{};
-
CommandLineBuilder<ProjectPartArtefact, Utils::SmallStringVector>
builder{artefact, artefact.toolChainArguments, InputFileType::Source, {}, {}, pchPath};