diff options
author | Marco Bubke <marco.bubke@qt.io> | 2019-02-14 19:04:26 +0100 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2019-02-18 14:30:15 +0000 |
commit | 1ce0db82704328be2c063844b7ea5179739094b1 (patch) | |
tree | 452672d5ecc7319d011468d309d3cb22f64f1d80 /src/plugins/clangpchmanager | |
parent | 337155a6488ec0d0857c6f51cf4f449232996d65 (diff) | |
download | qt-creator-1ce0db82704328be2c063844b7ea5179739094b1.tar.gz |
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>
Diffstat (limited to 'src/plugins/clangpchmanager')
-rw-r--r-- | src/plugins/clangpchmanager/projectupdater.cpp | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/src/plugins/clangpchmanager/projectupdater.cpp b/src/plugins/clangpchmanager/projectupdater.cpp index 74b63a8f1a..28127fc39d 100644 --- a/src/plugins/clangpchmanager/projectupdater.cpp +++ b/src/plugins/clangpchmanager/projectupdater.cpp @@ -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), |