diff --git a/src/plugins/clangpchmanager/projectupdater.cpp b/src/plugins/clangpchmanager/projectupdater.cpp index 74b63a8f1ad..28127fc39d1 100644 --- a/src/plugins/clangpchmanager/projectupdater.cpp +++ b/src/plugins/clangpchmanager/projectupdater.cpp @@ -37,6 +37,9 @@ #include #include #include +#include +#include +#include #include @@ -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), diff --git a/tests/unit/mockup/projectexplorer/buildconfiguration.h b/tests/unit/mockup/projectexplorer/buildconfiguration.h new file mode 100644 index 00000000000..75b5a293c45 --- /dev/null +++ b/tests/unit/mockup/projectexplorer/buildconfiguration.h @@ -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 + +namespace ProjectExplorer { + +class BuildConfiguration +{ +public: + Utils::FileName buildDirectory() const { return {}; } +}; // namespace Target +} // namespace ProjectExplorer diff --git a/tests/unit/mockup/projectexplorer/project.h b/tests/unit/mockup/projectexplorer/project.h index 9e8f2e1ac39..cca7e49127d 100644 --- a/tests/unit/mockup/projectexplorer/project.h +++ b/tests/unit/mockup/projectexplorer/project.h @@ -25,6 +25,8 @@ #pragma once +#include "target.h" + #include #include @@ -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 diff --git a/tests/unit/mockup/projectexplorer/target.h b/tests/unit/mockup/projectexplorer/target.h new file mode 100644 index 00000000000..6ee2052ae29 --- /dev/null +++ b/tests/unit/mockup/projectexplorer/target.h @@ -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 + +namespace ProjectExplorer { + +class Target +{ +public: + BuildConfiguration *activeBuildConfiguration() const { return {}; } +}; +} // namespace ProjectExplorer