aboutsummaryrefslogtreecommitdiffstats
path: root/src/libs/clangsupport
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2018-12-17 12:06:57 +0100
committerMarco Bubke <marco.bubke@qt.io>2019-01-21 15:27:10 +0000
commitdd366b68dea11eebb0b1c53f3cff1902ce2bfefa (patch)
treeb919ffd70c5e3677244d2475381f6fb8defdd3eb /src/libs/clangsupport
parenta78e3e5dd5f882a28a3152f2e63ae986a9f2a8c5 (diff)
PchManager: Split pch tasks in project and system pch tasks
Like you can see in the task numbers this patch is touching many different areas. So I will only touch the main parts. It is using a clang action instead of an extra process which will be enabling the handling of generated files in PCHs. The flags from the project part are now not anymore transformed in a command line but they are saved in the container semantically aware so that they can later be merged. Most of this patch is simply polishing of other patches. Task-number: QTCREATORBUG-21346 Task-number: QTCREATORBUG-21380 Task-number: QTCREATORBUG-21382 Task-number: QTCREATORBUG-21383 Task-number: QTCREATORBUG-21693 Task-number: QTCREATORBUG-21778 Change-Id: I9b0c02d8149b554254e819448fbc61eeaa5b7494 Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Diffstat (limited to 'src/libs/clangsupport')
-rw-r--r--src/libs/clangsupport/clangsupport-lib.pri10
-rw-r--r--src/libs/clangsupport/commandlinebuilder.h258
-rw-r--r--src/libs/clangsupport/filepath.h8
-rw-r--r--src/libs/clangsupport/filepathview.h1
-rw-r--r--src/libs/clangsupport/includesearchpath.h102
-rw-r--r--src/libs/clangsupport/progresscounter.h18
-rw-r--r--src/libs/clangsupport/projectpartcontainer.cpp (renamed from src/libs/clangsupport/projectpartcontainerv2.cpp)7
-rw-r--r--src/libs/clangsupport/projectpartcontainer.h164
-rw-r--r--src/libs/clangsupport/projectpartcontainerv2.h125
-rw-r--r--src/libs/clangsupport/projectpartpch.h8
-rw-r--r--src/libs/clangsupport/refactoringdatabaseinitializer.h3
-rw-r--r--src/libs/clangsupport/removeprojectpartsmessage.h2
-rw-r--r--src/libs/clangsupport/updateprojectpartsmessage.h16
13 files changed, 572 insertions, 150 deletions
diff --git a/src/libs/clangsupport/clangsupport-lib.pri b/src/libs/clangsupport/clangsupport-lib.pri
index 03713650adb..221ccfd001e 100644
--- a/src/libs/clangsupport/clangsupport-lib.pri
+++ b/src/libs/clangsupport/clangsupport-lib.pri
@@ -44,7 +44,6 @@ SOURCES += \
$$PWD/pchmanagerserverinterface.cpp \
$$PWD/pchmanagerserverproxy.cpp \
$$PWD/precompiledheadersupdatedmessage.cpp \
- $$PWD/projectpartcontainerv2.cpp \
$$PWD/projectpartpch.cpp \
$$PWD/readmessageblock.cpp \
$$PWD/refactoringclientinterface.cpp \
@@ -87,7 +86,8 @@ SOURCES += \
$$PWD/baseserverproxy.cpp \
$$PWD/updategeneratedfilesmessage.cpp \
$$PWD/removegeneratedfilesmessage.cpp \
- $$PWD/generatedfiles.cpp
+ $$PWD/generatedfiles.cpp \
+ $$PWD/projectpartcontainer.cpp
HEADERS += \
$$PWD/cancelmessage.h \
@@ -138,7 +138,6 @@ HEADERS += \
$$PWD/pchmanagerserverinterface.h \
$$PWD/pchmanagerserverproxy.h \
$$PWD/precompiledheadersupdatedmessage.h \
- $$PWD/projectpartcontainerv2.h \
$$PWD/projectpartpch.h \
$$PWD/readmessageblock.h \
$$PWD/refactoringclientinterface.h \
@@ -205,6 +204,9 @@ HEADERS += \
$$PWD/generatedfiles.h \
$$PWD/generatedfilesinterface.h \
$$PWD/progressmessage.h \
- $$PWD/progresscounter.h
+ $$PWD/progresscounter.h \
+ $$PWD/includesearchpath.h \
+ $$PWD/commandlinebuilder.h \
+ $$PWD/projectpartcontainer.h
contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols
diff --git a/src/libs/clangsupport/commandlinebuilder.h b/src/libs/clangsupport/commandlinebuilder.h
new file mode 100644
index 00000000000..af9c0f1bafb
--- /dev/null
+++ b/src/libs/clangsupport/commandlinebuilder.h
@@ -0,0 +1,258 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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 "filepathview.h"
+
+#include <compilermacro.h>
+#include <includesearchpath.h>
+
+#include <utils/smallstringvector.h>
+#include <utils/cpplanguage_details.h>
+
+namespace ClangBackEnd {
+
+template<typename ProjectInfo, typename OutputContainer = std::vector<std::string>>
+class CommandLineBuilder
+{
+public:
+ CommandLineBuilder(const ProjectInfo &projectInfo,
+ const Utils::SmallStringVector &toolChainArguments = {},
+ FilePathView sourcePath = {},
+ FilePathView outputPath = {},
+ FilePathView includePchPath = {})
+ {
+ commandLine.reserve(128);
+
+ addCompiler(projectInfo.language);
+ addToolChainArguments(toolChainArguments);
+ addLanguage(projectInfo);
+ addLanguageVersion(projectInfo);
+ addNoStdIncAndNoStdLibInc();
+ addProjectIncludeSearchPaths(
+ sortedIncludeSearchPaths(projectInfo.projectIncludeSearchPaths));
+ addSystemAndBuiltInIncludeSearchPaths(
+ sortedIncludeSearchPaths(projectInfo.systemIncludeSearchPaths));
+ addIncludePchPath(includePchPath);
+ addOutputPath(outputPath);
+ addSourcePath(sourcePath);
+ }
+
+ void addCompiler(Utils::Language language)
+ {
+ if (language == Utils::Language::Cxx)
+ commandLine.emplace_back("clang++");
+ else
+ commandLine.emplace_back("clang");
+ }
+
+ void addToolChainArguments(const Utils::SmallStringVector &toolChainArguments)
+ {
+ for (Utils::SmallStringView argument : toolChainArguments)
+ commandLine.emplace_back(argument);
+ }
+
+ static const char *language(const ProjectInfo &projectInfo)
+ {
+ switch (projectInfo.language) {
+ case Utils::Language::C:
+ if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC)
+ return "objective-c-header";
+
+ return "c-header";
+ case Utils::Language::Cxx:
+ if (projectInfo.languageExtension && Utils::LanguageExtension::ObjectiveC)
+ return "objective-c++-header";
+ }
+
+ return "c++-header";
+ }
+
+ void addLanguage(const ProjectInfo &projectInfo)
+ {
+ commandLine.emplace_back("-x");
+ commandLine.emplace_back(language(projectInfo));
+ }
+
+ const char *standardLanguageVersion(Utils::LanguageVersion languageVersion)
+ {
+ switch (languageVersion) {
+ case Utils::LanguageVersion::C89:
+ return "-std=c89";
+ case Utils::LanguageVersion::C99:
+ return "-std=c99";
+ case Utils::LanguageVersion::C11:
+ return "-std=c11";
+ case Utils::LanguageVersion::C18:
+ return "-std=c18";
+ case Utils::LanguageVersion::CXX98:
+ return "-std=c++98";
+ case Utils::LanguageVersion::CXX03:
+ return "-std=c++03";
+ case Utils::LanguageVersion::CXX11:
+ return "-std=c++11";
+ case Utils::LanguageVersion::CXX14:
+ return "-std=c++14";
+ case Utils::LanguageVersion::CXX17:
+ return "-std=c++17";
+ case Utils::LanguageVersion::CXX2a:
+ return "-std=c++2a";
+ }
+
+ return "-std=c++2a";
+ }
+
+ const char *gnuLanguageVersion(Utils::LanguageVersion languageVersion)
+ {
+ switch (languageVersion) {
+ case Utils::LanguageVersion::C89:
+ return "-std=gnu89";
+ case Utils::LanguageVersion::C99:
+ return "-std=gnu99";
+ case Utils::LanguageVersion::C11:
+ return "-std=gnu11";
+ case Utils::LanguageVersion::C18:
+ return "-std=gnu18";
+ case Utils::LanguageVersion::CXX98:
+ return "-std=gnu++98";
+ case Utils::LanguageVersion::CXX03:
+ return "-std=gnu++03";
+ case Utils::LanguageVersion::CXX11:
+ return "-std=gnu++11";
+ case Utils::LanguageVersion::CXX14:
+ return "-std=gnu++14";
+ case Utils::LanguageVersion::CXX17:
+ return "-std=gnu++17";
+ case Utils::LanguageVersion::CXX2a:
+ return "-std=gnu++2a";
+ }
+
+ return "-std=gnu++2a";
+ }
+
+ const char *includeOption(IncludeSearchPathType type)
+ {
+ switch (type) {
+ case IncludeSearchPathType::User:
+ case IncludeSearchPathType::System:
+ case IncludeSearchPathType::BuiltIn:
+ return "-isystem";
+ case IncludeSearchPathType::Framework:
+ return "-F";
+ case IncludeSearchPathType::Invalid:
+ return "";
+ }
+
+ return "-I";
+ }
+
+ void addLanguageVersion(const ProjectInfo &projectInfo)
+ {
+ if (projectInfo.languageExtension && Utils::LanguageExtension::Gnu)
+ commandLine.emplace_back(gnuLanguageVersion(projectInfo.languageVersion));
+ else
+ commandLine.emplace_back(standardLanguageVersion(projectInfo.languageVersion));
+ }
+
+ IncludeSearchPaths sortedIncludeSearchPaths(const IncludeSearchPaths &unsortedPaths)
+ {
+ IncludeSearchPaths paths = unsortedPaths;
+ std::sort(paths.begin(), paths.end(), [](const auto &first, const auto &second) {
+ return first.index < second.index;
+ });
+
+ return paths;
+ }
+
+ void addProjectIncludeSearchPaths(const IncludeSearchPaths &projectIncludeSearchPaths)
+ {
+ for (const IncludeSearchPath &path : projectIncludeSearchPaths) {
+ commandLine.emplace_back("-I");
+ commandLine.emplace_back(path.path);
+ }
+ }
+
+ void addSystemAndBuiltInIncludeSearchPaths(const IncludeSearchPaths &systemIncludeSearchPaths)
+ {
+ addSystemIncludeSearchPaths(systemIncludeSearchPaths);
+ addBuiltInSystemSearchPaths(systemIncludeSearchPaths);
+ }
+
+ void addSystemIncludeSearchPaths(const IncludeSearchPaths &systemIncludeSearchPaths)
+ {
+ for (const IncludeSearchPath &path : systemIncludeSearchPaths) {
+ if (path.type != IncludeSearchPathType::BuiltIn) {
+ commandLine.emplace_back(includeOption(path.type));
+ commandLine.emplace_back(path.path);
+ }
+ }
+ }
+
+ void addBuiltInSystemSearchPaths(const IncludeSearchPaths &systemIncludeSearchPaths)
+ {
+ for (const IncludeSearchPath &path : systemIncludeSearchPaths) {
+ if (path.type == IncludeSearchPathType::BuiltIn) {
+ commandLine.emplace_back(includeOption(path.type));
+ commandLine.emplace_back(path.path);
+ }
+ }
+ }
+
+ void addOutputPath(FilePathView outputPath)
+ {
+ if (!outputPath.isEmpty()) {
+ commandLine.emplace_back("-o");
+ commandLine.emplace_back(outputPath);
+ }
+ }
+
+ void addSourcePath(FilePathView sourcePath)
+ {
+ if (!sourcePath.isEmpty())
+ commandLine.emplace_back(sourcePath);
+ }
+
+ void addIncludePchPath(FilePathView includePchPath)
+ {
+ if (!includePchPath.isEmpty()) {
+ commandLine.emplace_back("-Xclang");
+ commandLine.emplace_back("-include-pch");
+ commandLine.emplace_back("-Xclang");
+ commandLine.emplace_back(includePchPath);
+ }
+ }
+
+ void addNoStdIncAndNoStdLibInc()
+ {
+ commandLine.emplace_back("-nostdinc");
+ commandLine.emplace_back("-nostdlibinc");
+ }
+
+public:
+ OutputContainer commandLine;
+};
+
+} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/filepath.h b/src/libs/clangsupport/filepath.h
index 9ff019de764..e08f3f4996b 100644
--- a/src/libs/clangsupport/filepath.h
+++ b/src/libs/clangsupport/filepath.h
@@ -51,6 +51,14 @@ public:
m_slashIndex = view.slashIndex();
}
+ explicit FilePath(Utils::SmallStringView &&filePath)
+ : Utils::PathString(filePath)
+ {
+ FilePathView view{*this};
+
+ m_slashIndex = view.slashIndex();
+ }
+
FilePath(FilePathView filePathView)
: Utils::PathString(filePathView.toStringView()),
m_slashIndex(filePathView.slashIndex())
diff --git a/src/libs/clangsupport/filepathview.h b/src/libs/clangsupport/filepathview.h
index 27dac8377fb..09b940fa61a 100644
--- a/src/libs/clangsupport/filepathview.h
+++ b/src/libs/clangsupport/filepathview.h
@@ -37,6 +37,7 @@ template <char WindowsSlash>
class AbstractFilePathView : public Utils::SmallStringView
{
public:
+ constexpr AbstractFilePathView() = default;
explicit AbstractFilePathView(const char *const string, const size_type size) noexcept
: Utils::SmallStringView(string, size),
m_slashIndex(lastSlashIndex(*this))
diff --git a/src/libs/clangsupport/includesearchpath.h b/src/libs/clangsupport/includesearchpath.h
new file mode 100644
index 00000000000..239af9c1a47
--- /dev/null
+++ b/src/libs/clangsupport/includesearchpath.h
@@ -0,0 +1,102 @@
+/****************************************************************************
+**
+** Copyright (C) 2018 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/smallstringio.h>
+
+#include <QDataStream>
+
+#include <vector>
+
+namespace ClangBackEnd {
+
+enum class IncludeSearchPathType : unsigned char {
+ Invalid,
+ User,
+ BuiltIn,
+ System,
+ Framework,
+};
+
+class IncludeSearchPath
+{
+public:
+ IncludeSearchPath() = default;
+ IncludeSearchPath(Utils::PathString &&path, int index, IncludeSearchPathType type)
+ : path(std::move(path))
+ , index(index)
+ , type(type)
+ {}
+
+ IncludeSearchPath(Utils::PathString &&path, int index, int type)
+ : path(std::move(path))
+ , index(index)
+ , type(static_cast<IncludeSearchPathType>(type))
+ {}
+
+ friend QDataStream &operator<<(QDataStream &out, const IncludeSearchPath &includeSearchPath)
+ {
+ out << includeSearchPath.path;
+ out << includeSearchPath.index;
+ out << static_cast<unsigned char>(includeSearchPath.type);
+
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, IncludeSearchPath &includeSearchPath)
+ {
+ unsigned char type;
+
+ in >> includeSearchPath.path;
+ in >> includeSearchPath.index;
+ in >> type;
+
+ includeSearchPath.type = static_cast<IncludeSearchPathType>(type);
+
+ return in;
+ }
+
+ friend bool operator==(const IncludeSearchPath &first, const IncludeSearchPath &second)
+ {
+ return std::tie(first.type, first.index, first.path)
+ == std::tie(second.type, second.index, second.path);
+ }
+
+ friend bool operator<(const IncludeSearchPath &first, const IncludeSearchPath &second)
+ {
+ return std::tie(first.path, first.index, first.type)
+ < std::tie(second.path, second.index, second.type);
+ }
+
+public:
+ Utils::PathString path;
+ int index = -1;
+ IncludeSearchPathType type = IncludeSearchPathType::Invalid;
+};
+
+using IncludeSearchPaths = std::vector<IncludeSearchPath>;
+
+} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/progresscounter.h b/src/libs/clangsupport/progresscounter.h
index 1958f6ef8cd..fbdc9dda456 100644
--- a/src/libs/clangsupport/progresscounter.h
+++ b/src/libs/clangsupport/progresscounter.h
@@ -40,23 +40,29 @@ public:
void addTotal(int total)
{
- m_total += total;
+ if (total) {
+ m_total += total;
- m_progressCallback(m_progress, m_total);
+ m_progressCallback(m_progress, m_total);
+ }
}
void removeTotal(int total)
{
- m_total -= total;
+ if (total) {
+ m_total -= total;
- sendProgress();
+ sendProgress();
+ }
}
void addProgress(int progress)
{
- m_progress += progress;
+ if (progress) {
+ m_progress += progress;
- sendProgress();
+ sendProgress();
+ }
}
void sendProgress()
diff --git a/src/libs/clangsupport/projectpartcontainerv2.cpp b/src/libs/clangsupport/projectpartcontainer.cpp
index 7d03f9486d8..a51e927db59 100644
--- a/src/libs/clangsupport/projectpartcontainerv2.cpp
+++ b/src/libs/clangsupport/projectpartcontainer.cpp
@@ -23,22 +23,19 @@
**
****************************************************************************/
-#include "projectpartcontainerv2.h"
+#include "projectpartcontainer.h"
namespace ClangBackEnd {
-namespace V2 {
QDebug operator<<(QDebug debug, const ProjectPartContainer &container)
{
debug.nospace() << "ProjectPartContainer("
<< container.projectPartId << ","
- << container.arguments << ", "
+ << container.toolChainArguments << ", "
<< container.headerPathIds << ", "
<< container.sourcePathIds
<< ")";
return debug;
}
-
-} // namespace V2
} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/projectpartcontainer.h b/src/libs/clangsupport/projectpartcontainer.h
new file mode 100644
index 00000000000..d805ef5aad3
--- /dev/null
+++ b/src/libs/clangsupport/projectpartcontainer.h
@@ -0,0 +1,164 @@
+/****************************************************************************
+**
+** Copyright (C) 2016 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 "clangsupport_global.h"
+
+#include "compilermacro.h"
+#include "filepathid.h"
+#include "includesearchpath.h"
+
+#include <utils/cpplanguage_details.h>
+#include <utils/smallstringio.h>
+
+namespace ClangBackEnd {
+
+class ProjectPartContainer
+{
+ using uchar = unsigned char;
+public:
+ ProjectPartContainer() = default;
+ ProjectPartContainer(Utils::SmallString &&projectPartId,
+ Utils::SmallStringVector &&arguments,
+ CompilerMacros &&compilerMacros,
+ IncludeSearchPaths &&systemIncludeSearchPaths,
+ IncludeSearchPaths &&projectIncludeSearchPaths,
+ FilePathIds &&headerPathIds,
+ FilePathIds &&sourcePathIds,
+ Utils::Language language,
+ Utils::LanguageVersion languageVersion,
+ Utils::LanguageExtension languageExtension)
+ : projectPartId(std::move(projectPartId))
+ , toolChainArguments(std::move(arguments))
+ , compilerMacros(std::move(compilerMacros))
+ , systemIncludeSearchPaths(std::move(systemIncludeSearchPaths))
+ , projectIncludeSearchPaths(std::move(projectIncludeSearchPaths))
+ , headerPathIds(std::move(headerPathIds))
+ , sourcePathIds(std::move(sourcePathIds))
+ , language(language)
+ , languageVersion(languageVersion)
+ , languageExtension(languageExtension)
+ {
+ }
+
+ friend QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container)
+ {
+ out << container.projectPartId;
+ out << container.toolChainArguments;
+ out << container.compilerMacros;
+ out << container.systemIncludeSearchPaths;
+ out << container.projectIncludeSearchPaths;
+ out << container.headerPathIds;
+ out << container.sourcePathIds;
+ out << uchar(container.language);
+ out << uchar(container.languageVersion);
+ out << uchar(container.languageExtension);
+ return out;
+ }
+
+ friend QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container)
+ {
+ uchar language;
+ uchar languageVersion;
+ uchar languageExtension;
+
+ in >> container.projectPartId;
+ in >> container.toolChainArguments;
+ in >> container.compilerMacros;
+ in >> container.systemIncludeSearchPaths;
+ in >> container.projectIncludeSearchPaths;
+ in >> container.headerPathIds;
+ in >> container.sourcePathIds;
+ in >> language;
+ in >> languageVersion;
+ in >> languageExtension;
+
+ container.language = static_cast<Utils::Language>(language);
+ container.languageVersion = static_cast<Utils::LanguageVersion>(languageVersion);
+ container.languageExtension = static_cast<Utils::LanguageExtension>(languageExtension);
+
+ return in;
+ }
+
+ friend bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second)
+ {
+ return first.projectPartId == second.projectPartId
+ && first.toolChainArguments == second.toolChainArguments
+ && first.compilerMacros == second.compilerMacros
+ && first.systemIncludeSearchPaths == second.systemIncludeSearchPaths
+ && first.projectIncludeSearchPaths == second.projectIncludeSearchPaths
+ && first.headerPathIds == second.headerPathIds
+ && first.sourcePathIds == second.sourcePathIds&& first.language == second.language
+ && first.languageVersion == second.languageVersion
+ && first.languageExtension == second.languageExtension;
+ }
+
+ friend bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second)
+ {
+ return std::tie(first.projectPartId,
+ first.toolChainArguments,
+ first.compilerMacros,
+ first.systemIncludeSearchPaths,
+ first.projectIncludeSearchPaths,
+ first.headerPathIds,
+ first.sourcePathIds,
+ first.language,
+ first.languageVersion,
+ first.languageExtension)
+ < std::tie(second.projectPartId,
+ second.toolChainArguments,
+ second.compilerMacros,
+ second.systemIncludeSearchPaths,
+ second.projectIncludeSearchPaths,
+ second.headerPathIds,
+ second.sourcePathIds,
+ second.language,
+ second.languageVersion,
+ second.languageExtension);
+ }
+
+ ProjectPartContainer clone() const
+ {
+ return *this;
+ }
+
+public:
+ Utils::SmallString projectPartId;
+ Utils::SmallStringVector toolChainArguments;
+ CompilerMacros compilerMacros;
+ IncludeSearchPaths systemIncludeSearchPaths;
+ IncludeSearchPaths projectIncludeSearchPaths;
+ FilePathIds headerPathIds;
+ FilePathIds sourcePathIds;
+ Utils::Language language = Utils::Language::Cxx;
+ Utils::LanguageVersion languageVersion = Utils::LanguageVersion::CXX98;
+ Utils::LanguageExtension languageExtension = Utils::LanguageExtension::None;
+};
+
+using ProjectPartContainers = std::vector<ProjectPartContainer>;
+
+QDebug operator<<(QDebug debug, const ProjectPartContainer &container);
+} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/projectpartcontainerv2.h b/src/libs/clangsupport/projectpartcontainerv2.h
deleted file mode 100644
index be21ad874f3..00000000000
--- a/src/libs/clangsupport/projectpartcontainerv2.h
+++ /dev/null
@@ -1,125 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 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 "clangsupport_global.h"
-
-#include "compilermacro.h"
-#include "filepathid.h"
-
-#include <utils/smallstringio.h>
-
-namespace ClangBackEnd {
-namespace V2 {
-
-class ProjectPartContainer
-{
-public:
- ProjectPartContainer() = default;
- ProjectPartContainer(Utils::SmallString &&projectPartId,
- Utils::SmallStringVector &&arguments,
- CompilerMacros &&compilerMacros,
- Utils::SmallStringVector &&includeSearchPaths,
- FilePathIds &&headerPathIds,
- FilePathIds &&sourcePathIds)
- : projectPartId(std::move(projectPartId)),
- arguments(std::move(arguments)),
- compilerMacros(std::move(compilerMacros)),
- includeSearchPaths(std::move(includeSearchPaths)),
- headerPathIds(std::move(headerPathIds)),
- sourcePathIds(std::move(sourcePathIds))
- {
- }
-
- friend QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container)
- {
- out << container.projectPartId;
- out << container.arguments;
- out << container.compilerMacros;
- out << container.includeSearchPaths;
- out << container.headerPathIds;
- out << container.sourcePathIds;
-
- return out;
- }
-
- friend QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container)
- {
- in >> container.projectPartId;
- in >> container.arguments;
- in >> container.compilerMacros;
- in >> container.includeSearchPaths;
- in >> container.headerPathIds;
- in >> container.sourcePathIds;
-
- return in;
- }
-
- friend bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second)
- {
- return first.projectPartId == second.projectPartId
- && first.arguments == second.arguments
- && first.compilerMacros == second.compilerMacros
- && first.includeSearchPaths == second.includeSearchPaths
- && first.headerPathIds == second.headerPathIds
- && first.sourcePathIds == second.sourcePathIds;
- }
-
- friend bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second)
- {
- return std::tie(first.projectPartId,
- first.arguments,
- first.compilerMacros,
- first.includeSearchPaths,
- first.headerPathIds,
- first.sourcePathIds)
- < std::tie(second.projectPartId,
- second.arguments,
- second.compilerMacros,
- first.includeSearchPaths,
- second.headerPathIds,
- second.sourcePathIds);
- }
-
- ProjectPartContainer clone() const
- {
- return *this;
- }
-
-public:
- Utils::SmallString projectPartId;
- Utils::SmallStringVector arguments;
- CompilerMacros compilerMacros;
- Utils::SmallStringVector includeSearchPaths;
- FilePathIds headerPathIds;
- FilePathIds sourcePathIds;
-};
-
-using ProjectPartContainers = std::vector<ProjectPartContainer>;
-
-QDebug operator<<(QDebug debug, const ProjectPartContainer &container);
-} // namespace V2
-} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/projectpartpch.h b/src/libs/clangsupport/projectpartpch.h
index 6048a0b2f0c..a413915b767 100644
--- a/src/libs/clangsupport/projectpartpch.h
+++ b/src/libs/clangsupport/projectpartpch.h
@@ -28,6 +28,7 @@
#include "clangsupport_global.h"
#include <utils/smallstringio.h>
+#include <filepath.h>
namespace ClangBackEnd {
@@ -36,15 +37,16 @@ class ProjectPartPch
public:
ProjectPartPch() = default;
ProjectPartPch(Utils::SmallString &&projectPartId,
- Utils::SmallString &&pchPath,
+ FilePath &&pchPath,
long long lastModified)
: projectPartId(std::move(projectPartId)),
pchPath(std::move(pchPath)),
lastModified(lastModified)
{}
+
ProjectPartPch(Utils::SmallStringView pchPath,
long long lastModified)
- : pchPath(pchPath),
+ : pchPath(FilePathView(pchPath)),
lastModified(lastModified)
{}
@@ -78,7 +80,7 @@ public:
public:
Utils::SmallString projectPartId;
- Utils::SmallString pchPath;
+ FilePath pchPath;
long long lastModified = -1;
};
diff --git a/src/libs/clangsupport/refactoringdatabaseinitializer.h b/src/libs/clangsupport/refactoringdatabaseinitializer.h
index 94665409fe3..44c23e18a0a 100644
--- a/src/libs/clangsupport/refactoringdatabaseinitializer.h
+++ b/src/libs/clangsupport/refactoringdatabaseinitializer.h
@@ -125,7 +125,8 @@ public:
const Sqlite::Column &projectPartNameColumn = table.addColumn("projectPartName", Sqlite::ColumnType::Text);
table.addColumn("compilerArguments", Sqlite::ColumnType::Text);
table.addColumn("compilerMacros", Sqlite::ColumnType::Text);
- table.addColumn("includeSearchPaths", Sqlite::ColumnType::Text);
+ table.addColumn("systemIncludeSearchPaths", Sqlite::ColumnType::Text);
+ table.addColumn("projectIncludeSearchPaths", Sqlite::ColumnType::Text);
table.addUniqueIndex({projectPartNameColumn});
table.initialize(database);
diff --git a/src/libs/clangsupport/removeprojectpartsmessage.h b/src/libs/clangsupport/removeprojectpartsmessage.h
index 1f45cc5f524..0aea092fead 100644
--- a/src/libs/clangsupport/removeprojectpartsmessage.h
+++ b/src/libs/clangsupport/removeprojectpartsmessage.h
@@ -25,7 +25,7 @@
#pragma once
-#include "projectpartcontainerv2.h"
+#include "projectpartcontainer.h"
namespace ClangBackEnd {
diff --git a/src/libs/clangsupport/updateprojectpartsmessage.h b/src/libs/clangsupport/updateprojectpartsmessage.h
index e923d7ba031..b1c6ca1f611 100644
--- a/src/libs/clangsupport/updateprojectpartsmessage.h
+++ b/src/libs/clangsupport/updateprojectpartsmessage.h
@@ -26,7 +26,7 @@
#pragma once
#include "filecontainerv2.h"
-#include "projectpartcontainerv2.h"
+#include "projectpartcontainer.h"
namespace ClangBackEnd {
@@ -34,11 +34,13 @@ class UpdateProjectPartsMessage
{
public:
UpdateProjectPartsMessage() = default;
- UpdateProjectPartsMessage(V2::ProjectPartContainers &&projectsParts)
+ UpdateProjectPartsMessage(ProjectPartContainers &&projectsParts,
+ Utils::SmallStringVector &&toolChainArguments)
: projectsParts(std::move(projectsParts))
+ , toolChainArguments(toolChainArguments)
{}
- V2::ProjectPartContainers takeProjectsParts()
+ ProjectPartContainers takeProjectsParts()
{
return std::move(projectsParts);
}
@@ -46,6 +48,7 @@ public:
friend QDataStream &operator<<(QDataStream &out, const UpdateProjectPartsMessage &message)
{
out << message.projectsParts;
+ out << message.toolChainArguments;
return out;
}
@@ -53,6 +56,7 @@ public:
friend QDataStream &operator>>(QDataStream &in, UpdateProjectPartsMessage &message)
{
in >> message.projectsParts;
+ in >> message.toolChainArguments;
return in;
}
@@ -60,7 +64,8 @@ public:
friend bool operator==(const UpdateProjectPartsMessage &first,
const UpdateProjectPartsMessage &second)
{
- return first.projectsParts == second.projectsParts;
+ return first.projectsParts == second.projectsParts
+ && first.toolChainArguments == second.toolChainArguments;
}
UpdateProjectPartsMessage clone() const
@@ -69,7 +74,8 @@ public:
}
public:
- V2::ProjectPartContainers projectsParts;
+ ProjectPartContainers projectsParts;
+ Utils::SmallStringVector toolChainArguments;
};
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UpdateProjectPartsMessage &message);