diff options
author | Marco Bubke <marco.bubke@qt.io> | 2017-01-30 11:24:46 +0100 |
---|---|---|
committer | Marco Bubke <marco.bubke@qt.io> | 2017-01-30 13:55:58 +0000 |
commit | c072cdfb8876df773da11222a35b7062dee2ad29 (patch) | |
tree | 954c931d5fed150fe4cb14d92a8aeb7285a27794 /src/libs | |
parent | d4b1cb4a65510477d0bc4a888e66c67da6e28237 (diff) | |
download | qt-creator-c072cdfb8876df773da11222a35b7062dee2ad29.tar.gz |
Clang: Add ClangPchManager
Compiling every header file again and again is quite time comsuming. There
are technics to improve this like preambles(a kind of automated
precompiled header) but they don't share their data between translation
units. This approach provides an automatically generated precompiled
header for every project and subproject to improve the loading time.
Change-Id: I34f5bd4db21951175920e2a9bbf6b97b1d705969
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src/libs')
20 files changed, 1202 insertions, 3 deletions
diff --git a/src/libs/clangbackendipc/clangbackendipc-lib.pri b/src/libs/clangbackendipc/clangbackendipc-lib.pri index c1fbbd6d84..e6d44d4bcc 100644 --- a/src/libs/clangbackendipc/clangbackendipc-lib.pri +++ b/src/libs/clangbackendipc/clangbackendipc-lib.pri @@ -68,7 +68,16 @@ SOURCES += $$PWD/clangcodemodelserverinterface.cpp \ $$PWD/sourcerangesanddiagnosticsforquerymessage.cpp \ $$PWD/sourcerangewithtextcontainer.cpp \ $$PWD/filecontainerv2.cpp \ - $$PWD/cancelmessage.cpp + $$PWD/cancelmessage.cpp \ + $$PWD/pchmanagerclientinterface.cpp \ + $$PWD/pchmanagerserverinterface.cpp \ + $$PWD/projectpartcontainerv2.cpp \ + $$PWD/updatepchprojectpartsmessage.cpp \ + $$PWD/pchmanagerserverproxy.cpp \ + $$PWD/pchmanagerclientproxy.cpp \ + $$PWD/projectpartpch.cpp \ + $$PWD/precompiledheadersupdatedmessage.cpp \ + $$PWD/removepchprojectpartsmessage.cpp HEADERS += \ $$PWD/clangcodemodelserverinterface.h \ @@ -133,6 +142,15 @@ HEADERS += \ $$PWD/sourcerangesanddiagnosticsforquerymessage.h \ $$PWD/sourcerangewithtextcontainer.h \ $$PWD/filecontainerv2.h \ - $$PWD/cancelmessage.h + $$PWD/cancelmessage.h \ + $$PWD/pchmanagerclientinterface.h \ + $$PWD/pchmanagerserverinterface.h \ + $$PWD/projectpartcontainerv2.h \ + $$PWD/updatepchprojectpartsmessage.h \ + $$PWD/pchmanagerserverproxy.h \ + $$PWD/pchmanagerclientproxy.h \ + $$PWD/projectpartpch.h \ + $$PWD/precompiledheadersupdatedmessage.h \ + $$PWD/removepchprojectpartsmessage.h contains(QT_CONFIG, reduce_exports):CONFIG += hide_symbols diff --git a/src/libs/clangbackendipc/clangbackendipc_global.h b/src/libs/clangbackendipc/clangbackendipc_global.h index 306a9d085a..1da9a9f323 100644 --- a/src/libs/clangbackendipc/clangbackendipc_global.h +++ b/src/libs/clangbackendipc/clangbackendipc_global.h @@ -45,10 +45,17 @@ # define CLANGBACKENDPROCESSPATH "" #endif +#ifdef UNIT_TESTS +#define unitttest_public public +#else +#define unitttest_public private +#endif + namespace Utils { template <uint Size> class BasicSmallString; using SmallString = BasicSmallString<31>; +using PathString = BasicSmallString<191>; } namespace ClangBackEnd { @@ -124,7 +131,10 @@ enum class MessageType : quint8 { RequestSourceRangesAndDiagnosticsForQueryMessage, SourceRangesAndDiagnosticsForQueryMessage, - CancelMessage + CancelMessage, + UpdatePchProjectPartsMessage, + RemovePchProjectPartsMessage, + PrecompiledHeadersUpdatedMessage }; template<MessageType messageEnumeration> diff --git a/src/libs/clangbackendipc/pchmanagerclientinterface.cpp b/src/libs/clangbackendipc/pchmanagerclientinterface.cpp new file mode 100644 index 0000000000..b7e40f3f5d --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerclientinterface.cpp @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "pchmanagerclientinterface.h" +#include "messageenvelop.h" + +#include <precompiledheadersupdatedmessage.h> + +#include <QDebug> + +namespace ClangBackEnd { + +void PchManagerClientInterface::dispatch(const MessageEnvelop &messageEnvelop) +{ + switch (messageEnvelop.messageType()) { + case MessageType::AliveMessage: + alive(); + break; + case MessageType::PrecompiledHeadersUpdatedMessage: + precompiledHeadersUpdated(messageEnvelop.message<PrecompiledHeadersUpdatedMessage>()); + break; + default: + qWarning() << "Unknown IpcClientMessage"; + } +} + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/pchmanagerclientinterface.h b/src/libs/clangbackendipc/pchmanagerclientinterface.h new file mode 100644 index 0000000000..771951641a --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerclientinterface.h @@ -0,0 +1,43 @@ +/**************************************************************************** +** +** 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 "ipcclientinterface.h" + +namespace ClangBackEnd { + +class PrecompiledHeadersUpdatedMessage; + +class CMBIPC_EXPORT PchManagerClientInterface : public IpcClientInterface +{ +public: + void dispatch(const MessageEnvelop &messageEnvelop) override; + + virtual void alive() = 0; + virtual void precompiledHeadersUpdated(PrecompiledHeadersUpdatedMessage &&message) = 0; +}; + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/pchmanagerclientproxy.cpp b/src/libs/clangbackendipc/pchmanagerclientproxy.cpp new file mode 100644 index 0000000000..ad583113bb --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerclientproxy.cpp @@ -0,0 +1,81 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "pchmanagerclientproxy.h" + +#include "cmbalivemessage.h" +#include "messageenvelop.h" +#include "pchmanagerserverinterface.h" +#include "precompiledheadersupdatedmessage.h" + +#include <QDebug> +#include <QIODevice> + +namespace ClangBackEnd { + +PchManagerClientProxy::PchManagerClientProxy(PchManagerServerInterface *server, QIODevice *ioDevice) + : writeMessageBlock(ioDevice), + readMessageBlock(ioDevice), + server(server), + ioDevice(ioDevice) +{ + QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {PchManagerClientProxy::readMessages();}); +} + +PchManagerClientProxy::PchManagerClientProxy(PchManagerClientProxy &&other) + : writeMessageBlock(std::move(other.writeMessageBlock)), + readMessageBlock(std::move(other.readMessageBlock)), + server(std::move(other.server)), + ioDevice(std::move(other.ioDevice)) +{ +} + +PchManagerClientProxy &PchManagerClientProxy::operator=(PchManagerClientProxy &&other) +{ + writeMessageBlock = std::move(other.writeMessageBlock); + readMessageBlock = std::move(other.readMessageBlock); + server = std::move(other.server); + ioDevice = std::move(other.ioDevice); + + return *this; +} + +void PchManagerClientProxy::readMessages() +{ + for (const MessageEnvelop &message : readMessageBlock.readAll()) + server->dispatch(message); +} + +void PchManagerClientProxy::alive() +{ + writeMessageBlock.write(AliveMessage()); +} + +void PchManagerClientProxy::precompiledHeadersUpdated(PrecompiledHeadersUpdatedMessage &&message) +{ + writeMessageBlock.write(message); +} + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/pchmanagerclientproxy.h b/src/libs/clangbackendipc/pchmanagerclientproxy.h new file mode 100644 index 0000000000..210e5b0125 --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerclientproxy.h @@ -0,0 +1,59 @@ +/**************************************************************************** +** +** 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 "clangbackendipc_global.h" +#include "pchmanagerclientinterface.h" +#include "readmessageblock.h" +#include "writemessageblock.h" + +namespace ClangBackEnd { + +class PchManagerServerInterface; + +class CMBIPC_EXPORT PchManagerClientProxy : public PchManagerClientInterface +{ +public: + explicit PchManagerClientProxy(PchManagerServerInterface *server, QIODevice *ioDevice); + PchManagerClientProxy(const PchManagerClientProxy&) = delete; + const PchManagerClientProxy &operator=(const PchManagerClientProxy&) = delete; + + PchManagerClientProxy(PchManagerClientProxy&&other); + PchManagerClientProxy &operator=(PchManagerClientProxy&&other); + + void readMessages(); + + void alive() override; + void precompiledHeadersUpdated(PrecompiledHeadersUpdatedMessage &&message) override; + +private: + ClangBackEnd::WriteMessageBlock writeMessageBlock; + ClangBackEnd::ReadMessageBlock readMessageBlock; + PchManagerServerInterface *server = nullptr; + QIODevice *ioDevice = nullptr; +}; + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/pchmanagerserverinterface.cpp b/src/libs/clangbackendipc/pchmanagerserverinterface.cpp new file mode 100644 index 0000000000..1a6d9d4a25 --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerserverinterface.cpp @@ -0,0 +1,53 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "pchmanagerserverinterface.h" + +#include "messageenvelop.h" +#include "removepchprojectpartsmessage.h" +#include "updatepchprojectpartsmessage.h" + +#include <QDebug> + +namespace ClangBackEnd { + +void PchManagerServerInterface::dispatch(const MessageEnvelop &messageEnvelop) +{ + switch (messageEnvelop.messageType()) { + case MessageType::EndMessage: + end(); + break; + case MessageType::UpdatePchProjectPartsMessage: + updatePchProjectParts(messageEnvelop.message<UpdatePchProjectPartsMessage>()); + break; + case MessageType::RemovePchProjectPartsMessage: + removePchProjectParts(messageEnvelop.message<RemovePchProjectPartsMessage>()); + break; + default: + qWarning() << "Unknown IpcClientMessage"; + } +} + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/pchmanagerserverinterface.h b/src/libs/clangbackendipc/pchmanagerserverinterface.h new file mode 100644 index 0000000000..a4a8ed683d --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerserverinterface.h @@ -0,0 +1,49 @@ +/**************************************************************************** +** +** 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 "ipcserverinterface.h" + +#include <memory> + +namespace ClangBackEnd { + +class PchManagerClientInterface; +class RemovePchProjectPartsMessage; +class UpdatePchProjectPartsMessage; + + +class CMBIPC_EXPORT PchManagerServerInterface : public IpcServerInterface<PchManagerClientInterface> +{ +public: + void dispatch(const MessageEnvelop &messageEnvelop) override; + + virtual void end() = 0; + virtual void updatePchProjectParts(UpdatePchProjectPartsMessage &&message) = 0; + virtual void removePchProjectParts(RemovePchProjectPartsMessage &&message) = 0; +}; + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/pchmanagerserverproxy.cpp b/src/libs/clangbackendipc/pchmanagerserverproxy.cpp new file mode 100644 index 0000000000..d513fddc87 --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerserverproxy.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "pchmanagerserverproxy.h" + +#include "cmbendmessage.h" +#include "messageenvelop.h" +#include "pchmanagerclientinterface.h" +#include "removepchprojectpartsmessage.h" +#include "updatepchprojectpartsmessage.h" + +#include <QIODevice> +#include <QVector> + +namespace ClangBackEnd { + +PchManagerServerProxy::PchManagerServerProxy(PchManagerClientInterface *client, QIODevice *ioDevice) + : writeMessageBlock(ioDevice), + readMessageBlock(ioDevice), + client(client) +{ + QObject::connect(ioDevice, &QIODevice::readyRead, [this] () { readMessages(); }); +} + +void PchManagerServerProxy::end() +{ + writeMessageBlock.write(EndMessage()); +} + +void PchManagerServerProxy::updatePchProjectParts(UpdatePchProjectPartsMessage &&message) +{ + writeMessageBlock.write(message); +} + +void PchManagerServerProxy::removePchProjectParts(RemovePchProjectPartsMessage &&message) +{ + writeMessageBlock.write(message); +} + +void PchManagerServerProxy::readMessages() +{ + for (const auto &message : readMessageBlock.readAll()) + client->dispatch(message); +} + +void PchManagerServerProxy::resetCounter() +{ + writeMessageBlock.resetCounter(); + readMessageBlock.resetCounter(); +} + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/pchmanagerserverproxy.h b/src/libs/clangbackendipc/pchmanagerserverproxy.h new file mode 100644 index 0000000000..0b4e593bc1 --- /dev/null +++ b/src/libs/clangbackendipc/pchmanagerserverproxy.h @@ -0,0 +1,66 @@ +/**************************************************************************** +** +** 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 "clangbackendipc_global.h" +#include "pchmanagerserverinterface.h" +#include "readmessageblock.h" +#include "writemessageblock.h" + +#include <QtGlobal> + +#include <memory> + +QT_BEGIN_NAMESPACE +class QIODevice; +QT_END_NAMESPACE + +namespace ClangBackEnd { + +class PchManagerClientInterface; + +class CMBIPC_EXPORT PchManagerServerProxy final : public PchManagerServerInterface +{ +public: + explicit PchManagerServerProxy(PchManagerClientInterface *client, QIODevice *ioDevice); + PchManagerServerProxy(const PchManagerServerProxy&) = delete; + const PchManagerServerProxy &operator=(const PchManagerServerProxy&) = delete; + + void end() override; + void updatePchProjectParts(UpdatePchProjectPartsMessage &&message) override; + void removePchProjectParts(RemovePchProjectPartsMessage &&message) override; + + void readMessages(); + + void resetCounter(); + +private: + ClangBackEnd::WriteMessageBlock writeMessageBlock; + ClangBackEnd::ReadMessageBlock readMessageBlock; + PchManagerClientInterface *client = nullptr; +}; + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/precompiledheadersupdatedmessage.cpp b/src/libs/clangbackendipc/precompiledheadersupdatedmessage.cpp new file mode 100644 index 0000000000..38c56be38b --- /dev/null +++ b/src/libs/clangbackendipc/precompiledheadersupdatedmessage.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "precompiledheadersupdatedmessage.h" + +#include <QDebug> + +namespace ClangBackEnd { + +CMBIPC_EXPORT QDebug operator<<(QDebug debug, const PrecompiledHeadersUpdatedMessage &) +{ + debug.nospace() << "PrecompiledHeaderUpdatedMessage()"; + + return debug; +} + +std::ostream &operator<<(std::ostream &out, const PrecompiledHeadersUpdatedMessage &message) +{ + out << "(" + << message.projectPartPchs() + << ")"; + + return out; +} + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/precompiledheadersupdatedmessage.h b/src/libs/clangbackendipc/precompiledheadersupdatedmessage.h new file mode 100644 index 0000000000..7780957e79 --- /dev/null +++ b/src/libs/clangbackendipc/precompiledheadersupdatedmessage.h @@ -0,0 +1,79 @@ +/**************************************************************************** +** +** 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 "projectpartpch.h" + +namespace ClangBackEnd { + +class PrecompiledHeadersUpdatedMessage +{ +public: + PrecompiledHeadersUpdatedMessage() = default; + PrecompiledHeadersUpdatedMessage(std::vector<ProjectPartPch> &&projectPartPchs) + : projectPartPchs_(std::move(projectPartPchs)) + {} + + const std::vector<ProjectPartPch> &projectPartPchs() const + { + return projectPartPchs_; + } + + friend QDataStream &operator<<(QDataStream &out, const PrecompiledHeadersUpdatedMessage &message) + { + out << message.projectPartPchs_; + + return out; + } + + friend QDataStream &operator>>(QDataStream &in, PrecompiledHeadersUpdatedMessage &message) + { + in >> message.projectPartPchs_; + + return in; + } + + friend bool operator==(const PrecompiledHeadersUpdatedMessage &first, + const PrecompiledHeadersUpdatedMessage &second) + { + return first.projectPartPchs_ == second.projectPartPchs_; + } + + PrecompiledHeadersUpdatedMessage clone() const + { + return PrecompiledHeadersUpdatedMessage(Utils::clone(projectPartPchs_)); + } + +private: + std::vector<ProjectPartPch> projectPartPchs_; +}; + +CMBIPC_EXPORT QDebug operator<<(QDebug debug, const PrecompiledHeadersUpdatedMessage &message); +std::ostream &operator<<(std::ostream &out, const PrecompiledHeadersUpdatedMessage &message); + +DECLARE_MESSAGE(PrecompiledHeadersUpdatedMessage) + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/projectpartcontainerv2.cpp b/src/libs/clangbackendipc/projectpartcontainerv2.cpp new file mode 100644 index 0000000000..89b489ee5b --- /dev/null +++ b/src/libs/clangbackendipc/projectpartcontainerv2.cpp @@ -0,0 +1,55 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "projectpartcontainerv2.h" + +namespace ClangBackEnd { +namespace V2 { + +QDebug operator<<(QDebug debug, const ProjectPartContainer &container) +{ + debug.nospace() << "ProjectPartContainer(" + << container.projectPartId() << "," + << container.arguments() << ", " + << container.headerPaths() << ", " + << container.sourcePaths() + << ")"; + + return debug; +} + +std::ostream &operator<<(std::ostream &out, const ProjectPartContainer &container) +{ + out << "(" + << container.projectPartId() << ", " + << container.arguments() << ", " + << container.headerPaths() << ", " + << container.sourcePaths()<< ")"; + + return out; +} + +} // namespace V2 +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/projectpartcontainerv2.h b/src/libs/clangbackendipc/projectpartcontainerv2.h new file mode 100644 index 0000000000..db5781daac --- /dev/null +++ b/src/libs/clangbackendipc/projectpartcontainerv2.h @@ -0,0 +1,124 @@ +/**************************************************************************** +** +** 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 "clangbackendipc_global.h" + +#include <utils/smallstringio.h> + +namespace ClangBackEnd { +namespace V2 { + +class ProjectPartContainer +{ +public: + ProjectPartContainer() = default; + ProjectPartContainer(Utils::SmallString &&projectPartId, + Utils::SmallStringVector &&arguments, + Utils::SmallStringVector &&headerPaths, + Utils::SmallStringVector &&sourcePaths) + : projectPartId_(std::move(projectPartId)), + arguments_(std::move(arguments)), + headerPaths_(std::move(headerPaths)), + sourcePaths_(std::move(sourcePaths)) + { + } + + const Utils::SmallString &projectPartId() const + { + return projectPartId_; + } + + const Utils::SmallStringVector &arguments() const + { + return arguments_; + } + + const Utils::SmallStringVector &sourcePaths() const + { + return sourcePaths_; + } + + const Utils::SmallStringVector &headerPaths() const + { + return headerPaths_; + } + + friend QDataStream &operator<<(QDataStream &out, const ProjectPartContainer &container) + { + out << container.projectPartId_; + out << container.arguments_; + out << container.headerPaths_; + out << container.sourcePaths_; + + return out; + } + + friend QDataStream &operator>>(QDataStream &in, ProjectPartContainer &container) + { + in >> container.projectPartId_; + in >> container.arguments_; + in >> container.headerPaths_; + in >> container.sourcePaths_; + + return in; + } + + friend bool operator==(const ProjectPartContainer &first, const ProjectPartContainer &second) + { + return first.projectPartId_ == second.projectPartId_ + && first.arguments_ == second.arguments_ + && first.headerPaths_ == second.headerPaths_ + && first.sourcePaths_ == second.sourcePaths_; + } + + friend bool operator<(const ProjectPartContainer &first, const ProjectPartContainer &second) + { + return std::tie(first.projectPartId_, first.arguments_, first.headerPaths_, first.sourcePaths_) + < std::tie(second.projectPartId_, second.arguments_, second.headerPaths_, second.sourcePaths_); + } + + ProjectPartContainer clone() const + { + return ProjectPartContainer(projectPartId_.clone(), + arguments_.clone(), + headerPaths_.clone(), + sourcePaths_.clone()); + } + +private: + Utils::SmallString projectPartId_; + Utils::SmallStringVector arguments_; + Utils::SmallStringVector headerPaths_; + Utils::SmallStringVector sourcePaths_; +}; + +using ProjectPartContainers = std::vector<ProjectPartContainer>; + +QDebug operator<<(QDebug debug, const ProjectPartContainer &container); +std::ostream &operator<<(std::ostream &out, const ProjectPartContainer &container); +} // namespace V2 +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/projectpartpch.cpp b/src/libs/clangbackendipc/projectpartpch.cpp new file mode 100644 index 0000000000..0df291b3df --- /dev/null +++ b/src/libs/clangbackendipc/projectpartpch.cpp @@ -0,0 +1,48 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "projectpartpch.h" + +namespace ClangBackEnd { + +QDebug operator<<(QDebug debug, const ProjectPartPch &projectPartPch) +{ + debug.nospace() << "FileContainer(" + << projectPartPch.id() << ", " + << projectPartPch.path() << ")"; + + return debug; +} + +std::ostream &operator<<(std::ostream &out, const ProjectPartPch &projectPartPch) +{ + out << "(" + << projectPartPch.id() << ", " + << projectPartPch.path() << ")"; + + return out; +} + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/projectpartpch.h b/src/libs/clangbackendipc/projectpartpch.h new file mode 100644 index 0000000000..0d541671c2 --- /dev/null +++ b/src/libs/clangbackendipc/projectpartpch.h @@ -0,0 +1,88 @@ +/**************************************************************************** +** +** 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 "clangbackendipc_global.h" + +#include <utils/smallstringio.h> + +namespace ClangBackEnd { + +class ProjectPartPch +{ +public: + ProjectPartPch() = default; + ProjectPartPch(Utils::SmallString &&projectPartId, Utils::SmallString &&pchPath) + : projectPartId(std::move(projectPartId)), + pchPath(std::move(pchPath)) + {} + + const Utils::SmallString &id() const + { + return projectPartId; + } + + const Utils::SmallString &path() const + { + return pchPath; + } + + friend QDataStream &operator<<(QDataStream &out, const ProjectPartPch &container) + { + out << container.projectPartId; + out << container.pchPath; + + return out; + } + + friend QDataStream &operator>>(QDataStream &in, ProjectPartPch &container) + { + in >> container.projectPartId; + in >> container.pchPath; + + return in; + } + + friend bool operator==(const ProjectPartPch &first, + const ProjectPartPch &second) + { + return first.projectPartId == second.projectPartId + && first.pchPath == second.pchPath; + } + + ProjectPartPch clone() const + { + return ProjectPartPch(projectPartId.clone(), pchPath.clone()); + } + +private: + Utils::SmallString projectPartId; + Utils::SmallString pchPath; +}; + +CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartPch &projectPartPch); +std::ostream &operator<<(std::ostream &out, const ProjectPartPch &projectPartPch); +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/removepchprojectpartsmessage.cpp b/src/libs/clangbackendipc/removepchprojectpartsmessage.cpp new file mode 100644 index 0000000000..24c657336a --- /dev/null +++ b/src/libs/clangbackendipc/removepchprojectpartsmessage.cpp @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "removepchprojectpartsmessage.h" + +namespace ClangBackEnd { + +CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RemovePchProjectPartsMessage &message) +{ + debug.nospace() << "RemoveProjectPartsMessage(" + << message.projectsPartIds() << ")"; + + return debug; +} + +std::ostream &operator<<(std::ostream &out, const RemovePchProjectPartsMessage &message) +{ + return out << "(" << message.projectsPartIds() << ")"; +} +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/removepchprojectpartsmessage.h b/src/libs/clangbackendipc/removepchprojectpartsmessage.h new file mode 100644 index 0000000000..2c052bab22 --- /dev/null +++ b/src/libs/clangbackendipc/removepchprojectpartsmessage.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** 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 "projectpartcontainerv2.h" + +namespace ClangBackEnd { + +class RemovePchProjectPartsMessage +{ +public: + RemovePchProjectPartsMessage() = default; + RemovePchProjectPartsMessage(Utils::SmallStringVector &&projectsPartIds) + : projectsPartIds_(std::move(projectsPartIds)) + {} + + const Utils::SmallStringVector &projectsPartIds() const + { + return projectsPartIds_; + } + + Utils::SmallStringVector takeProjectsPartIds() + { + return std::move(projectsPartIds_); + } + + friend QDataStream &operator<<(QDataStream &out, const RemovePchProjectPartsMessage &message) + { + out << message.projectsPartIds_; + + return out; + } + + friend QDataStream &operator>>(QDataStream &in, RemovePchProjectPartsMessage &message) + { + in >> message.projectsPartIds_; + + return in; + } + + friend bool operator==(const RemovePchProjectPartsMessage &first, + const RemovePchProjectPartsMessage &second) + { + return first.projectsPartIds_ == second.projectsPartIds_; + } + + RemovePchProjectPartsMessage clone() const + { + return RemovePchProjectPartsMessage(projectsPartIds_.clone()); + } + +private: + Utils::SmallStringVector projectsPartIds_; +}; + +CMBIPC_EXPORT QDebug operator<<(QDebug debug, const RemovePchProjectPartsMessage &message); +std::ostream &operator<<(std::ostream &out, const RemovePchProjectPartsMessage &message); + +DECLARE_MESSAGE(RemovePchProjectPartsMessage) + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/updatepchprojectpartsmessage.cpp b/src/libs/clangbackendipc/updatepchprojectpartsmessage.cpp new file mode 100644 index 0000000000..f86ef12aac --- /dev/null +++ b/src/libs/clangbackendipc/updatepchprojectpartsmessage.cpp @@ -0,0 +1,45 @@ +/**************************************************************************** +** +** 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. +** +****************************************************************************/ + +#include "updatepchprojectpartsmessage.h" + +namespace ClangBackEnd { + +QDebug operator<<(QDebug debug, const UpdatePchProjectPartsMessage &message) +{ + debug.nospace() << "UpdatePchProjectPartsMessage(" + << message.projectsParts() << ")"; + + return debug; +} + +std::ostream &operator<<(std::ostream &out, const UpdatePchProjectPartsMessage &message) +{ + return out << "(" + << message.projectsParts() + << ")"; +} + +} // namespace ClangBackEnd diff --git a/src/libs/clangbackendipc/updatepchprojectpartsmessage.h b/src/libs/clangbackendipc/updatepchprojectpartsmessage.h new file mode 100644 index 0000000000..dc5534c0b3 --- /dev/null +++ b/src/libs/clangbackendipc/updatepchprojectpartsmessage.h @@ -0,0 +1,84 @@ +/**************************************************************************** +** +** 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 "projectpartcontainerv2.h" + +namespace ClangBackEnd { + +class UpdatePchProjectPartsMessage +{ +public: + UpdatePchProjectPartsMessage() = default; + UpdatePchProjectPartsMessage(V2::ProjectPartContainers &&projectsParts) + : projectsParts_(std::move(projectsParts)) + {} + + const V2::ProjectPartContainers &projectsParts() const + { + return projectsParts_; + } + + V2::ProjectPartContainers takeProjectsParts() + { + return std::move(projectsParts_); + } + + friend QDataStream &operator<<(QDataStream &out, const UpdatePchProjectPartsMessage &message) + { + out << message.projectsParts_; + + return out; + } + + friend QDataStream &operator>>(QDataStream &in, UpdatePchProjectPartsMessage &message) + { + in >> message.projectsParts_; + + return in; + } + + friend bool operator==(const UpdatePchProjectPartsMessage &first, + const UpdatePchProjectPartsMessage &second) + { + return first.projectsParts_ == second.projectsParts_; + } + + UpdatePchProjectPartsMessage clone() const + { + return UpdatePchProjectPartsMessage(Utils::clone(projectsParts_)); + } + +private: + V2::ProjectPartContainers projectsParts_; +}; + +CMBIPC_EXPORT QDebug operator<<(QDebug debug, const UpdatePchProjectPartsMessage &message); +std::ostream &operator<<(std::ostream &out, const UpdatePchProjectPartsMessage &message); + +DECLARE_MESSAGE(UpdatePchProjectPartsMessage) + +} // namespace ClangBackEnd |