forked from qt-creator/qt-creator
Clang: Bulk add project file paths to database
This project part container generation because there is not anymore one single access to the database for every file path. Change-Id: I5f82022262fe89a976729d48ee4f098b74a1e1d1 Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This commit is contained in:
@@ -67,8 +67,11 @@ public:
|
||||
void ProjectUpdater::updateProjectParts(const std::vector<CppTools::ProjectPart *> &projectParts,
|
||||
Utils::SmallStringVector &&toolChainArguments)
|
||||
{
|
||||
m_server.updateProjectParts(ClangBackEnd::UpdateProjectPartsMessage{
|
||||
toProjectPartContainers(projectParts), std::move(toolChainArguments)});
|
||||
addProjectFilesToFilePathCache(projectParts);
|
||||
|
||||
m_server.updateProjectParts(
|
||||
ClangBackEnd::UpdateProjectPartsMessage{toProjectPartContainers(projectParts),
|
||||
std::move(toolChainArguments)});
|
||||
}
|
||||
|
||||
void ProjectUpdater::removeProjectParts(ClangBackEnd::ProjectPartIds projectPartIds)
|
||||
@@ -432,4 +435,24 @@ ClangBackEnd::ProjectPartIds ProjectUpdater::toProjectPartIds(
|
||||
return projectPartIds;
|
||||
}
|
||||
|
||||
void ProjectUpdater::addProjectFilesToFilePathCache(const std::vector<CppTools::ProjectPart *> &projectParts)
|
||||
{
|
||||
std::size_t fileCount = std::accumulate(projectParts.begin(),
|
||||
projectParts.end(),
|
||||
std::size_t(0),
|
||||
[](std::size_t value, CppTools::ProjectPart *projectPart) {
|
||||
return value + std::size_t(projectPart->files.size());
|
||||
});
|
||||
ClangBackEnd::FilePaths filePaths;
|
||||
filePaths.reserve(fileCount);
|
||||
|
||||
for (CppTools::ProjectPart *projectPart : projectParts) {
|
||||
for (const CppTools::ProjectFile &file : projectPart->files)
|
||||
if (file.active)
|
||||
filePaths.emplace_back(file.path);
|
||||
}
|
||||
|
||||
m_filePathCache.addFilePaths(filePaths);
|
||||
}
|
||||
|
||||
} // namespace ClangPchManager
|
||||
|
||||
@@ -115,6 +115,9 @@ public:
|
||||
|
||||
ClangBackEnd::ProjectPartIds toProjectPartIds(const QStringList &projectPartNames) const;
|
||||
|
||||
private:
|
||||
void addProjectFilesToFilePathCache(const std::vector<CppTools::ProjectPart *> &projectParts);
|
||||
|
||||
private:
|
||||
ClangBackEnd::GeneratedFiles m_generatedFiles;
|
||||
ClangBackEnd::FilePaths m_excludedPaths;
|
||||
|
||||
Reference in New Issue
Block a user