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),

View File

@@ -0,0 +1,37 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include <utils/fileutils.h>
namespace ProjectExplorer {
class BuildConfiguration
{
public:
Utils::FileName buildDirectory() const { return {}; }
}; // namespace Target
} // namespace ProjectExplorer

View File

@@ -25,6 +25,8 @@
#pragma once
#include "target.h"
#include <projectexplorer/kit.h>
#include <utils/fileutils.h>
@@ -35,13 +37,10 @@ class Project : public QObject {
public:
Project() = default;
Utils::FileName projectDirectory() const {
return Utils::FileName();
}
Utils::FileName projectDirectory() const { return {}; }
Utils::FileName rootProjectDirectory() const {
return Utils::FileName();
}
Utils::FileName rootProjectDirectory() const { return {}; }
Target *activeTarget() const { return {}; }
};
}
} // namespace ProjectExplorer

View File

@@ -0,0 +1,39 @@
/****************************************************************************
**
** Copyright (C) 2019 The Qt Company Ltd.
** Contact: https://www.qt.io/licensing/
**
** This file is part of Qt Creator.
**
** Commercial License Usage
** Licensees holding valid commercial Qt licenses may use this file in
** accordance with the commercial license agreement provided with the
** Software or, alternatively, in accordance with the terms contained in
** a written agreement between you and The Qt Company. For licensing terms
** and conditions see https://www.qt.io/terms-conditions. For further
** information use the contact form at https://www.qt.io/contact-us.
**
** GNU General Public License Usage
** Alternatively, this file may be used under the terms of the GNU
** General Public License version 3 as published by the Free Software
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
** included in the packaging of this file. Please review the following
** information to ensure the GNU General Public License requirements will
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
**
****************************************************************************/
#pragma once
#include "buildconfiguration.h"
#include <utils/fileutils.h>
namespace ProjectExplorer {
class Target
{
public:
BuildConfiguration *activeBuildConfiguration() const { return {}; }
};
} // namespace ProjectExplorer