ClangPchManager: Filter system include search paths

We want the include paths from outside the project handled as system
include paths. This is speeding up the PCH creation.

Task-number: QTCREATORBUG-21955
Change-Id: Ic80102f46f5a14897c7ef43da5efd4c0f88abbbc
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2019-02-14 19:04:26 +01:00
parent 337155a648
commit 1ce0db8270
4 changed files with 104 additions and 9 deletions

View File

@@ -37,6 +37,9 @@
#include <cpptools/compileroptionsbuilder.h>
#include <cpptools/projectpart.h>
#include <cpptools/headerpathfilter.h>
#include <projectexplorer/project.h>
#include <projectexplorer/target.h>
#include <projectexplorer/buildconfiguration.h>
#include <utils/algorithm.h>
@@ -231,6 +234,21 @@ ClangBackEnd::IncludeSearchPaths convertToIncludeSearchPaths(
return paths;
}
QString projectDirectory(ProjectExplorer::Project *project)
{
if (project)
return project->rootProjectDirectory().toString();
return {};
}
QString buildDirectory(ProjectExplorer::Project *project)
{
if (project && project->activeTarget() && project->activeTarget()->activeBuildConfiguration())
return project->activeTarget()->activeBuildConfiguration()->buildDirectory().toString();
return {};
}
} // namespace
ProjectUpdater::SystemAndProjectIncludeSearchPaths ProjectUpdater::createIncludeSearchPaths(
@@ -239,7 +257,9 @@ ProjectUpdater::SystemAndProjectIncludeSearchPaths ProjectUpdater::createInclude
CppTools::HeaderPathFilter filter(projectPart,
CppTools::UseTweakedHeaderPaths::Yes,
CLANG_VERSION,
CLANG_RESOURCE_DIR);
CLANG_RESOURCE_DIR,
projectDirectory(projectPart.project),
buildDirectory(projectPart.project));
filter.process();
return {convertToIncludeSearchPaths(filter.systemHeaderPaths, filter.builtInHeaderPaths),