forked from qt-creator/qt-creator
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:
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user