ClangPchManager: Do not build pch and index inactive project parts

Some project parts should not be built as well as some files
can be inactive inside project part.
We should not try to build pch-s or index them.

Change-Id: I8e62365b817a424ae38a0df94b6703820a4cde9d
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Ivan Donchevskii
2019-02-15 16:15:01 +01:00
parent dcf763c7ee
commit 29492ecf24
2 changed files with 28 additions and 8 deletions

View File

@@ -143,8 +143,10 @@ HeaderAndSources ProjectUpdater::headerAndSourcesFromProjectPart(
HeaderAndSources headerAndSources;
headerAndSources.reserve(std::size_t(projectPart->files.size()) * 3 / 2);
for (const CppTools::ProjectFile &projectFile : projectPart->files)
addToHeaderAndSources(headerAndSources, projectFile);
for (const CppTools::ProjectFile &projectFile : projectPart->files) {
if (projectFile.active)
addToHeaderAndSources(headerAndSources, projectFile);
}
std::sort(headerAndSources.sources.begin(), headerAndSources.sources.end());
std::sort(headerAndSources.headers.begin(), headerAndSources.headers.end());
@@ -297,6 +299,13 @@ ClangBackEnd::ProjectPartContainers ProjectUpdater::toProjectPartContainers(
std::vector<ClangBackEnd::ProjectPartContainer> projectPartContainers;
projectPartContainers.reserve(projectParts.size());
projectParts.erase(std::remove_if(projectParts.begin(),
projectParts.end(),
[](const CppTools::ProjectPart *projectPart) {
return !projectPart->selectedForBuilding;
}),
projectParts.end());
std::transform(projectParts.begin(),
projectParts.end(),
std::back_inserter(projectPartContainers),