From 29492ecf2494d875e3e2fa4951326aed275a3033 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Fri, 15 Feb 2019 16:15:01 +0100 Subject: 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 --- src/plugins/clangpchmanager/projectupdater.cpp | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/plugins/clangpchmanager') diff --git a/src/plugins/clangpchmanager/projectupdater.cpp b/src/plugins/clangpchmanager/projectupdater.cpp index 28127fc39d..4e5cf95017 100644 --- a/src/plugins/clangpchmanager/projectupdater.cpp +++ b/src/plugins/clangpchmanager/projectupdater.cpp @@ -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 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), -- cgit v1.2.3