diff --git a/src/libs/CMakeLists.txt b/src/libs/CMakeLists.txt index f8d02ba1f9b..9c0f2d68e7e 100644 --- a/src/libs/CMakeLists.txt +++ b/src/libs/CMakeLists.txt @@ -15,7 +15,6 @@ add_subdirectory(glsl) add_subdirectory(languageserverprotocol) add_subdirectory(ssh) add_subdirectory(sqlite) -add_subdirectory(clangsupport) add_subdirectory(tracing) add_subdirectory(qtcreatorcdbext) diff --git a/src/libs/clangsupport/CMakeLists.txt b/src/libs/clangsupport/CMakeLists.txt deleted file mode 100644 index 41b42ca2d03..00000000000 --- a/src/libs/clangsupport/CMakeLists.txt +++ /dev/null @@ -1,72 +0,0 @@ -set(CLANG_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH}) - -add_qtc_library(ClangSupport - DEPENDS Threads::Threads - PUBLIC_DEPENDS Utils Qt5::Core Qt5::Network - PUBLIC_DEFINES - CLANG_VERSION="${CLANG_VERSION}" - CLANG_INCLUDE_DIR="${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include" - CLANG_BINDIR="${LLVM_TOOLS_BINARY_DIR}" - PUBLIC_INCLUDES - "${CMAKE_CURRENT_LIST_DIR}" - SOURCES - alivemessage.cpp alivemessage.h - annotationsmessage.cpp annotationsmessage.h - baseserverproxy.cpp baseserverproxy.h - clangcodemodelclientinterface.cpp clangcodemodelclientinterface.h - clangcodemodelclientmessages.h - clangcodemodelclientproxy.cpp clangcodemodelclientproxy.h - clangcodemodelconnectionclient.cpp clangcodemodelconnectionclient.h - clangcodemodelserverinterface.cpp clangcodemodelserverinterface.h - clangcodemodelservermessages.h - clangcodemodelserverproxy.cpp clangcodemodelserverproxy.h - clangsupport_global.h - clangsupportdebugutils.cpp clangsupportdebugutils.h - codecompletion.cpp codecompletion.h - codecompletionchunk.cpp codecompletionchunk.h - completionsmessage.cpp completionsmessage.h - connectionclient.cpp connectionclient.h - connectionserver.cpp connectionserver.h - diagnosticcontainer.cpp diagnosticcontainer.h - documentschangedmessage.cpp documentschangedmessage.h - documentsclosedmessage.cpp documentsclosedmessage.h - documentsopenedmessage.cpp documentsopenedmessage.h - documentvisibilitychangedmessage.cpp documentvisibilitychangedmessage.h - echomessage.cpp echomessage.h - endmessage.cpp endmessage.h - filecontainer.cpp filecontainer.h - fixitcontainer.cpp fixitcontainer.h - followsymbolmessage.cpp followsymbolmessage.h - ipcclientinterface.h - ipcclientprovider.h - ipcinterface.h - ipcserverinterface.h - lineprefixer.cpp lineprefixer.h - messageenvelop.cpp messageenvelop.h - processcreator.cpp processcreator.h - processexception.cpp processexception.h - processhandle.h - processstartedevent.cpp processstartedevent.h - readmessageblock.cpp readmessageblock.h - referencesmessage.cpp referencesmessage.h - requestannotationsmessage.cpp requestannotationsmessage.h - requestcompletionsmessage.cpp requestcompletionsmessage.h - requestfollowsymbolmessage.cpp requestfollowsymbolmessage.h - requestreferencesmessage.cpp requestreferencesmessage.h - requesttooltipmessage.cpp requesttooltipmessage.h - sourcelocationcontainer.cpp sourcelocationcontainer.h - sourcelocationscontainer.cpp sourcelocationscontainer.h - sourcerangecontainer.cpp sourcerangecontainer.h - tokeninfocontainer.cpp tokeninfocontainer.h - tooltipinfo.cpp tooltipinfo.h - tooltipmessage.cpp tooltipmessage.h - unsavedfilesremovedmessage.cpp unsavedfilesremovedmessage.h - unsavedfilesupdatedmessage.cpp unsavedfilesupdatedmessage.h - utf8string.cpp utf8string.h - utf8stringvector.cpp utf8stringvector.h - writemessageblock.cpp writemessageblock.h -) - -if (NOT TARGET libclang) - return() -endif() diff --git a/src/libs/clangsupport/alivemessage.cpp b/src/libs/clangsupport/alivemessage.cpp deleted file mode 100644 index 99392fc0fde..00000000000 --- a/src/libs/clangsupport/alivemessage.cpp +++ /dev/null @@ -1,37 +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. -** -****************************************************************************/ - -#include "alivemessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const AliveMessage &/*message*/) -{ - return debug.nospace() << "AliveMessage()"; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/alivemessage.h b/src/libs/clangsupport/alivemessage.h deleted file mode 100644 index d5f519ac2dc..00000000000 --- a/src/libs/clangsupport/alivemessage.h +++ /dev/null @@ -1,56 +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 - -namespace ClangBackEnd { - -class AliveMessage -{ -public: - friend QDataStream &operator<<(QDataStream &out, const AliveMessage &/*message*/) - { - return out; - } - - friend QDataStream &operator>>(QDataStream &in, AliveMessage &/*message*/) - { - return in; - } - - friend bool operator==(const AliveMessage &/*first*/, const AliveMessage &/*second*/) - { - return true; - } - - friend CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const AliveMessage &message); -}; - -DECLARE_MESSAGE(AliveMessage) -} diff --git a/src/libs/clangsupport/annotationsmessage.cpp b/src/libs/clangsupport/annotationsmessage.cpp deleted file mode 100644 index 65349f6801e..00000000000 --- a/src/libs/clangsupport/annotationsmessage.cpp +++ /dev/null @@ -1,46 +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. -** -****************************************************************************/ - -#include "annotationsmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const AnnotationsMessage &message) -{ - debug.nospace() << "AnnotationsMessage(" - << message.fileContainer - << ", " << message.diagnostics.size() - << ", " << !message.firstHeaderErrorDiagnostic.text.isEmpty() - << ", " << message.tokenInfos.size() - << ", " << message.skippedPreprocessorRanges.size() - << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/annotationsmessage.h b/src/libs/clangsupport/annotationsmessage.h deleted file mode 100644 index fcafd002661..00000000000 --- a/src/libs/clangsupport/annotationsmessage.h +++ /dev/null @@ -1,112 +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 "diagnosticcontainer.h" -#include "filecontainer.h" -#include "tokeninfocontainer.h" -#include "sourcerangecontainer.h" - -#include - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT AnnotationsMessage -{ -public: - AnnotationsMessage() = default; - // For pure token infos update - AnnotationsMessage(const FileContainer &fileContainer, - const QVector &tokenInfos) - : fileContainer(fileContainer), - tokenInfos(tokenInfos), - onlyTokenInfos(true) - { - } - AnnotationsMessage(const FileContainer &fileContainer, - const QVector &diagnostics, - const DiagnosticContainer &firstHeaderErrorDiagnostic, - const QVector &tokenInfos, - const QVector &skippedPreprocessorRanges) - : fileContainer(fileContainer) - , tokenInfos(tokenInfos) - , diagnostics(diagnostics) - , firstHeaderErrorDiagnostic(firstHeaderErrorDiagnostic) - , skippedPreprocessorRanges(skippedPreprocessorRanges) - { - } - - friend QDataStream &operator<<(QDataStream &out, const AnnotationsMessage &message) - { - out << message.onlyTokenInfos; - out << message.fileContainer; - out << message.tokenInfos; - if (message.onlyTokenInfos) - return out; - out << message.diagnostics; - out << message.firstHeaderErrorDiagnostic; - out << message.skippedPreprocessorRanges; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, AnnotationsMessage &message) - { - in >> message.onlyTokenInfos; - in >> message.fileContainer; - in >> message.tokenInfos; - if (message.onlyTokenInfos) - return in; - in >> message.diagnostics; - in >> message.firstHeaderErrorDiagnostic; - in >> message.skippedPreprocessorRanges; - - return in; - } - - friend bool operator==(const AnnotationsMessage &first, const AnnotationsMessage &second) - { - return first.fileContainer == second.fileContainer - && first.diagnostics == second.diagnostics - && first.firstHeaderErrorDiagnostic == second.firstHeaderErrorDiagnostic - && first.tokenInfos == second.tokenInfos - && first.skippedPreprocessorRanges == second.skippedPreprocessorRanges; - } - - friend CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const AnnotationsMessage &message); - -public: - FileContainer fileContainer; - QVector tokenInfos; - QVector diagnostics; - DiagnosticContainer firstHeaderErrorDiagnostic; - QVector skippedPreprocessorRanges; - bool onlyTokenInfos = false; -}; - -DECLARE_MESSAGE(AnnotationsMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/baseserverproxy.cpp b/src/libs/clangsupport/baseserverproxy.cpp deleted file mode 100644 index 0c565de269b..00000000000 --- a/src/libs/clangsupport/baseserverproxy.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "baseserverproxy.h" -#include "messageenvelop.h" - -#include - -namespace ClangBackEnd { - -BaseServerProxy::BaseServerProxy(IpcClientInterface *client, QLocalSocket *localSocket) - : m_writeMessageBlock(localSocket) - , m_readMessageBlock(localSocket) - , m_client(client) -{ - if (localSocket) - QObject::connect(localSocket, &QIODevice::readyRead, [this]() { - BaseServerProxy::readMessages(); - }); -} - -BaseServerProxy::BaseServerProxy(IpcClientInterface *client, QIODevice *ioDevice) - : m_writeMessageBlock(ioDevice) - , m_readMessageBlock(ioDevice) - , m_client(client) -{ - if (ioDevice) - QObject::connect(ioDevice, &QIODevice::readyRead, [this] () { BaseServerProxy::readMessages(); }); -} - -void BaseServerProxy::readMessages() -{ - for (const auto &message : m_readMessageBlock.readAll()) - m_client->dispatch(message); -} - -void BaseServerProxy::resetState() -{ - m_writeMessageBlock.resetState(); - m_readMessageBlock.resetState(); -} - -void BaseServerProxy::setLocalSocket(QLocalSocket *localSocket) -{ - QObject::connect(localSocket, &QIODevice::readyRead, [this]() { - BaseServerProxy::readMessages(); - }); - m_writeMessageBlock.setLocalSocket(localSocket); - m_readMessageBlock.setIoDevice(localSocket); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/baseserverproxy.h b/src/libs/clangsupport/baseserverproxy.h deleted file mode 100644 index 797f02999dc..00000000000 --- a/src/libs/clangsupport/baseserverproxy.h +++ /dev/null @@ -1,58 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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" -#include "readmessageblock.h" -#include "writemessageblock.h" - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT BaseServerProxy -{ - BaseServerProxy(const BaseServerProxy&) = delete; - BaseServerProxy &operator=(const BaseServerProxy&) = delete; - -public: - BaseServerProxy(IpcClientInterface *client, QLocalSocket *localSocket); - BaseServerProxy(IpcClientInterface *client, QIODevice *ioDevice); - - void readMessages(); - - void resetState(); - - void setLocalSocket(QLocalSocket *localSocket); - -protected: - ~BaseServerProxy() = default; - -protected: - ClangBackEnd::WriteMessageBlock m_writeMessageBlock; - ClangBackEnd::ReadMessageBlock m_readMessageBlock; - IpcClientInterface *m_client; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangcodemodelclientinterface.cpp b/src/libs/clangsupport/clangcodemodelclientinterface.cpp deleted file mode 100644 index 5093308fa20..00000000000 --- a/src/libs/clangsupport/clangcodemodelclientinterface.cpp +++ /dev/null @@ -1,65 +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. -** -****************************************************************************/ - -#include "clangcodemodelclientinterface.h" -#include "clangcodemodelclientmessages.h" -#include "messageenvelop.h" - -#include -#include - -namespace ClangBackEnd { - -void ClangCodeModelClientInterface::dispatch(const MessageEnvelop &messageEnvelop) -{ - switch (messageEnvelop.messageType()) { - case MessageType::AliveMessage: - alive(); - break; - case MessageType::EchoMessage: - echo(messageEnvelop.message()); - break; - case MessageType::CompletionsMessage: - completions(messageEnvelop.message()); - break; - case MessageType::AnnotationsMessage: - annotations(messageEnvelop.message()); - break; - case MessageType::ReferencesMessage: - references(messageEnvelop.message()); - break; - case MessageType::FollowSymbolMessage: - followSymbol(messageEnvelop.message()); - break; - case MessageType::ToolTipMessage: - tooltip(messageEnvelop.message()); - break; - default: - qWarning() << "Unknown ClangCodeModelClientMessage"; - } -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/clangcodemodelclientinterface.h b/src/libs/clangsupport/clangcodemodelclientinterface.h deleted file mode 100644 index c366a055c47..00000000000 --- a/src/libs/clangsupport/clangcodemodelclientinterface.h +++ /dev/null @@ -1,66 +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 "ipcclientinterface.h" - -namespace ClangBackEnd { - -class ClangCodeModelServerInterface; - -class AnnotationsMessage; -class CompletionsMessage; -class DocumentVisibilityChangedMessage; -class DocumentsChangedMessage; -class DocumentsClosedMessage; -class DocumentsOpenedMessage; -class EchoMessage; -class FollowSymbolMessage; -class ReferencesMessage; -class RequestAnnotationsMessage; -class RequestCompletionsMessage; -class RequestFollowSymbolMessage; -class RequestReferencesMessage; -class RequestToolTipMessage; -class ToolTipMessage; -class UnsavedFilesRemovedMessage; -class UnsavedFilesUpdatedMessage; - -class CLANGSUPPORT_EXPORT ClangCodeModelClientInterface : public IpcClientInterface -{ -public: - void dispatch(const MessageEnvelop &messageEnvelop) override; - - virtual void alive() = 0; - virtual void echo(const EchoMessage &message) = 0; - virtual void completions(const CompletionsMessage &message) = 0; - virtual void annotations(const AnnotationsMessage &message) = 0; - virtual void references(const ReferencesMessage &message) = 0; - virtual void followSymbol(const FollowSymbolMessage &message) = 0; - virtual void tooltip(const ToolTipMessage &message) = 0; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangcodemodelclientmessages.h b/src/libs/clangsupport/clangcodemodelclientmessages.h deleted file mode 100644 index e73f4b99af1..00000000000 --- a/src/libs/clangsupport/clangcodemodelclientmessages.h +++ /dev/null @@ -1,34 +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 "alivemessage.h" -#include "completionsmessage.h" -#include "echomessage.h" -#include "annotationsmessage.h" -#include "referencesmessage.h" -#include "followsymbolmessage.h" -#include "tooltipmessage.h" diff --git a/src/libs/clangsupport/clangcodemodelclientproxy.cpp b/src/libs/clangsupport/clangcodemodelclientproxy.cpp deleted file mode 100644 index cf3e699e217..00000000000 --- a/src/libs/clangsupport/clangcodemodelclientproxy.cpp +++ /dev/null @@ -1,130 +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. -** -****************************************************************************/ - -#include "clangcodemodelclientproxy.h" - -#include "clangcodemodelclientmessages.h" -#include "clangcodemodelserverinterface.h" -#include "ipcserverinterface.h" -#include "messageenvelop.h" - -#include -#include -#include -#include - -namespace ClangBackEnd { - -ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, - QLocalSocket *localSocket) - : m_writeMessageBlock(localSocket) - , m_readMessageBlock(localSocket) - , m_server(server) - , m_ioDevice(localSocket) -{ - QObject::connect(m_ioDevice, &QIODevice::readyRead, [this]() { - ClangCodeModelClientProxy::readMessages(); - }); -} - -ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, - QIODevice *ioDevice) - : m_writeMessageBlock(ioDevice) - , m_readMessageBlock(ioDevice) - , m_server(server) - , m_ioDevice(ioDevice) -{ - QObject::connect(m_ioDevice, &QIODevice::readyRead, [this]() { - ClangCodeModelClientProxy::readMessages(); - }); -} - -ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelClientProxy &&other) - : m_writeMessageBlock(std::move(other.m_writeMessageBlock)), - m_readMessageBlock(std::move(other.m_readMessageBlock)), - m_server(std::move(other.m_server)), - m_ioDevice(std::move(other.m_ioDevice)) -{ - -} - -ClangCodeModelClientProxy &ClangCodeModelClientProxy::operator=(ClangCodeModelClientProxy &&other) -{ - m_writeMessageBlock = std::move(other.m_writeMessageBlock); - m_readMessageBlock = std::move(other.m_readMessageBlock); - m_server = std::move(other.m_server); - m_ioDevice = std::move(other.m_ioDevice); - - return *this; -} - -void ClangCodeModelClientProxy::alive() -{ - m_writeMessageBlock.write(AliveMessage()); -} - -void ClangCodeModelClientProxy::echo(const EchoMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelClientProxy::completions(const CompletionsMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelClientProxy::annotations(const AnnotationsMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelClientProxy::references(const ReferencesMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelClientProxy::followSymbol(const FollowSymbolMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelClientProxy::tooltip(const ToolTipMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelClientProxy::readMessages() -{ - for (const MessageEnvelop &message : m_readMessageBlock.readAll()) - m_server->dispatch(message); -} - -bool ClangCodeModelClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const -{ - return m_ioDevice == ioDevice; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/clangcodemodelclientproxy.h b/src/libs/clangsupport/clangcodemodelclientproxy.h deleted file mode 100644 index 4b0e1f9d2a5..00000000000 --- a/src/libs/clangsupport/clangcodemodelclientproxy.h +++ /dev/null @@ -1,76 +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 "clangcodemodelclientinterface.h" -#include "readmessageblock.h" -#include "writemessageblock.h" - -#include - -#include - -QT_BEGIN_NAMESPACE -class QLocalServer; -class QLocalSocket; -class QIODevice; -QT_END_NAMESPACE - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT ClangCodeModelClientProxy : public ClangCodeModelClientInterface -{ -public: - explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, - QLocalSocket *localSocket); - explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice); - ClangCodeModelClientProxy(const ClangCodeModelClientProxy&) = delete; - const ClangCodeModelClientProxy &operator=(const ClangCodeModelClientProxy&) = delete; - - ClangCodeModelClientProxy(ClangCodeModelClientProxy&&other); - ClangCodeModelClientProxy &operator=(ClangCodeModelClientProxy&&other); - - void alive() override; - void echo(const EchoMessage &message) override; - void completions(const CompletionsMessage &message) override; - void annotations(const AnnotationsMessage &message) override; - void references(const ReferencesMessage &message) override; - void followSymbol(const FollowSymbolMessage &message) override; - void tooltip(const ToolTipMessage &message) override; - - void readMessages(); - - bool isUsingThatIoDevice(QIODevice *ioDevice) const; - -private: - ClangBackEnd::WriteMessageBlock m_writeMessageBlock; - ClangBackEnd::ReadMessageBlock m_readMessageBlock; - ClangCodeModelServerInterface *m_server = nullptr; - QIODevice *m_ioDevice = nullptr; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangcodemodelconnectionclient.cpp b/src/libs/clangsupport/clangcodemodelconnectionclient.cpp deleted file mode 100644 index 618782d1d82..00000000000 --- a/src/libs/clangsupport/clangcodemodelconnectionclient.cpp +++ /dev/null @@ -1,91 +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. -** -****************************************************************************/ - -#include "clangcodemodelconnectionclient.h" - -#include -#include - -#include - -namespace ClangBackEnd { - -namespace { - -QString currentProcessId() -{ - return QString::number(QCoreApplication::applicationPid()); -} - -} - -ClangCodeModelConnectionClient::ClangCodeModelConnectionClient(ClangCodeModelClientInterface *client) - : ConnectionClient(Utils::TemporaryDirectory::masterDirectoryPath() - + QStringLiteral("/ClangBackEnd-") + currentProcessId()) - , m_serverProxy(client) -{ - m_processCreator.setTemporaryDirectoryPattern("clangbackend-XXXXXX"); - m_processCreator.setArguments({connectionName()}); - - Utils::Environment environment; - environment.set(QStringLiteral("LIBCLANG_NOTHREADS"), QString()); - environment.set(QStringLiteral("LIBCLANG_DISABLE_CRASH_RECOVERY"), QString()); - m_processCreator.setEnvironment(environment); - - stdErrPrefixer().setPrefix("clangbackend.stderr: "); - stdOutPrefixer().setPrefix("clangbackend.stdout: "); -} - -ClangCodeModelConnectionClient::~ClangCodeModelConnectionClient() -{ - finishProcess(); -} - -ClangCodeModelServerProxy &ClangCodeModelConnectionClient::serverProxy() -{ - return m_serverProxy; -} - -void ClangCodeModelConnectionClient::sendEndCommand() -{ - m_serverProxy.end(); -} - -void ClangCodeModelConnectionClient::resetState() -{ - m_serverProxy.resetState(); -} - -QString ClangCodeModelConnectionClient::outputName() const -{ - return QStringLiteral("ClangCodeModelConnectionClient"); -} - -void ClangCodeModelConnectionClient::newConnectedServer(QLocalSocket *localSocket) -{ - m_serverProxy.setLocalSocket(localSocket); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangcodemodelconnectionclient.h b/src/libs/clangsupport/clangcodemodelconnectionclient.h deleted file mode 100644 index 9b0e49ae5b3..00000000000 --- a/src/libs/clangsupport/clangcodemodelconnectionclient.h +++ /dev/null @@ -1,50 +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 "connectionclient.h" - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT ClangCodeModelConnectionClient : public ConnectionClient -{ -public: - ClangCodeModelConnectionClient(ClangCodeModelClientInterface *client); - ~ClangCodeModelConnectionClient(); - - ClangCodeModelServerProxy &serverProxy(); - -protected: - void sendEndCommand() override; - void resetState() override; - QString outputName() const override; - void newConnectedServer(QLocalSocket *localSocket) override; - -private: - ClangCodeModelServerProxy m_serverProxy; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangcodemodelserverinterface.cpp b/src/libs/clangsupport/clangcodemodelserverinterface.cpp deleted file mode 100644 index 440a6e36397..00000000000 --- a/src/libs/clangsupport/clangcodemodelserverinterface.cpp +++ /dev/null @@ -1,80 +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. -** -****************************************************************************/ - -#include "clangcodemodelserverinterface.h" -#include "clangcodemodelservermessages.h" -#include "messageenvelop.h" - -#include -#include - -namespace ClangBackEnd { - -void ClangCodeModelServerInterface::dispatch(const MessageEnvelop &messageEnvelop) -{ - switch (messageEnvelop.messageType()) { - case MessageType::EndMessage: - end(); - break; - case MessageType::DocumentsOpenedMessage: - documentsOpened(messageEnvelop.message()); - break; - case MessageType::DocumentsChangedMessage: - documentsChanged(messageEnvelop.message()); - break; - case MessageType::DocumentsClosedMessage: - documentsClosed(messageEnvelop.message()); - break; - case MessageType::DocumentVisibilityChangedMessage: - documentVisibilityChanged(messageEnvelop.message()); - break; - case MessageType::UnsavedFilesUpdatedMessage: - unsavedFilesUpdated(messageEnvelop.message()); - break; - case MessageType::UnsavedFilesRemovedMessage: - unsavedFilesRemoved(messageEnvelop.message()); - break; - case MessageType::RequestCompletionsMessage: - requestCompletions(messageEnvelop.message()); - break; - case MessageType::RequestAnnotationsMessage: - requestAnnotations(messageEnvelop.message()); - break; - case MessageType::RequestReferencesMessage: - requestReferences(messageEnvelop.message()); - break; - case MessageType::RequestFollowSymbolMessage: - requestFollowSymbol(messageEnvelop.message()); - break; - case MessageType::RequestToolTipMessage: - requestToolTip(messageEnvelop.message()); - break; - default: - qWarning() << "Unknown ClangCodeModelServerMessage"; - } -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/clangcodemodelserverinterface.h b/src/libs/clangsupport/clangcodemodelserverinterface.h deleted file mode 100644 index d582b232ea2..00000000000 --- a/src/libs/clangsupport/clangcodemodelserverinterface.h +++ /dev/null @@ -1,60 +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 "ipcserverinterface.h" - -#include "clangcodemodelclientinterface.h" - -namespace ClangBackEnd { - -class ClangCodeModelClientInterface; - -class CLANGSUPPORT_EXPORT ClangCodeModelServerInterface : public IpcServerInterface -{ -public: - ~ClangCodeModelServerInterface() override = default; - - void dispatch(const MessageEnvelop &messageEnvelop) override; - - virtual void end() = 0; - - virtual void documentsOpened(const DocumentsOpenedMessage &message) = 0; - virtual void documentsChanged(const DocumentsChangedMessage &message) = 0; - virtual void documentsClosed(const DocumentsClosedMessage &message) = 0; - virtual void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) = 0; - - virtual void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) = 0; - virtual void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) = 0; - - virtual void requestCompletions(const RequestCompletionsMessage &message) = 0; - virtual void requestAnnotations(const RequestAnnotationsMessage &message) = 0; - virtual void requestReferences(const RequestReferencesMessage &message) = 0; - virtual void requestFollowSymbol(const RequestFollowSymbolMessage &message) = 0; - virtual void requestToolTip(const RequestToolTipMessage &message) = 0; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangcodemodelservermessages.h b/src/libs/clangsupport/clangcodemodelservermessages.h deleted file mode 100644 index 5d207d5bcb2..00000000000 --- a/src/libs/clangsupport/clangcodemodelservermessages.h +++ /dev/null @@ -1,43 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "echomessage.h" -#include "endmessage.h" - -#include "documentsopenedmessage.h" -#include "documentsclosedmessage.h" -#include "documentschangedmessage.h" -#include "documentvisibilitychangedmessage.h" - -#include "unsavedfilesupdatedmessage.h" -#include "unsavedfilesremovedmessage.h" - -#include "requestannotationsmessage.h" -#include "requestcompletionsmessage.h" -#include "requestfollowsymbolmessage.h" -#include "requestreferencesmessage.h" -#include "requesttooltipmessage.h" diff --git a/src/libs/clangsupport/clangcodemodelserverproxy.cpp b/src/libs/clangsupport/clangcodemodelserverproxy.cpp deleted file mode 100644 index d77e27bffd0..00000000000 --- a/src/libs/clangsupport/clangcodemodelserverproxy.cpp +++ /dev/null @@ -1,107 +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. -** -****************************************************************************/ - -#include "clangcodemodelserverproxy.h" - -#include -#include -#include - -namespace ClangBackEnd { - -ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, - QLocalSocket *localSocket) - : BaseServerProxy(client, localSocket) -{} - -ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, - QIODevice *ioDevice) - : BaseServerProxy(client, ioDevice) -{ -} - -void ClangCodeModelServerProxy::end() -{ - m_writeMessageBlock.write(EndMessage()); -} - -void ClangCodeModelServerProxy::documentsOpened(const DocumentsOpenedMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::documentsChanged(const DocumentsChangedMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::documentsClosed(const DocumentsClosedMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::requestCompletions(const RequestCompletionsMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::requestAnnotations(const RequestAnnotationsMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::requestReferences(const RequestReferencesMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::requestFollowSymbol(const RequestFollowSymbolMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::requestToolTip(const RequestToolTipMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelServerProxy::documentVisibilityChanged( - const DocumentVisibilityChangedMessage &message) -{ - m_writeMessageBlock.write(message); -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/clangcodemodelserverproxy.h b/src/libs/clangsupport/clangcodemodelserverproxy.h deleted file mode 100644 index 356d0f51f93..00000000000 --- a/src/libs/clangsupport/clangcodemodelserverproxy.h +++ /dev/null @@ -1,68 +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 "baseserverproxy.h" -#include "clangcodemodelserverinterface.h" - -#include -#include - -#include - -QT_BEGIN_NAMESPACE -class QVariant; -class QLocalServer; -class QLocalSocket; -QT_END_NAMESPACE - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT ClangCodeModelServerProxy : public BaseServerProxy, - public ClangCodeModelServerInterface -{ -public: - ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QLocalSocket *localSocket = {}); - ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice); - - void end() override; - - void documentsOpened(const DocumentsOpenedMessage &message) override; - void documentsChanged(const DocumentsChangedMessage &message) override; - void documentsClosed(const DocumentsClosedMessage &message) override; - void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) override; - - void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) override; - void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) override; - - void requestCompletions(const RequestCompletionsMessage &message) override; - void requestAnnotations(const RequestAnnotationsMessage &message) override; - void requestReferences(const RequestReferencesMessage &message) override; - void requestFollowSymbol(const RequestFollowSymbolMessage &message) override; - void requestToolTip(const RequestToolTipMessage &message) override; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangsupport.qbs b/src/libs/clangsupport/clangsupport.qbs deleted file mode 100644 index 17697fa8229..00000000000 --- a/src/libs/clangsupport/clangsupport.qbs +++ /dev/null @@ -1,27 +0,0 @@ -import qbs 1.0 - -QtcLibrary { - name: "ClangSupport" - targetName: "Clangbackendipc" - - Depends { name: "Qt.network" } - Depends { name: "Utils" } - - cpp.defines: base.concat("CLANGSUPPORT_LIBRARY") - cpp.includePaths: base.concat(".") - - Group { - files: [ - "*.h", - "*.cpp" - ] - } - - Export { - Depends { name: "Utils" } - Depends { name: "Qt.network" } - cpp.includePaths: [ - "." - ] - } -} diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h deleted file mode 100644 index db94b896133..00000000000 --- a/src/libs/clangsupport/clangsupport_global.h +++ /dev/null @@ -1,228 +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 - -#include - -#include - -#if defined(CLANGSUPPORT_LIBRARY) -# define CLANGSUPPORT_EXPORT Q_DECL_EXPORT -#elif defined(CLANGSUPPORT_STATIC_LIBRARY) -# define CLANGSUPPORT_EXPORT -#else -# define CLANGSUPPORT_EXPORT Q_DECL_IMPORT -#endif - -#ifdef Q_CC_GNU -# define CLANGSUPPORT_GCCEXPORT __attribute__((visibility("default"))) -#else -# define CLANGSUPPORT_GCCEXPORT -#endif - -#ifndef CLANGBACKENDPROCESSPATH -# define CLANGBACKENDPROCESSPATH "" -#endif - -#ifdef UNIT_TESTS -#define unittest_public public -#else -#define unittest_public private -#endif - -namespace ClangBackEnd { - -enum class DiagnosticSeverity : quint32 // one to one mapping of the clang enum numbers -{ - Ignored = 0, - Note = 1, - Warning = 2, - Error = 3, - Fatal = 4 -}; - -enum class HighlightingType : quint8 -{ - Invalid, - Keyword, - StringLiteral, - NumberLiteral, - Comment, - Function, - VirtualFunction, - Type, - PrimitiveType, - LocalVariable, - Parameter, - Field, - GlobalVariable, - Enumeration, - Operator, - OverloadedOperator, - Preprocessor, - PreprocessorDefinition, - PreprocessorExpansion, - Punctuation, - Label, - Declaration, - FunctionDefinition, - OutputArgument, - Namespace, - Class, - Struct, - Enum, - Union, - TypeAlias, - Typedef, - QtProperty, - ObjectiveCClass, - ObjectiveCCategory, - ObjectiveCProtocol, - ObjectiveCInterface, - ObjectiveCImplementation, - ObjectiveCProperty, - ObjectiveCMethod, - TemplateTypeParameter, - TemplateTemplateParameter, - AngleBracketOpen, - AngleBracketClose, - DoubleAngleBracketClose, // clang parses ">>" as one token, even if it's closing a nested template - TernaryIf, - TernaryElse, -}; - -enum class StorageClass : quint8 -{ - Invalid, - None, - Extern, - Static, - PrivateExtern, - Auto, - Register -}; - -enum class AccessSpecifier : quint8 -{ - Invalid, - Public, - Protected, - Private -}; - -enum class CompletionCorrection : quint32 -{ - NoCorrection, - DotToArrowCorrection -}; - -enum class MessageType : quint8 { - InvalidMessage, - AliveMessage, - EchoMessage, - EndMessage, - - DocumentsOpenedMessage, - DocumentsChangedMessage, - DocumentsClosedMessage, - DocumentVisibilityChangedMessage, - - UnsavedFilesUpdatedMessage, - UnsavedFilesRemovedMessage, - - RequestAnnotationsMessage, - AnnotationsMessage, - - RequestReferencesMessage, - ReferencesMessage, - - RequestFollowSymbolMessage, - FollowSymbolMessage, - - RequestToolTipMessage, - ToolTipMessage, - - RequestCompletionsMessage, - CompletionsMessage, -}; - -template -struct MessageTypeTrait; - -template -struct MessageTrait; - -#define DECLARE_MESSAGE(Message) \ -template<> \ -struct MessageTrait \ -{ \ - static const MessageType enumeration = MessageType::Message; \ -}; - -using MixinHighlightingTypes = Utils::SizedArray; - -struct HighlightingTypes { - HighlightingType mainHighlightingType = HighlightingType::Invalid; - MixinHighlightingTypes mixinHighlightingTypes; -}; - -enum class SourceLocationKind : uchar { - Definition = 1, - Declaration, - DeclarationReference, - MacroDefinition = 128, - MacroUndefinition, - MacroUsage, - None = 255, -}; - -enum class SymbolKind : uchar -{ - None = 0, - Enumeration, - Record, - Function, - Variable, - Macro -}; - -using SymbolKinds = Utils::SizedArray; - -enum class SymbolTag : uchar -{ - None = 0, - Class, - Struct, - Union, - MsvcInterface -}; - -using SymbolTags = Utils::SizedArray; - -enum class ProgressType { Invalid, PrecompiledHeader, Indexing, DependencyCreation }; -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangsupportdebugutils.cpp b/src/libs/clangsupport/clangsupportdebugutils.cpp deleted file mode 100644 index 3d49694884a..00000000000 --- a/src/libs/clangsupport/clangsupportdebugutils.cpp +++ /dev/null @@ -1,108 +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. -** -****************************************************************************/ - -#include "clangsupportdebugutils.h" - -#include "filecontainer.h" - -#include "utf8string.h" - -#include -#include -#include -#include -#include - -namespace { - -static Q_LOGGING_CATEGORY(timersLog, "qtc.clangbackend.timers", QtWarningMsg); - -class DebugInspectionDir : public QTemporaryDir -{ -public: - DebugInspectionDir() - : QTemporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangsupport-XXXXXX")) - { - setAutoRemove(false); // Keep around for later inspection. - } -}; - -class DebugInspectionFile : public QTemporaryFile -{ -public: - DebugInspectionFile(const QString &directoryPath, - const Utf8String &id, - const Utf8String &fileContent) - : QTemporaryFile(directoryPath + QString::fromUtf8("/%1-XXXXXX").arg(id.toString())) - { - setAutoRemove(false); // Keep around for later inspection. - m_isValid = open() && write(fileContent.constData(), fileContent.byteSize()); - } - - bool isValid() const - { - return m_isValid; - } - -private: - bool m_isValid = false; -}; - -} - -namespace ClangBackEnd { - -Utf8String debugWriteFileForInspection(const Utf8String &fileContent, const Utf8String &id) -{ - static DebugInspectionDir debugInspectionDir; - if (!debugInspectionDir.isValid()) - return Utf8String(); - - DebugInspectionFile file(debugInspectionDir.path(), id, fileContent); - if (file.isValid()) - return Utf8String::fromString(file.fileName()); - return Utf8String(); -} - -Utf8String debugId(const FileContainer &fileContainer) -{ - Utf8String id(Utf8StringLiteral("unsavedfilecontent-")); - id.append(QFileInfo(fileContainer.filePath).fileName()); - return id; -} - -VerboseScopeDurationTimer::VerboseScopeDurationTimer(const char *id) - : m_id(id) -{ - if (timersLog().isDebugEnabled()) - m_timer.start(); -} - -VerboseScopeDurationTimer::~VerboseScopeDurationTimer() -{ - qCDebug(timersLog) << m_id << "needed" << m_timer.elapsed() << "ms"; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/clangsupportdebugutils.h b/src/libs/clangsupport/clangsupportdebugutils.h deleted file mode 100644 index 0e4a6da9a82..00000000000 --- a/src/libs/clangsupport/clangsupportdebugutils.h +++ /dev/null @@ -1,53 +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 - -class FileContainer; -class Utf8String; - -namespace ClangBackEnd { - -Utf8String debugWriteFileForInspection(const Utf8String &fileContent, const Utf8String &id); -Utf8String debugId(const FileContainer &fileContainer); - -class CLANGSUPPORT_EXPORT VerboseScopeDurationTimer -{ -public: - VerboseScopeDurationTimer(const char *id = nullptr); - ~VerboseScopeDurationTimer(); - -private: - const char * const m_id; - QElapsedTimer m_timer; -}; - -} // namespace ClangBackEnd - -#define TIME_SCOPE_DURATION(id) ClangBackEnd::VerboseScopeDurationTimer scopeDurationTimer(id) diff --git a/src/libs/clangsupport/codecompletion.cpp b/src/libs/clangsupport/codecompletion.cpp deleted file mode 100644 index 6e1b9ca53fe..00000000000 --- a/src/libs/clangsupport/codecompletion.cpp +++ /dev/null @@ -1,101 +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. -** -****************************************************************************/ - -#include "codecompletion.h" - -#include - -#include - -namespace ClangBackEnd { - -static const char *completionKindToString(CodeCompletion::Kind kind) -{ - switch (kind) { - case CodeCompletion::Other: return "Other"; - case CodeCompletion::FunctionCompletionKind: return "Function"; - case CodeCompletion::FunctionDefinitionCompletionKind: return "FunctionDefinitionCompletion"; - case CodeCompletion::TemplateFunctionCompletionKind: return "TemplateFunction"; - case CodeCompletion::FunctionOverloadCompletionKind: return "FunctionOverload"; - case CodeCompletion::ConstructorCompletionKind: return "Constructor"; - case CodeCompletion::DestructorCompletionKind: return "Destructor"; - case CodeCompletion::VariableCompletionKind: return "Variable"; - case CodeCompletion::ClassCompletionKind: return "Class"; - case CodeCompletion::TypeAliasCompletionKind: return "TypeAlias"; - case CodeCompletion::TemplateClassCompletionKind: return "TemplateClass"; - case CodeCompletion::EnumerationCompletionKind: return "Enumeration"; - case CodeCompletion::EnumeratorCompletionKind: return "Enumerator"; - case CodeCompletion::NamespaceCompletionKind: return "Namespace"; - case CodeCompletion::PreProcessorCompletionKind: return "PreProcessor"; - case CodeCompletion::SignalCompletionKind: return "Signal"; - case CodeCompletion::SlotCompletionKind: return "Slot"; - case CodeCompletion::ObjCMessageCompletionKind: return "ObjCMessage"; - case CodeCompletion::KeywordCompletionKind: return "Keyword"; - case CodeCompletion::ClangSnippetKind: return "ClangSnippet"; - } - - return nullptr; -} - -static const char *availabilityToString(CodeCompletion::Availability availability) -{ - switch (availability) { - case CodeCompletion::Available: return "Available"; - case CodeCompletion::Deprecated: return "Deprecated"; - case CodeCompletion::NotAvailable: return "NotAvailable"; - case CodeCompletion::NotAccessible: return "NotAccessible"; - } - return nullptr; -} - -QDebug operator<<(QDebug debug, const CodeCompletion &message) -{ - debug.nospace() << "CodeCompletion("; - - debug.nospace() << message.text << ", "; - debug.nospace() << message.priority << ", "; - debug.nospace() << completionKindToString(message.completionKind) << ", "; - debug.nospace() << availabilityToString(message.availability) << ", "; - if (!message.requiredFixIts.isEmpty()) - debug.nospace() << message.requiredFixIts << ", "; - debug.nospace() << message.hasParameters; - - debug.nospace() << ")"; - - return debug; -} - -std::ostream &operator<<(std::ostream &os, const CodeCompletion::Kind kind) -{ - return os << completionKindToString(kind); -} - -std::ostream &operator<<(std::ostream &os, const CodeCompletion::Availability availability) -{ - return os << availabilityToString(availability); -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/codecompletion.h b/src/libs/clangsupport/codecompletion.h deleted file mode 100644 index a8f0e142b2f..00000000000 --- a/src/libs/clangsupport/codecompletion.h +++ /dev/null @@ -1,147 +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 "codecompletionchunk.h" -#include "fixitcontainer.h" - -#include "utf8string.h" - -#include -#include - -namespace ClangBackEnd { - -class CodeCompletion; -using CodeCompletions = QVector; - -class CodeCompletion -{ -public: - enum Kind : uint8_t { - Other = 0, - FunctionCompletionKind, - FunctionDefinitionCompletionKind, - FunctionOverloadCompletionKind, - TemplateFunctionCompletionKind, - ClassCompletionKind, - ConstructorCompletionKind, - DestructorCompletionKind, - VariableCompletionKind, - TypeAliasCompletionKind, - TemplateClassCompletionKind, - EnumerationCompletionKind, - EnumeratorCompletionKind, - NamespaceCompletionKind, - PreProcessorCompletionKind, - SignalCompletionKind, - SlotCompletionKind, - ObjCMessageCompletionKind, - KeywordCompletionKind, - ClangSnippetKind - }; - - enum Availability : quint32 { - Available, - Deprecated, - NotAvailable, - NotAccessible - }; - -public: - CodeCompletion() = default; - CodeCompletion(const Utf8String &text, - quint32 priority = 0, - Kind completionKind = Other, - Availability availability = Available, - bool hasParameters = false) - : text(text), - priority(priority), - completionKind(completionKind), - availability(availability), - hasParameters(hasParameters) - { - } - - friend QDataStream &operator<<(QDataStream &out, const CodeCompletion &message) - { - out << message.text; - out << message.briefComment; - out << message.chunks; - out << message.requiredFixIts; - out << message.priority; - out << static_cast(message.completionKind); - out << static_cast(message.availability); - out << message.hasParameters; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, CodeCompletion &message) - { - quint32 completionKind; - quint32 availability; - - in >> message.text; - in >> message.briefComment; - in >> message.chunks; - in >> message.requiredFixIts; - in >> message.priority; - in >> completionKind; - in >> availability; - in >> message.hasParameters; - - message.completionKind = static_cast(completionKind); - message.availability = static_cast(availability); - - return in; - } - - friend bool operator==(const CodeCompletion &first, const CodeCompletion &second) - { - return first.text == second.text - && first.completionKind == second.completionKind - && first.requiredFixIts == second.requiredFixIts; - } - -public: - Utf8String text; - Utf8String briefComment; - CodeCompletionChunks chunks; - QVector requiredFixIts; - quint32 priority = 0; - Kind completionKind = Other; - Availability availability = NotAvailable; - bool hasParameters = false; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message); -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, CodeCompletion::Kind kind); - -CLANGSUPPORT_EXPORT std::ostream &operator<<(std::ostream &os, const CodeCompletion::Kind kind); -CLANGSUPPORT_EXPORT std::ostream &operator<<(std::ostream &os, const CodeCompletion::Availability availability); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/codecompletionchunk.cpp b/src/libs/clangsupport/codecompletionchunk.cpp deleted file mode 100644 index b4371f24019..00000000000 --- a/src/libs/clangsupport/codecompletionchunk.cpp +++ /dev/null @@ -1,84 +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. -** -****************************************************************************/ - -#include "codecompletionchunk.h" - -#include - -#include - -namespace ClangBackEnd { - -static const char *completionChunkKindToString(CodeCompletionChunk::Kind kind) -{ - switch (kind) { - case CodeCompletionChunk::Optional: return "Optional"; - case CodeCompletionChunk::TypedText: return "TypedText"; - case CodeCompletionChunk::Text: return "Text"; - case CodeCompletionChunk::Placeholder: return "Placeholder"; - case CodeCompletionChunk::Informative: return "Informative"; - case CodeCompletionChunk::CurrentParameter: return "CurrentParameter"; - case CodeCompletionChunk::LeftParen: return "LeftParen"; - case CodeCompletionChunk::RightParen: return "RightParen"; - case CodeCompletionChunk::LeftBracket: return "LeftBracket"; - case CodeCompletionChunk::RightBracket: return "RightBracket"; - case CodeCompletionChunk::LeftBrace: return "LeftBrace"; - case CodeCompletionChunk::RightBrace: return "RightBrace"; - case CodeCompletionChunk::LeftAngle: return "LeftAngle"; - case CodeCompletionChunk::RightAngle: return "RightAngle"; - case CodeCompletionChunk::Comma: return "Comma"; - case CodeCompletionChunk::ResultType: return "ResultType"; - case CodeCompletionChunk::Colon: return "Colon"; - case CodeCompletionChunk::SemiColon: return "SemiColon"; - case CodeCompletionChunk::Equal: return "Equal"; - case CodeCompletionChunk::HorizontalSpace: return "HorizontalSpace"; - case CodeCompletionChunk::VerticalSpace: return "VerticalSpace"; - case CodeCompletionChunk::Invalid: return "Invalid"; - } - - return nullptr; -} - -QDebug operator<<(QDebug debug, const CodeCompletionChunk &chunk) -{ - debug.nospace() << "CodeCompletionChunk("; - debug.nospace() << completionChunkKindToString(chunk.kind) << ", "; - debug.nospace() << chunk.text; - - if (chunk.isOptional) - debug.nospace() << ", optional"; - - debug.nospace() << ")"; - - return debug; -} - -std::ostream &operator<<(std::ostream &os, const CodeCompletionChunk::Kind &kind) -{ - return os << completionChunkKindToString(kind); -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/codecompletionchunk.h b/src/libs/clangsupport/codecompletionchunk.h deleted file mode 100644 index e04d3351af1..00000000000 --- a/src/libs/clangsupport/codecompletionchunk.h +++ /dev/null @@ -1,117 +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 "utf8string.h" - -#include -#include - -namespace ClangBackEnd { - -class CodeCompletionChunk; -using CodeCompletionChunks = QVector; - -class CodeCompletionChunk -{ -public: - enum Kind : quint8 { - Optional, - TypedText, - Text, - Placeholder, - Informative, - CurrentParameter, - LeftParen, - RightParen, - LeftBracket, - RightBracket, - LeftBrace, - RightBrace, - LeftAngle, - RightAngle, - Comma, - ResultType, - Colon, - SemiColon, - Equal, - HorizontalSpace, - VerticalSpace, - Invalid = 255 - }; - - CodeCompletionChunk() = default; - CodeCompletionChunk(Kind kind, - const Utf8String &text, - bool isOptional = false) - : text(text), - kind(kind), - isOptional(isOptional) - { - } - - friend QDataStream &operator<<(QDataStream &out, const CodeCompletionChunk &chunk) - { - out << static_cast(chunk.kind); - out << chunk.text; - out << chunk.isOptional; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, CodeCompletionChunk &chunk) - { - quint8 kind; - - in >> kind; - in >> chunk.text; - in >> chunk.isOptional; - - chunk.kind = static_cast(kind); - - return in; - } - - friend bool operator==(const CodeCompletionChunk &first, const CodeCompletionChunk &second) - { - return first.kind == second.kind - && first.text == second.text - && first.isOptional == second.isOptional; - } - -public: - Utf8String text; - Kind kind = Invalid; - bool isOptional = false; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CodeCompletionChunk &chunk); - -CLANGSUPPORT_EXPORT std::ostream &operator<<(std::ostream &os, const CodeCompletionChunk::Kind &kind); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/completionsmessage.cpp b/src/libs/clangsupport/completionsmessage.cpp deleted file mode 100644 index d41f3dfe971..00000000000 --- a/src/libs/clangsupport/completionsmessage.cpp +++ /dev/null @@ -1,45 +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. -** -****************************************************************************/ - -#include "completionsmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const CompletionsMessage &message) -{ - debug.nospace() << "CompletionsMessage("; - - debug.nospace() << message.codeCompletions << ", " - << message.ticketNumber; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/completionsmessage.h b/src/libs/clangsupport/completionsmessage.h deleted file mode 100644 index f23256c06fc..00000000000 --- a/src/libs/clangsupport/completionsmessage.h +++ /dev/null @@ -1,77 +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 "codecompletion.h" - -#include - -#include - -namespace ClangBackEnd { - -class CompletionsMessage -{ -public: - CompletionsMessage() = default; - CompletionsMessage(const CodeCompletions &codeCompletions, - quint64 ticketNumber) - : codeCompletions(codeCompletions) - , ticketNumber(ticketNumber) - { - } - - friend QDataStream &operator<<(QDataStream &out, const CompletionsMessage &message) - { - out << message.codeCompletions; - out << message.ticketNumber; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, CompletionsMessage &message) - { - in >> message.codeCompletions; - in >> message.ticketNumber; - - return in; - } - - friend bool operator==(const CompletionsMessage &first, const CompletionsMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.codeCompletions == second.codeCompletions; - } - -public: - CodeCompletions codeCompletions; - quint64 ticketNumber = 0; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CompletionsMessage &message); - -DECLARE_MESSAGE(CompletionsMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/connectionclient.cpp b/src/libs/clangsupport/connectionclient.cpp deleted file mode 100644 index 9645c1f6a42..00000000000 --- a/src/libs/clangsupport/connectionclient.cpp +++ /dev/null @@ -1,393 +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. -** -****************************************************************************/ - -#include "connectionclient.h" - -#include "clangsupportdebugutils.h" -#include "processstartedevent.h" -#include "processexception.h" - -#include - -#include -#include -#include -#include - -using namespace Utils; - -namespace ClangBackEnd { - -ConnectionClient::ConnectionClient(const QString &connectionName) - : m_connectionName(connectionName) -{ - m_processCreator.setObserver(this); - - listenForConnections(); - - m_processAliveTimer.setInterval(10000); - resetTemporaryDirectory(); - - static const bool startAliveTimer = !qEnvironmentVariableIntValue("QTC_CLANG_NO_ALIVE_TIMER"); - - if (startAliveTimer) - connectAliveTimer(); - - connectNewConnection(); -} - -ConnectionClient::~ConnectionClient() -{ - QLocalServer::removeServer(connectionName()); -} - -void ConnectionClient::startProcessAndConnectToServerAsynchronously() -{ - m_processIsStarting = true; - - m_processFuture = m_processCreator.createProcess(); -} - -void ConnectionClient::disconnectFromServer() -{ - if (m_localSocket) - m_localSocket->disconnectFromServer(); -} - -bool ConnectionClient::isConnected() const -{ - return m_localSocket && m_localSocket->state() == QLocalSocket::ConnectedState; -} - -void ConnectionClient::ensureMessageIsWritten() -{ - while (isConnected() && m_localSocket->bytesToWrite() > 0) - m_localSocket->waitForBytesWritten(50); -} - -void ConnectionClient::sendEndMessage() -{ - sendEndCommand(); - m_localSocket->flush(); - ensureMessageIsWritten(); -} - -void ConnectionClient::resetProcessAliveTimer() -{ - m_isAliveTimerResetted = true; - m_processAliveTimer.start(); -} - -void ConnectionClient::setProcessAliveTimerInterval(int processTimerInterval) -{ - m_processAliveTimer.setInterval(processTimerInterval); -} - -const QTemporaryDir &ConnectionClient::temporaryDirectory() const -{ - return m_processCreator.temporaryDirectory(); -} - -LinePrefixer &ConnectionClient::stdErrPrefixer() -{ - return m_stdErrPrefixer; -} - -LinePrefixer &ConnectionClient::stdOutPrefixer() -{ - return m_stdOutPrefixer; -} - -QString ConnectionClient::connectionName() const -{ - return m_connectionName; -} - -bool ConnectionClient::event(QEvent *event) -{ - if (event->type() == int(ProcessStartedEvent::ProcessStarted)) { - getProcessFromFuture(); - - return true; - }; - - return false; -} - -void ConnectionClient::restartProcessAsynchronously() -{ - getProcessFromFuture(); - - finishProcess(std::move(m_process)); - resetTemporaryDirectory(); // clear left-over preambles - - startProcessAndConnectToServerAsynchronously(); - -} - -void ConnectionClient::restartProcessIfTimerIsNotResettedAndSocketIsEmpty() -{ - if (m_isAliveTimerResetted) { - m_isAliveTimerResetted = false; - return; // Already reset, but we were scheduled after. - } - - if (!m_localSocket || m_localSocket->bytesAvailable() > 0) - return; // We come first, the incoming data was not yet processed. - - disconnectLocalSocketDisconnected(); - disconnectFromServer(); - restartProcessAsynchronously(); -} - -void ConnectionClient::endProcess(QtcProcess *process) -{ - if (isProcessRunning(process) && isConnected()) { - sendEndMessage(); - process->waitForFinished(); - } -} - -void ConnectionClient::terminateProcess(QtcProcess *process) -{ - if (!HostOsInfo::isWindowsHost() && isProcessRunning()) { - process->terminate(); - process->waitForFinished(1000); - } -} - -void ConnectionClient::killProcess(QtcProcess *process) -{ - if (isProcessRunning(process)) { - process->kill(); - process->waitForFinished(1000); - } -} - -void ConnectionClient::finishConnection() -{ - if (m_localSocket) { - if (m_localSocket->state() != QLocalSocket::UnconnectedState) - m_localSocket->disconnectFromServer(); - m_localSocket = nullptr; - } -} - -void ConnectionClient::printLocalSocketError(QLocalSocket::LocalSocketError socketError) -{ - if (m_localSocket && socketError != QLocalSocket::ServerNotFoundError) - qWarning() << outputName() << "LocalSocket Error:" << m_localSocket->errorString(); -} - -void ConnectionClient::printStandardOutput() -{ - qDebug("%s", m_stdOutPrefixer.prefix(m_process->readAllStandardOutput()).constData()); -} - -void ConnectionClient::printStandardError() -{ - qDebug("%s", m_stdErrPrefixer.prefix(m_process->readAllStandardError()).constData()); -} - -void ConnectionClient::resetTemporaryDirectory() -{ - m_processCreator.resetTemporaryDirectory(); -} - -void ConnectionClient::initializeProcess(QtcProcess *process) -{ - connectStandardOutputAndError(process); - - resetProcessAliveTimer(); -} - -void ConnectionClient::connectLocalSocketDisconnected() -{ - connect(m_localSocket, - &QLocalSocket::disconnected, - this, - &ConnectionClient::disconnectedFromLocalSocket); - connect(m_localSocket, - &QLocalSocket::disconnected, - this, - &ConnectionClient::restartProcessAsynchronously); -} - -void ConnectionClient::disconnectLocalSocketDisconnected() -{ - if (m_localSocket) { - disconnect(m_localSocket, - &QLocalSocket::disconnected, - this, - &ConnectionClient::restartProcessAsynchronously); - } -} - -void ConnectionClient::finishProcess() -{ - finishProcess(std::move(m_process)); - emit processFinished(); -} - -bool ConnectionClient::isProcessRunning() -{ - getProcessFromFuture(); - - return isProcessRunning(m_process.get()); -} - -void ConnectionClient::finishProcess(QProcessUniquePointer &&process) -{ - disconnectLocalSocketDisconnected(); - - if (process) { - m_processAliveTimer.stop(); - - endProcess(process.get()); - finishConnection(); - terminateProcess(process.get()); - killProcess(process.get()); - - resetState(); - } else { - finishConnection(); - } -} - -bool ConnectionClient::waitForEcho() -{ - return m_localSocket->waitForReadyRead(); -} - -bool ConnectionClient::waitForConnected() -{ - bool isConnected = false; - - for (int counter = 0; counter < 100; counter++) { - isConnected = m_localSocket && m_localSocket->waitForConnected(20); - if (isConnected) - return isConnected; - else { - QThread::msleep(30); - QCoreApplication::processEvents(); - } - } - - if (m_localSocket) - qWarning() << outputName() << "cannot connect:" << m_localSocket->errorString(); - - return isConnected; -} - - -QtcProcess *ConnectionClient::processForTestOnly() -{ - getProcessFromFuture(); - - return m_process.get(); -} - -QIODevice *ConnectionClient::ioDevice() -{ - return m_localSocket; -} - -bool ConnectionClient::isProcessRunning(QtcProcess *process) -{ - return process && process->state() == QProcess::Running; -} - -void ConnectionClient::connectStandardOutputAndError(QtcProcess *process) const -{ - connect(process, &QtcProcess::readyReadStandardOutput, this, &ConnectionClient::printStandardOutput); - connect(process, &QtcProcess::readyReadStandardError, this, &ConnectionClient::printStandardError); -} - -void ConnectionClient::connectLocalSocketError() const -{ - connect(m_localSocket, - &QLocalSocket::errorOccurred, - this, - &ConnectionClient::printLocalSocketError); -} - -void ConnectionClient::connectAliveTimer() -{ - connect(&m_processAliveTimer, - &QTimer::timeout, - this, - &ConnectionClient::restartProcessIfTimerIsNotResettedAndSocketIsEmpty); -} - -void ConnectionClient::connectNewConnection() -{ - QObject::connect(&m_localServer, - &QLocalServer::newConnection, - this, - &ConnectionClient::handleNewConnection); -} - -void ConnectionClient::handleNewConnection() -{ - m_localSocket = m_localServer.nextPendingConnection(); - - connectLocalSocketError(); - connectLocalSocketDisconnected(); - - newConnectedServer(m_localSocket); - - emit connectedToLocalSocket(); -} - -void ConnectionClient::getProcessFromFuture() -{ - try { - if (m_processFuture.valid()) { - m_process = m_processFuture.get(); - m_processIsStarting = false; - - initializeProcess(m_process.get()); - } - } catch (const ProcessException &processExeption) { - qWarning() << "Clang backend process is not working." - << QLatin1String(processExeption.what()); - } -} - -void ConnectionClient::listenForConnections() -{ - bool isListing = m_localServer.listen(connectionName()); - - if (!isListing) - qWarning() << "ConnectionClient: QLocalServer is not listing for connections!"; -} - -void ConnectionClient::setProcessPath(const QString &processPath) -{ - m_processCreator.setProcessPath(processPath); -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/connectionclient.h b/src/libs/clangsupport/connectionclient.h deleted file mode 100644 index aae1864ff5b..00000000000 --- a/src/libs/clangsupport/connectionclient.h +++ /dev/null @@ -1,146 +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 "clangcodemodelserverproxy.h" -#include "lineprefixer.h" -#include "processcreator.h" -#include "processhandle.h" - -#include -#include -#include -#include - -#include -#include - -namespace Utils { class QtcProcess; } - -class Utf8String; -class Utf8StringVector; - -namespace ClangBackEnd { - -class FileContainer; - -class CLANGSUPPORT_EXPORT ConnectionClient : public QObject -{ - Q_OBJECT - -public: - ConnectionClient(const QString &connectionName); - - ConnectionClient(const ConnectionClient &) = delete; - ConnectionClient &operator=(const ConnectionClient &) = delete; - - void startProcessAndConnectToServerAsynchronously(); - void disconnectFromServer(); - bool isConnected() const; - - void sendEndMessage(); - - void resetProcessAliveTimer(); - void setProcessAliveTimerInterval(int processTimerInterval); - - void setProcessPath(const QString &processPath); - - void restartProcessAsynchronously(); - void restartProcessIfTimerIsNotResettedAndSocketIsEmpty(); - void finishProcess(); - bool isProcessRunning(); - - bool waitForEcho(); - bool waitForConnected(); - - Utils::QtcProcess *processForTestOnly(); - -signals: - void connectedToLocalSocket(); - void disconnectedFromLocalSocket(); - void processFinished(); - -protected: - ~ConnectionClient(); - -protected: - QIODevice *ioDevice(); - const QTemporaryDir &temporaryDirectory() const; - LinePrefixer &stdErrPrefixer(); - LinePrefixer &stdOutPrefixer(); - - virtual void sendEndCommand() = 0; - virtual void resetState() = 0; - virtual QString outputName() const = 0; - - QString connectionName() const; - bool event(QEvent* event) override; - - virtual void newConnectedServer(QLocalSocket *localSocket) = 0; - -private: - static bool isProcessRunning(Utils::QtcProcess *process); - void finishProcess(QProcessUniquePointer &&process); - void endProcess(Utils::QtcProcess *process); - void terminateProcess(Utils::QtcProcess *process); - void killProcess(Utils::QtcProcess *process); - void finishConnection(); - void printLocalSocketError(QLocalSocket::LocalSocketError socketError); - void printStandardOutput(); - void printStandardError(); - void initializeProcess(Utils::QtcProcess *process); - - void resetTemporaryDirectory(); - - void connectLocalSocketDisconnected(); - void disconnectLocalSocketDisconnected(); - void connectStandardOutputAndError(Utils::QtcProcess *process) const; - void connectLocalSocketError() const; - void connectAliveTimer(); - void connectNewConnection(); - void handleNewConnection(); - void getProcessFromFuture(); - void listenForConnections(); - - void ensureMessageIsWritten(); - -protected: - ProcessCreator m_processCreator; - -private: - LinePrefixer m_stdErrPrefixer; - LinePrefixer m_stdOutPrefixer; - QLocalServer m_localServer; - std::future m_processFuture; - mutable QProcessUniquePointer m_process; - QLocalSocket *m_localSocket = nullptr; - QTimer m_processAliveTimer; - QString m_connectionName; - bool m_isAliveTimerResetted = false; - bool m_processIsStarting = false; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/connectionserver.cpp b/src/libs/clangsupport/connectionserver.cpp deleted file mode 100644 index ae6a3a11360..00000000000 --- a/src/libs/clangsupport/connectionserver.cpp +++ /dev/null @@ -1,31 +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. -** -****************************************************************************/ - -#include "connectionserver.h" - -namespace ClangBackEnd { - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/connectionserver.h b/src/libs/clangsupport/connectionserver.h deleted file mode 100644 index c9288fd9aff..00000000000 --- a/src/libs/clangsupport/connectionserver.h +++ /dev/null @@ -1,142 +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 -#include -#include -#include -#include - -#include -#include -#include - -namespace ClangBackEnd { - -class ClangCodeModelServerInterface; -class ClangCodeModelClientProxy; - -template -class ConnectionServer -{ -public: - ConnectionServer() - { - m_aliveTimer.start(5000); - - connectAliveTimer(); - connectLocalSocketDisconnet(); - } - - ~ConnectionServer() - { - if (m_localSocket.state() != QLocalSocket::UnconnectedState) - m_localSocket.disconnectFromServer(); - } - - void start(const QString &connectionName) - { - connectToLocalServer(connectionName); - } - - void setServer(ServerInterface *ipcServer) - { - this->m_ipcServer = ipcServer; - - } - - void ensureAliveMessageIsSent() - { - if (m_aliveTimer.remainingTime() == 0) - sendAliveMessage(); - } - -private: - void connectToLocalServer(const QString &connectionName) - { - QObject::connect(&m_localSocket, - &QLocalSocket::errorOccurred, - [&] (QLocalSocket::LocalSocketError) { - qWarning() << "ConnectionServer error:" << m_localSocket.errorString() << connectionName; - }); - - m_localSocket.connectToServer(connectionName); - m_ipcClientProxy = std::make_unique(m_ipcServer, &m_localSocket); - - m_ipcServer->setClient(m_ipcClientProxy.get()); - } - - void sendAliveMessage() - { - if (m_ipcClientProxy) - m_ipcClientProxy->alive(); - } - - void handleSocketDisconnect() - { - m_ipcClientProxy.reset(); - - delayedExitApplicationIfNoSockedIsConnected(); - } - - void delayedExitApplicationIfNoSockedIsConnected() - { - QTimer::singleShot(60000, [&] { exitApplicationIfNoSockedIsConnected(); }); - } - - void exitApplicationIfNoSockedIsConnected() - { - if (m_localSocket.state() != QLocalSocket::UnconnectedState) - m_localSocket.disconnectFromServer(); - QCoreApplication::exit(); - } - - void connectAliveTimer() - { - QObject::connect(&m_aliveTimer, - &QTimer::timeout, - [&] { sendAliveMessage(); }); - } - - void connectLocalSocketDisconnet() - { - QObject::connect(&m_localSocket, - &QLocalSocket::disconnected, - [&] { handleSocketDisconnect(); }); - } - -private: - QLocalSocket m_localSocket; - QTimer m_aliveTimer; - std::unique_ptr m_ipcClientProxy; - ServerInterface *m_ipcServer = nullptr; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/diagnosticcontainer.cpp b/src/libs/clangsupport/diagnosticcontainer.cpp deleted file mode 100644 index 1f7c013f0b5..00000000000 --- a/src/libs/clangsupport/diagnosticcontainer.cpp +++ /dev/null @@ -1,63 +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. -** -****************************************************************************/ - -#include "diagnosticcontainer.h" - -#include - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DiagnosticContainer &container) -{ - debug.nospace() << "DiagnosticContainer(" - << container.text << ", " - << container.category << ", " - << container.enableOption << ", " - << container.disableOption << ", " - << container.location << ", " - << container.ranges << ", " - << container.fixIts << ", " - << container.children - << ")"; - - return debug; -} - -QDebug operator<<(QDebug debug, const QVector &containers) -{ - debug.nospace() << "{"; - for (int i = 0; i < containers.size(); i++) { - debug.nospace() << containers[i]; - if (i < containers.size() - 1) - debug.nospace() << ", "; - } - debug.nospace() << "}"; - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/diagnosticcontainer.h b/src/libs/clangsupport/diagnosticcontainer.h deleted file mode 100644 index 65306bf8a6b..00000000000 --- a/src/libs/clangsupport/diagnosticcontainer.h +++ /dev/null @@ -1,130 +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 "sourcerangecontainer.h" -#include "fixitcontainer.h" - -#include -#include - -#include - -namespace ClangBackEnd { - -class DiagnosticContainer -{ -public: - DiagnosticContainer() = default; - DiagnosticContainer(const Utf8String &text, - const Utf8String &category, - const std::pair &options, - DiagnosticSeverity severity, - const SourceLocationContainer &location, - const QVector &ranges, - const QVector &fixIts, - const QVector &children) - : location(location), - ranges(ranges), - text(text), - category(category), - enableOption(options.first), - disableOption(options.second), - children(children), - fixIts(fixIts), - severity(severity) - { - for (auto it = this->children.begin(); it != this->children.end(); ++it) { - if (it->text == "note: remove constant to silence this warning") { - this->children.erase(it); - break; - } - } - } - - friend QDataStream &operator<<(QDataStream &out, const DiagnosticContainer &container) - { - out << container.text; - out << container.category; - out << container.enableOption; - out << container.disableOption; - out << container.location; - out << static_cast(container.severity); - out << container.ranges; - out << container.fixIts; - out << container.children; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DiagnosticContainer &container) - { - quint32 severity; - - in >> container.text; - in >> container.category; - in >> container.enableOption; - in >> container.disableOption; - in >> container.location; - in >> severity; - in >> container.ranges; - in >> container.fixIts; - in >> container.children; - - container.severity = static_cast(severity); - - return in; - } - - friend bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &second) - { - return first.text == second.text - && first.location == second.location; - } - - friend bool operator!=(const DiagnosticContainer &first, const DiagnosticContainer &second) - { - return !(first == second); - } - -public: - SourceLocationContainer location; - QVector ranges; - Utf8String text; - Utf8String category; - Utf8String enableOption; - Utf8String disableOption; - QVector children; - QVector fixIts; - DiagnosticSeverity severity = DiagnosticSeverity::Ignored; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DiagnosticContainer &container); -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QVector &container); - - - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/documentschangedmessage.cpp b/src/libs/clangsupport/documentschangedmessage.cpp deleted file mode 100644 index 41512d8081a..00000000000 --- a/src/libs/clangsupport/documentschangedmessage.cpp +++ /dev/null @@ -1,45 +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. -** -****************************************************************************/ - -#include "documentschangedmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DocumentsChangedMessage &message) -{ - debug.nospace() << "DocumentsChangedMessage("; - - for (const FileContainer &fileContainer : message.fileContainers) - debug.nospace() << fileContainer<< ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/documentschangedmessage.h b/src/libs/clangsupport/documentschangedmessage.h deleted file mode 100644 index 3d3f6138e8c..00000000000 --- a/src/libs/clangsupport/documentschangedmessage.h +++ /dev/null @@ -1,70 +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 "filecontainer.h" - -#include - -namespace ClangBackEnd { - -class DocumentsChangedMessage -{ -public: - DocumentsChangedMessage() = default; - DocumentsChangedMessage(const QVector &fileContainers) - : fileContainers(fileContainers) - { - } - - friend QDataStream &operator<<(QDataStream &out, const DocumentsChangedMessage &message) - { - out << message.fileContainers; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DocumentsChangedMessage &message) - { - in >> message.fileContainers; - - return in; - } - - friend bool operator==(const DocumentsChangedMessage &first, - const DocumentsChangedMessage &second) - { - return first.fileContainers == second.fileContainers; - } - -public: - QVector fileContainers; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsChangedMessage &message); - -DECLARE_MESSAGE(DocumentsChangedMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/documentsclosedmessage.cpp b/src/libs/clangsupport/documentsclosedmessage.cpp deleted file mode 100644 index 7c23586b836..00000000000 --- a/src/libs/clangsupport/documentsclosedmessage.cpp +++ /dev/null @@ -1,45 +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. -** -****************************************************************************/ - -#include "documentsclosedmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DocumentsClosedMessage &message) -{ - debug.nospace() << "DocumentsClosedMessage("; - - for (const FileContainer &fileContainer : message.fileContainers) - debug.nospace() << fileContainer << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/documentsclosedmessage.h b/src/libs/clangsupport/documentsclosedmessage.h deleted file mode 100644 index 458a78fa8c9..00000000000 --- a/src/libs/clangsupport/documentsclosedmessage.h +++ /dev/null @@ -1,71 +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 "filecontainer.h" - -#include - -namespace ClangBackEnd { - -class DocumentsClosedMessage -{ -public: - DocumentsClosedMessage() = default; - DocumentsClosedMessage(const QVector &fileContainers) - : fileContainers(fileContainers) - { - } - - friend QDataStream &operator<<(QDataStream &out, const DocumentsClosedMessage &message) - { - out << message.fileContainers; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DocumentsClosedMessage &message) - { - in >> message.fileContainers; - - return in; - } - - friend bool operator==(const DocumentsClosedMessage &first, const DocumentsClosedMessage &second) - { - return first.fileContainers == second.fileContainers; - } - -public: - QVector fileContainers; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsClosedMessage &message); - -DECLARE_MESSAGE(DocumentsClosedMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/documentsopenedmessage.cpp b/src/libs/clangsupport/documentsopenedmessage.cpp deleted file mode 100644 index 647899b3fe1..00000000000 --- a/src/libs/clangsupport/documentsopenedmessage.cpp +++ /dev/null @@ -1,50 +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. -** -****************************************************************************/ - -#include "documentsopenedmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DocumentsOpenedMessage &message) -{ - debug.nospace() << "DocumentsOpenedMessage("; - - for (const FileContainer &fileContainer : message.fileContainers) - debug.nospace() << fileContainer<< ", "; - - debug.nospace() << message.currentEditorFilePath << ", "; - - for (const Utf8String &visibleEditorFilePath : message.visibleEditorFilePaths) - debug.nospace() << visibleEditorFilePath << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/documentsopenedmessage.h b/src/libs/clangsupport/documentsopenedmessage.h deleted file mode 100644 index d56596ef7b8..00000000000 --- a/src/libs/clangsupport/documentsopenedmessage.h +++ /dev/null @@ -1,81 +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 "filecontainer.h" - -#include -#include - -namespace ClangBackEnd { - -class DocumentsOpenedMessage -{ -public: - DocumentsOpenedMessage() = default; - DocumentsOpenedMessage(const QVector &fileContainers, - const Utf8String ¤tEditorFilePath, - const Utf8StringVector &visibleEditorFilePaths) - : fileContainers(fileContainers) - , currentEditorFilePath(currentEditorFilePath) - , visibleEditorFilePaths(visibleEditorFilePaths) - { - } - - friend QDataStream &operator<<(QDataStream &out, const DocumentsOpenedMessage &message) - { - out << message.fileContainers; - out << message.currentEditorFilePath; - out << message.visibleEditorFilePaths; - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DocumentsOpenedMessage &message) - { - in >> message.fileContainers; - in >> message.currentEditorFilePath; - in >> message.visibleEditorFilePaths; - - return in; - } - - friend bool operator==(const DocumentsOpenedMessage &first, const DocumentsOpenedMessage &second) - { - return first.fileContainers == second.fileContainers - && first.currentEditorFilePath == second.currentEditorFilePath - && first.visibleEditorFilePaths == second.visibleEditorFilePaths; - } - -public: - QVector fileContainers; - Utf8String currentEditorFilePath; - Utf8StringVector visibleEditorFilePaths; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsOpenedMessage &message); - -DECLARE_MESSAGE(DocumentsOpenedMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/documentvisibilitychangedmessage.cpp b/src/libs/clangsupport/documentvisibilitychangedmessage.cpp deleted file mode 100644 index f82efe65818..00000000000 --- a/src/libs/clangsupport/documentvisibilitychangedmessage.cpp +++ /dev/null @@ -1,46 +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. -** -****************************************************************************/ - -#include "documentvisibilitychangedmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const DocumentVisibilityChangedMessage &message) -{ - debug.nospace() << "DocumentVisibilityChangedMessage("; - - debug.nospace() << message.currentEditorFilePath << ", "; - - for (const Utf8String &visibleEditorFilePath : message.visibleEditorFilePaths) - debug.nospace() << visibleEditorFilePath << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/documentvisibilitychangedmessage.h b/src/libs/clangsupport/documentvisibilitychangedmessage.h deleted file mode 100644 index cb8b0f2679e..00000000000 --- a/src/libs/clangsupport/documentvisibilitychangedmessage.h +++ /dev/null @@ -1,78 +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 - -#include - -namespace ClangBackEnd { - -class DocumentVisibilityChangedMessage -{ -public: - DocumentVisibilityChangedMessage() = default; - DocumentVisibilityChangedMessage(const Utf8String ¤tEditorFilePath, - const Utf8StringVector &visibleEditorFilePaths) - : currentEditorFilePath(currentEditorFilePath) - , visibleEditorFilePaths(visibleEditorFilePaths) - { - } - - friend QDataStream &operator<<(QDataStream &out, const DocumentVisibilityChangedMessage &message) - { - out << message.currentEditorFilePath; - out << message.visibleEditorFilePaths; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, DocumentVisibilityChangedMessage &message) - { - in >> message.currentEditorFilePath; - in >> message.visibleEditorFilePaths; - - return in; - } - - friend bool operator==(const DocumentVisibilityChangedMessage &first, - const DocumentVisibilityChangedMessage &second) - { - return first.currentEditorFilePath == second.currentEditorFilePath - && first.visibleEditorFilePaths == second.visibleEditorFilePaths; - } - -public: - Utf8String currentEditorFilePath; - Utf8StringVector visibleEditorFilePaths; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentVisibilityChangedMessage &message); - -DECLARE_MESSAGE(DocumentVisibilityChangedMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/echomessage.cpp b/src/libs/clangsupport/echomessage.cpp deleted file mode 100644 index a8842b537b5..00000000000 --- a/src/libs/clangsupport/echomessage.cpp +++ /dev/null @@ -1,38 +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. -** -****************************************************************************/ - -#include "echomessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const EchoMessage &) -{ - return debug.nospace() << "EchoMessage()"; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/echomessage.h b/src/libs/clangsupport/echomessage.h deleted file mode 100644 index 0b2bf22641c..00000000000 --- a/src/libs/clangsupport/echomessage.h +++ /dev/null @@ -1,69 +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 "messageenvelop.h" - -namespace ClangBackEnd { - -class EchoMessage -{ -public: - EchoMessage() = default; - explicit EchoMessage(const MessageEnvelop &message) - : message(message) - { - } - - friend QDataStream &operator<<(QDataStream &out, const EchoMessage &message) - { - out << message.message; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, EchoMessage &message) - { - in >> message.message; - - return in; - } - - friend bool operator==(const EchoMessage &first, const EchoMessage &second) - { - return first.message == second.message; - } - -public: - MessageEnvelop message; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const EchoMessage &message); - -DECLARE_MESSAGE(EchoMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/endmessage.cpp b/src/libs/clangsupport/endmessage.cpp deleted file mode 100644 index 23132d456a4..00000000000 --- a/src/libs/clangsupport/endmessage.cpp +++ /dev/null @@ -1,37 +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. -** -****************************************************************************/ - -#include "endmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const EndMessage &/*message*/) -{ - return debug.nospace() << "EndMessage()"; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/endmessage.h b/src/libs/clangsupport/endmessage.h deleted file mode 100644 index 8ecb2646b82..00000000000 --- a/src/libs/clangsupport/endmessage.h +++ /dev/null @@ -1,56 +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 - -namespace ClangBackEnd { - -class EndMessage -{ -public: - friend QDataStream &operator<<(QDataStream &out, const EndMessage &/*message*/) - { - return out; - } - - friend QDataStream &operator>>(QDataStream &in, EndMessage &/*message*/) - { - return in; - } - - friend bool operator==(const EndMessage &/*first*/, const EndMessage &/*second*/) - { - return true; - } -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const EndMessage &message); - -DECLARE_MESSAGE(EndMessage) -} diff --git a/src/libs/clangsupport/filecontainer.cpp b/src/libs/clangsupport/filecontainer.cpp deleted file mode 100644 index 0f6f8288c90..00000000000 --- a/src/libs/clangsupport/filecontainer.cpp +++ /dev/null @@ -1,57 +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. -** -****************************************************************************/ - -#include "filecontainer.h" - -#include "clangsupportdebugutils.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const FileContainer &container) -{ - debug.nospace() << "FileContainer(" - << container.filePath << ", " - << container.compilationArguments << ", " - << container.headerPaths << ", " - << container.documentRevision << ", " - << container.textCodecName; - - if (container.hasUnsavedFileContent) { - const Utf8String fileWithContent = debugWriteFileForInspection( - container.unsavedFileContent, - debugId(container)); - debug.nospace() << ", " - << "<" << fileWithContent << ">"; - } - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/filecontainer.h b/src/libs/clangsupport/filecontainer.h deleted file mode 100644 index 2c7eb088513..00000000000 --- a/src/libs/clangsupport/filecontainer.h +++ /dev/null @@ -1,124 +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 "utf8string.h" -#include - -#include - -namespace ClangBackEnd { - -class FileContainer -{ -public: - FileContainer() = default; - FileContainer(const Utf8String &filePath, - const Utf8String &unsavedFileContent = Utf8String(), - bool hasUnsavedFileContent = false, - quint32 documentRevision = 0, - const Utf8String &textCodecName = Utf8String()) - : filePath(filePath), - unsavedFileContent(unsavedFileContent), - textCodecName(textCodecName), - documentRevision(documentRevision), - hasUnsavedFileContent(hasUnsavedFileContent) - { - } - - FileContainer(const Utf8String &filePath, - const Utf8StringVector &compilationArguments, - const Utf8StringVector &headerPaths, - const Utf8String &unsavedFileContent = Utf8String(), - bool hasUnsavedFileContent = false, - quint32 documentRevision = 0) - : filePath(filePath), - compilationArguments(compilationArguments), - headerPaths(headerPaths), - unsavedFileContent(unsavedFileContent), - documentRevision(documentRevision), - hasUnsavedFileContent(hasUnsavedFileContent) - { - } - - FileContainer(const Utf8String &filePath, - const Utf8StringVector &compilationArguments, - const Utf8StringVector &headerPaths, - quint32 documentRevision) - : filePath(filePath), - compilationArguments(compilationArguments), - headerPaths(headerPaths), - documentRevision(documentRevision), - hasUnsavedFileContent(false) - { - } - - friend QDataStream &operator<<(QDataStream &out, const FileContainer &container) - { - out << container.filePath; - out << container.compilationArguments; - out << container.headerPaths; - out << container.unsavedFileContent; - out << container.textCodecName; - out << container.documentRevision; - out << container.hasUnsavedFileContent; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, FileContainer &container) - { - in >> container.filePath; - in >> container.compilationArguments; - in >> container.headerPaths; - in >> container.unsavedFileContent; - in >> container.textCodecName; - in >> container.documentRevision; - in >> container.hasUnsavedFileContent; - - return in; - } - - friend bool operator==(const FileContainer &first, const FileContainer &second) - { - return first.filePath == second.filePath; - } - - friend CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FileContainer &container); - -public: - Utf8String filePath; - Utf8StringVector compilationArguments; - Utf8StringVector headerPaths; - Utf8String unsavedFileContent; - Utf8String textCodecName; - quint32 documentRevision = 0; - bool hasUnsavedFileContent = false; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/fixitcontainer.cpp b/src/libs/clangsupport/fixitcontainer.cpp deleted file mode 100644 index 7b1404ac9ec..00000000000 --- a/src/libs/clangsupport/fixitcontainer.cpp +++ /dev/null @@ -1,55 +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. -** -****************************************************************************/ - -#include "fixitcontainer.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const FixItContainer &container) -{ - debug.nospace() << "FixItContainer(" - << container.text << ", " - << container.range - << ")"; - - return debug; -} - -QDebug operator<<(QDebug debug, const QVector &containers) -{ - debug.nospace() << "{"; - for (int i = 0; i < containers.size(); i++) { - debug.nospace() << containers[i]; - if (i < containers.size() - 1) - debug.nospace() << ", "; - } - debug.nospace() << "}"; - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/fixitcontainer.h b/src/libs/clangsupport/fixitcontainer.h deleted file mode 100644 index 81667fe76e0..00000000000 --- a/src/libs/clangsupport/fixitcontainer.h +++ /dev/null @@ -1,74 +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 "sourcerangecontainer.h" - -#include - -namespace ClangBackEnd { - -class FixItContainer -{ -public: - FixItContainer() = default; - FixItContainer(const Utf8String &text, - const SourceRangeContainer &range) - : range(range), - text(text) - { - } - - friend QDataStream &operator<<(QDataStream &out, const FixItContainer &container) - { - out << container.text; - out << container.range; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, FixItContainer &container) - { - in >> container.text; - in >> container.range; - - return in; - } - - friend bool operator==(const FixItContainer &first, const FixItContainer &second) - { - return first.text == second.text && first.range == second.range; - } - -public: - SourceRangeContainer range; - Utf8String text; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FixItContainer &container); -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QVector &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/followsymbolmessage.cpp b/src/libs/clangsupport/followsymbolmessage.cpp deleted file mode 100644 index df2d1f5e6f6..00000000000 --- a/src/libs/clangsupport/followsymbolmessage.cpp +++ /dev/null @@ -1,55 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "followsymbolmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const FollowSymbolResult &result) -{ - debug.nospace() << "FollowSymbolResult(" - << result.range - << ", " << result.isResultOnlyForFallBack; - - debug.nospace() << ")"; - - return debug; -} - -QDebug operator<<(QDebug debug, const FollowSymbolMessage &message) -{ - debug.nospace() << "FollowSymbolMessage(" - << message.fileContainer - << ", " << message.ticketNumber - << ", " << message.result; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/followsymbolmessage.h b/src/libs/clangsupport/followsymbolmessage.h deleted file mode 100644 index b63820a4ad9..00000000000 --- a/src/libs/clangsupport/followsymbolmessage.h +++ /dev/null @@ -1,121 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filecontainer.h" -#include "sourcerangecontainer.h" - -#include -#include - -namespace ClangBackEnd { - -class FollowSymbolResult -{ -public: - FollowSymbolResult() = default; - FollowSymbolResult(SourceRangeContainer range) - : range(std::move(range)) - {} - FollowSymbolResult(SourceRangeContainer range, bool isResultOnlyForFallBack) - : range(std::move(range)) - , isResultOnlyForFallBack(isResultOnlyForFallBack) - {} - - friend QDataStream &operator<<(QDataStream &out, const FollowSymbolResult &container) - { - out << container.range; - out << container.isResultOnlyForFallBack; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, FollowSymbolResult &container) - { - in >> container.range; - in >> container.isResultOnlyForFallBack; - - return in; - } - - friend bool operator==(const FollowSymbolResult &first, const FollowSymbolResult &second) - { - return first.range == second.range - && first.isResultOnlyForFallBack == second.isResultOnlyForFallBack; - } - - SourceRangeContainer range; - bool isResultOnlyForFallBack = false; -}; - -class FollowSymbolMessage -{ -public: - FollowSymbolMessage() = default; - FollowSymbolMessage(const FileContainer &fileContainer, - const FollowSymbolResult &result, - quint64 ticketNumber) - : fileContainer(fileContainer) - , result(result) - , ticketNumber(ticketNumber) - { - } - - friend QDataStream &operator<<(QDataStream &out, const FollowSymbolMessage &message) - { - out << message.fileContainer; - out << message.result; - out << message.ticketNumber; - return out; - } - - friend QDataStream &operator>>(QDataStream &in, FollowSymbolMessage &message) - { - in >> message.fileContainer; - in >> message.result; - in >> message.ticketNumber; - return in; - } - - friend bool operator==(const FollowSymbolMessage &first, const FollowSymbolMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.fileContainer == second.fileContainer - && first.result == second.result; - } - -public: - FileContainer fileContainer; - FollowSymbolResult result; - quint64 ticketNumber = 0; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FollowSymbolResult &result); -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FollowSymbolMessage &message); - -DECLARE_MESSAGE(FollowSymbolMessage); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/ipcclientinterface.h b/src/libs/clangsupport/ipcclientinterface.h deleted file mode 100644 index 7ffc2fa1443..00000000000 --- a/src/libs/clangsupport/ipcclientinterface.h +++ /dev/null @@ -1,35 +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 "ipcinterface.h" - -namespace ClangBackEnd { - -class IpcClientInterface : public IpcInterface -{}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/ipcclientprovider.h b/src/libs/clangsupport/ipcclientprovider.h deleted file mode 100644 index a4bcb7705cc..00000000000 --- a/src/libs/clangsupport/ipcclientprovider.h +++ /dev/null @@ -1,53 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 - -namespace ClangBackEnd { - -template -class IpcClientProvider -{ -public: - void setClient(ClientType *client) - { - client_ = client; - } - - void resetClient() - { - client_ = nullptr; - } - - ClientType *client() - { - return client_; - } - -private: - ClientType *client_; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/ipcinterface.h b/src/libs/clangsupport/ipcinterface.h deleted file mode 100644 index 43a0be2a643..00000000000 --- a/src/libs/clangsupport/ipcinterface.h +++ /dev/null @@ -1,49 +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 - -namespace ClangBackEnd { - -class MessageEnvelop; - -class IpcInterface -{ -public: - IpcInterface() = default; - IpcInterface(const IpcInterface &) = delete; - IpcInterface &operator=(const IpcInterface &) = delete; - - virtual void dispatch(const MessageEnvelop &messageEnvelop) = 0; - -protected: - virtual ~IpcInterface() = default; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/ipcserverinterface.h b/src/libs/clangsupport/ipcserverinterface.h deleted file mode 100644 index df8518fd917..00000000000 --- a/src/libs/clangsupport/ipcserverinterface.h +++ /dev/null @@ -1,35 +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 "ipcinterface.h" - -namespace ClangBackEnd { - -class IpcServerInterface : public IpcInterface -{}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/lineprefixer.cpp b/src/libs/clangsupport/lineprefixer.cpp deleted file mode 100644 index bdd8df4667b..00000000000 --- a/src/libs/clangsupport/lineprefixer.cpp +++ /dev/null @@ -1,60 +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. -** -****************************************************************************/ - -#include "lineprefixer.h" - -namespace ClangBackEnd { - -LinePrefixer::LinePrefixer(const QByteArray &prefix) - : m_prefix(prefix) -{} - -void LinePrefixer::setPrefix(const QByteArray &prefix) -{ - m_prefix = prefix; -} - -QByteArray LinePrefixer::prefix(const QByteArray &text) -{ - QByteArray output = text; - - if (m_previousIsEndingWithNewLine) - output.prepend(m_prefix); - - if (output.endsWith('\n')) { - m_previousIsEndingWithNewLine = true; - output.chop(1); - } else { - m_previousIsEndingWithNewLine = false; - } - - output.replace("\n", QByteArray("\n" + m_prefix)); - if (m_previousIsEndingWithNewLine) - output.append('\n'); - - return output; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/lineprefixer.h b/src/libs/clangsupport/lineprefixer.h deleted file mode 100644 index 010a5247ea7..00000000000 --- a/src/libs/clangsupport/lineprefixer.h +++ /dev/null @@ -1,49 +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 "utf8string.h" -#include -#include - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT LinePrefixer -{ -public: - LinePrefixer() = default; - LinePrefixer(const QByteArray &prefix); - void setPrefix(const QByteArray &prefix); - QByteArray prefix(const QByteArray &text); - -private: - QByteArray m_prefix; - bool m_previousIsEndingWithNewLine = true; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/messageenvelop.cpp b/src/libs/clangsupport/messageenvelop.cpp deleted file mode 100644 index f9984f4f693..00000000000 --- a/src/libs/clangsupport/messageenvelop.cpp +++ /dev/null @@ -1,98 +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. -** -****************************************************************************/ - -#include "messageenvelop.h" - -#include "clangcodemodelclientmessages.h" -#include "clangcodemodelservermessages.h" - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop) -{ - debug.nospace() << "MessageEnvelop("; - - switch (messageEnvelop.messageType()) { - case MessageType::EndMessage: - qDebug() << "EndMessage()"; - break; - case MessageType::DocumentsOpenedMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::DocumentsChangedMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::DocumentsClosedMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::DocumentVisibilityChangedMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::UnsavedFilesUpdatedMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::UnsavedFilesRemovedMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::RequestCompletionsMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::RequestAnnotationsMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::RequestReferencesMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::RequestToolTipMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::AliveMessage: - qDebug() << "AliveMessage()"; - break; - case MessageType::EchoMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::CompletionsMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::ReferencesMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::ToolTipMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::AnnotationsMessage: - qDebug() << messageEnvelop.message(); - break; - default: - qWarning() << "Unknown Message"; - } - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/messageenvelop.h b/src/libs/clangsupport/messageenvelop.h deleted file mode 100644 index 699e8ddf42e..00000000000 --- a/src/libs/clangsupport/messageenvelop.h +++ /dev/null @@ -1,118 +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 -#include -#include -#include - -namespace ClangBackEnd { - -class MessageEnvelop -{ -public: - MessageEnvelop() = default; - - template ::enumeration)>>> - MessageEnvelop(const Message &message) - : messageType_(MessageTrait::enumeration) - { - QDataStream stream(&data, QIODevice::WriteOnly); - stream << message; - } - - template - Message message() const - { - Message message; - - QDataStream stream(&data, QIODevice::ReadOnly); - stream >> message; - - return message; - } - - MessageType messageType() const - { - return messageType_; - } - - bool isValid() const - { - return messageType_ != MessageType::InvalidMessage; - } - - friend - QDataStream &operator >>(QDataStream& in, MessageType& messageType) - { - quint32 messageTypeAsInt; - in >> messageTypeAsInt; - messageType = MessageType(messageTypeAsInt); - - return in; - } - - friend - QDataStream &operator<<(QDataStream &out, const MessageEnvelop &messageEnvelop) - { - out << static_cast(messageEnvelop.messageType_); - out << messageEnvelop.data; - - return out; - } - - friend - QDataStream &operator>>(QDataStream &in, MessageEnvelop &messageEnvelop) - { - quint8 messageType; - - in >> messageType; - in >> messageEnvelop.data; - - messageEnvelop.messageType_ = static_cast(messageType); - - return in; - } - - friend - bool operator==(const MessageEnvelop &first, const MessageEnvelop &second) - { - return first.messageType_ == second.messageType_ - && first.data == second.data; - } - - friend QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop); - -private: - mutable QByteArray data; - MessageType messageType_ = MessageType::InvalidMessage; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/processcreator.cpp b/src/libs/clangsupport/processcreator.cpp deleted file mode 100644 index c193ab82e6c..00000000000 --- a/src/libs/clangsupport/processcreator.cpp +++ /dev/null @@ -1,190 +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. -** -****************************************************************************/ - -#include "processcreator.h" - -#include "processexception.h" -#include "processstartedevent.h" - -#include -#include - -#include -#include -#include - -using namespace Utils; - -namespace ClangBackEnd { - -using namespace std::chrono_literals; - -ProcessCreator::ProcessCreator() -{ -} - -void ProcessCreator::setTemporaryDirectoryPattern(const QString &temporaryDirectoryPattern) -{ - m_temporaryDirectoryPattern = temporaryDirectoryPattern; - resetTemporaryDirectory(); -} - -void ProcessCreator::setProcessPath(const QString &processPath) -{ - m_processPath = processPath; -} - -void ProcessCreator::setArguments(const QStringList &arguments) -{ - m_arguments = arguments; -} - -void ProcessCreator::setEnvironment(const Environment &environment) -{ - m_environment = environment; -} - -std::future ProcessCreator::createProcess() const -{ - return std::async(std::launch::async, [&] { - checkIfProcessPathExists(); - auto process = QProcessUniquePointer(new QtcProcess); - process->setProcessChannelMode(QProcess::ForwardedChannels); - process->setEnvironment(processEnvironment()); - process->setCommand(CommandLine(FilePath::fromString(m_processPath), m_arguments)); - process->start(); - process->waitForStarted(5000); - - checkIfProcessWasStartingSuccessful(process.get()); - - postProcessStartedEvent(); - - process->moveToThread(QCoreApplication::instance()->thread()); - - return process; - }); -} - -void ProcessCreator::setObserver(QObject *observer) -{ - this->m_observer = observer; -} - -void ProcessCreator::checkIfProcessPathExists() const -{ - if (!QFileInfo::exists(m_processPath)) { - const QString messageTemplate = QCoreApplication::translate("ProcessCreator", - "Executable does not exist: %1"); - throwProcessException(messageTemplate.arg(m_processPath)); - } -} - -void ProcessCreator::checkIfProcessWasStartingSuccessful(QtcProcess *process) const -{ - if (process->exitStatus() == QProcess::CrashExit || process->exitCode() != 0) - dispatchProcessError(process); -} - -void ProcessCreator::dispatchProcessError(QtcProcess *process) const -{ - switch (process->error()) { - case QProcess::UnknownError: { - const QString message = QCoreApplication::translate("ProcessCreator", - "Unknown error occurred."); - throwProcessException(message); - }; - case QProcess::Crashed: { - const QString message = QCoreApplication::translate("ProcessCreator", - "Process crashed."); - throwProcessException(message); - }; - case QProcess::FailedToStart: { - const QString message = QCoreApplication::translate("ProcessCreator", - "Process failed at startup."); - throwProcessException(message); - }; - case QProcess::Timedout: { - const QString message = QCoreApplication::translate("ProcessCreator", - "Process timed out."); - throwProcessException(message); - }; - case QProcess::WriteError: { - const QString message = QCoreApplication::translate("ProcessCreator", - "Cannot write to process."); - throwProcessException(message); - }; - case QProcess::ReadError: { - const QString message = QCoreApplication::translate("ProcessCreator", - "Cannot read from process."); - throwProcessException(message); - }; - } - - throwProcessException("Internal impossible error!"); -} - -void ProcessCreator::postProcessStartedEvent() const -{ - if (m_observer) - QCoreApplication::postEvent(m_observer, new ProcessStartedEvent); -} - -void ProcessCreator::throwProcessException(const QString &message) const -{ - postProcessStartedEvent(); - throw ProcessException(message); -} - -const QTemporaryDir &ProcessCreator::temporaryDirectory() const -{ - return *m_temporaryDirectory.get(); -} - -void ProcessCreator::resetTemporaryDirectory() -{ - m_temporaryDirectory = std::make_unique(m_temporaryDirectoryPattern); -} - -Environment ProcessCreator::processEnvironment() const -{ - auto processEnvironment = Environment::systemEnvironment(); - - if (temporaryDirectory().isValid()) { - const QString temporaryDirectoryPath = temporaryDirectory().path(); - processEnvironment.set("TMPDIR", temporaryDirectoryPath); - processEnvironment.set("TMP", temporaryDirectoryPath); - processEnvironment.set("TEMP", temporaryDirectoryPath); - } - - const Environment &env = m_environment; - for (auto it = env.constBegin(); it != env.constEnd(); ++it) { - if (env.isEnabled(it)) - processEnvironment.set(env.key(it), env.expandedValueForKey(env.key(it))); - } - - return processEnvironment; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/processcreator.h b/src/libs/clangsupport/processcreator.h deleted file mode 100644 index 5fdb797e30f..00000000000 --- a/src/libs/clangsupport/processcreator.h +++ /dev/null @@ -1,85 +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 - -#include "processhandle.h" - -#include -#include - -#include - -#include -#include - -QT_BEGIN_NAMESPACE -class QTemporaryDir; -QT_END_NAMESPACE - -namespace Utils { -class Environment; -class QtcProcess; -} - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT ProcessCreator -{ -public: - ProcessCreator(); - - void setTemporaryDirectoryPattern(const QString &temporaryDirectoryPattern); - void setProcessPath(const QString &m_processPath); - void setArguments(const QStringList &m_arguments); - void setEnvironment(const Utils::Environment &environment); - void setObserver(QObject *m_observer); - - std::future createProcess() const; - - const QTemporaryDir &temporaryDirectory() const; - void resetTemporaryDirectory(); - -private: - void checkIfProcessPathExists() const; - void checkIfProcessWasStartingSuccessful(Utils::QtcProcess *process) const; - [[noreturn]] void dispatchProcessError(Utils::QtcProcess *process) const; - void postProcessStartedEvent() const; - [[noreturn]] void throwProcessException(const QString &message) const; - - Utils::Environment processEnvironment() const; - -private: - std::unique_ptr m_temporaryDirectory; - QString m_processPath; - QString m_temporaryDirectoryPattern; - QStringList m_arguments; - Utils::Environment m_environment; - QObject *m_observer = nullptr; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/processexception.cpp b/src/libs/clangsupport/processexception.cpp deleted file mode 100644 index e96367e53cf..00000000000 --- a/src/libs/clangsupport/processexception.cpp +++ /dev/null @@ -1,40 +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. -** -****************************************************************************/ - -#include "processexception.h" - -namespace ClangBackEnd { - -ProcessException::ProcessException(Utils::SmallString &&what) - : what_(std::move(what)) -{ -} - -const char *ProcessException::what() const noexcept -{ - return what_.data(); -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/processexception.h b/src/libs/clangsupport/processexception.h deleted file mode 100644 index 3ad10ba4fc4..00000000000 --- a/src/libs/clangsupport/processexception.h +++ /dev/null @@ -1,48 +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 - -#include - -#include "clangsupport_global.h" - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT ProcessException : public std::exception -{ -public: - ProcessException() = default; - ProcessException(Utils::SmallString &&what); - - const char *what() const noexcept final; - -private: - Utils::SmallString what_; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/processhandle.h b/src/libs/clangsupport/processhandle.h deleted file mode 100644 index 3f7444499b8..00000000000 --- a/src/libs/clangsupport/processhandle.h +++ /dev/null @@ -1,47 +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 - -#include - -namespace ClangBackEnd { - -class QProcessUniquePointerDeleter -{ -public: - void operator()(Utils::QtcProcess* process) - { - process->kill(); - process->waitForFinished(); - delete process; - } -}; - -using QProcessUniquePointer = std::unique_ptr; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/processstartedevent.cpp b/src/libs/clangsupport/processstartedevent.cpp deleted file mode 100644 index 3db8c128c4d..00000000000 --- a/src/libs/clangsupport/processstartedevent.cpp +++ /dev/null @@ -1,34 +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. -** -****************************************************************************/ - -#include "processstartedevent.h" - -namespace ClangBackEnd { - -ProcessStartedEvent::~ProcessStartedEvent() -{ -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/processstartedevent.h b/src/libs/clangsupport/processstartedevent.h deleted file mode 100644 index 4e02f3d8d5a..00000000000 --- a/src/libs/clangsupport/processstartedevent.h +++ /dev/null @@ -1,44 +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. -** -****************************************************************************/ - -#include - -namespace ClangBackEnd { - -class ProcessStartedEvent : public QEvent -{ -public: - enum Type { - ProcessStarted = QEvent::User + 3456 - }; - - ProcessStartedEvent() - : QEvent(static_cast(ProcessStarted)) - {} - - ~ProcessStartedEvent() override; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/readmessageblock.cpp b/src/libs/clangsupport/readmessageblock.cpp deleted file mode 100644 index e08406c1338..00000000000 --- a/src/libs/clangsupport/readmessageblock.cpp +++ /dev/null @@ -1,122 +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. -** -****************************************************************************/ - -#include "readmessageblock.h" - -#include "messageenvelop.h" - -#include -#include -#include -#include - -namespace ClangBackEnd { - -ReadMessageBlock::ReadMessageBlock(QIODevice *ioDevice) - : m_ioDevice(ioDevice), - m_messageCounter(0), - m_blockSize(0) -{ -} - -bool ReadMessageBlock::checkIfMessageIsLost(QDataStream &in) -{ - qint64 currentMessageCounter; - - in >> currentMessageCounter; - - bool messageIsLost = false; -#ifndef DONT_CHECK_MESSAGE_COUNTER - messageIsLost = !((currentMessageCounter == 0 && m_messageCounter == 0) || (m_messageCounter + 1 == currentMessageCounter)); - if (messageIsLost) - qWarning() << "message lost: " << m_messageCounter << currentMessageCounter; -#endif - - m_messageCounter = currentMessageCounter; - - return messageIsLost; -} - -MessageEnvelop ReadMessageBlock::read() -{ - QDataStream in(m_ioDevice); - - MessageEnvelop message; - - if (isTheWholeMessageReadable(in)) { - bool messageIsLost = checkIfMessageIsLost(in); - - in >> message; - - if (messageIsLost) - qDebug() << message; - } - - return message; -} - -std::vector ReadMessageBlock::readAll() -{ - std::vector messages; - - while (true) { - MessageEnvelop message = read(); - if (message.isValid()) - messages.push_back(std::move(message)); - else - return messages; - } - - Q_UNREACHABLE(); -} - -void ReadMessageBlock::resetState() -{ - m_messageCounter = 0; -} - -void ReadMessageBlock::setIoDevice(QIODevice *ioDevice) -{ - m_ioDevice = ioDevice; -} - -bool ReadMessageBlock::isTheWholeMessageReadable(QDataStream &in) -{ - if (m_ioDevice->bytesAvailable() < qint64(sizeof(m_blockSize))) - return false; - - if (m_blockSize == 0) - in >> m_blockSize; - - if (m_ioDevice->bytesAvailable() < m_blockSize) - return false; - - m_blockSize = 0; - - return true; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/readmessageblock.h b/src/libs/clangsupport/readmessageblock.h deleted file mode 100644 index b83040d4720..00000000000 --- a/src/libs/clangsupport/readmessageblock.h +++ /dev/null @@ -1,65 +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 - -#include - -#include "clangsupport_global.h" - -QT_BEGIN_NAMESPACE -class QDataStream; -class QIODevice; -QT_END_NAMESPACE - -namespace ClangBackEnd { - -class MessageEnvelop; - -class CLANGSUPPORT_EXPORT ReadMessageBlock -{ -public: - ReadMessageBlock(QIODevice *ioDevice = nullptr); - - MessageEnvelop read(); - std::vector readAll(); - - void resetState(); - - void setIoDevice(QIODevice *ioDevice); - -private: - bool isTheWholeMessageReadable(QDataStream &in); - bool checkIfMessageIsLost(QDataStream &in); - -private: - QIODevice *m_ioDevice; - qint64 m_messageCounter; - qint32 m_blockSize; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/referencesmessage.cpp b/src/libs/clangsupport/referencesmessage.cpp deleted file mode 100644 index 9a288deebaa..00000000000 --- a/src/libs/clangsupport/referencesmessage.cpp +++ /dev/null @@ -1,45 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "referencesmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const ReferencesMessage &message) -{ - debug.nospace() << "ReferencesMessage(" - << message.fileContainer - << ", " << message.ticketNumber - << ", " << message.isLocalVariable - << ", " << message.references; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/referencesmessage.h b/src/libs/clangsupport/referencesmessage.h deleted file mode 100644 index a617077f653..00000000000 --- a/src/libs/clangsupport/referencesmessage.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filecontainer.h" -#include "sourcerangecontainer.h" - -#include -#include - -namespace ClangBackEnd { - -class ReferencesMessage -{ -public: - ReferencesMessage() = default; - ReferencesMessage(const FileContainer &fileContainer, - const QVector &references, - bool isLocalVariable, - quint64 ticketNumber) - : fileContainer(fileContainer) - , references(references) - , ticketNumber(ticketNumber) - , isLocalVariable(isLocalVariable) - { - } - - friend QDataStream &operator<<(QDataStream &out, const ReferencesMessage &message) - { - out << message.fileContainer; - out << message.isLocalVariable; - out << message.references; - out << message.ticketNumber; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ReferencesMessage &message) - { - in >> message.fileContainer; - in >> message.isLocalVariable; - in >> message.references; - in >> message.ticketNumber; - - return in; - } - - friend bool operator==(const ReferencesMessage &first, const ReferencesMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.isLocalVariable == second.isLocalVariable - && first.fileContainer == second.fileContainer - && first.references == second.references; - } - -public: - FileContainer fileContainer; - QVector references; - quint64 ticketNumber = 0; - bool isLocalVariable = false; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ReferencesMessage &message); - -DECLARE_MESSAGE(ReferencesMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestannotationsmessage.cpp b/src/libs/clangsupport/requestannotationsmessage.cpp deleted file mode 100644 index 45392f92677..00000000000 --- a/src/libs/clangsupport/requestannotationsmessage.cpp +++ /dev/null @@ -1,41 +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. -** -****************************************************************************/ - -#include "requestannotationsmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const RequestAnnotationsMessage &message) -{ - debug.nospace() << "RequestAnnotationsMessage(" - << message.fileContainer - << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestannotationsmessage.h b/src/libs/clangsupport/requestannotationsmessage.h deleted file mode 100644 index 24be10d1245..00000000000 --- a/src/libs/clangsupport/requestannotationsmessage.h +++ /dev/null @@ -1,68 +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 "filecontainer.h" - -namespace ClangBackEnd { - -class RequestAnnotationsMessage -{ -public: - RequestAnnotationsMessage() = default; - RequestAnnotationsMessage(const FileContainer &fileContainer) - : fileContainer(fileContainer) - { - } - - friend QDataStream &operator<<(QDataStream &out, const RequestAnnotationsMessage &message) - { - out << message.fileContainer; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RequestAnnotationsMessage &message) - { - in >> message.fileContainer; - - return in; - } - - friend bool operator==(const RequestAnnotationsMessage &first, - const RequestAnnotationsMessage &second) - { - return first.fileContainer == second.fileContainer; - } - -public: - FileContainer fileContainer; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestAnnotationsMessage &message); - -DECLARE_MESSAGE(RequestAnnotationsMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestcompletionsmessage.cpp b/src/libs/clangsupport/requestcompletionsmessage.cpp deleted file mode 100644 index 156768d0ae2..00000000000 --- a/src/libs/clangsupport/requestcompletionsmessage.cpp +++ /dev/null @@ -1,51 +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. -** -****************************************************************************/ - -#include "requestcompletionsmessage.h" - -#include - -namespace ClangBackEnd { - -quint64 RequestCompletionsMessage::ticketCounter = 0; - -QDebug operator<<(QDebug debug, const RequestCompletionsMessage &message) -{ - debug.nospace() << "RequestCompletionsMessage("; - - debug.nospace() << message.filePath << ", "; - debug.nospace() << message.line << ", "; - debug.nospace() << message.column << ", "; - debug.nospace() << message.ticketNumber; - debug.nospace() << message.funcNameStartLine << ", "; - debug.nospace() << message.funcNameStartColumn << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/requestcompletionsmessage.h b/src/libs/clangsupport/requestcompletionsmessage.h deleted file mode 100644 index 90b492c0f3f..00000000000 --- a/src/libs/clangsupport/requestcompletionsmessage.h +++ /dev/null @@ -1,102 +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 "utf8string.h" - -#include - -namespace ClangBackEnd { - -class RequestCompletionsMessage -{ -public: - RequestCompletionsMessage() = default; - RequestCompletionsMessage(const Utf8String &filePath, - quint32 line, - quint32 column, - qint32 funcNameStartLine = -1, - qint32 funcNameStartColumn = -1) - : filePath(filePath) - , ticketNumber(++ticketCounter) - , line(line) - , column(column) - , funcNameStartLine(funcNameStartLine) - , funcNameStartColumn(funcNameStartColumn) - { - } - - friend QDataStream &operator<<(QDataStream &out, const RequestCompletionsMessage &message) - { - out << message.filePath; - out << message.ticketNumber; - out << message.line; - out << message.column; - out << message.funcNameStartLine; - out << message.funcNameStartColumn; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RequestCompletionsMessage &message) - { - in >> message.filePath; - in >> message.ticketNumber; - in >> message.line; - in >> message.column; - in >> message.funcNameStartLine; - in >> message.funcNameStartColumn; - - return in; - } - - friend bool operator==(const RequestCompletionsMessage &first, - const RequestCompletionsMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.filePath == second.filePath - && first.line == second.line - && first.column == second.column - && first.funcNameStartLine == second.funcNameStartLine - && first.funcNameStartColumn == second.funcNameStartColumn; - } - -public: - Utf8String filePath; - static CLANGSUPPORT_EXPORT quint64 ticketCounter; - quint64 ticketNumber = 0; - quint32 line = 0; - quint32 column = 0; - qint32 funcNameStartLine = -1; - qint32 funcNameStartColumn = -1; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestCompletionsMessage &message); - -DECLARE_MESSAGE(RequestCompletionsMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestfollowsymbolmessage.cpp b/src/libs/clangsupport/requestfollowsymbolmessage.cpp deleted file mode 100644 index 1caa0cd4540..00000000000 --- a/src/libs/clangsupport/requestfollowsymbolmessage.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "requestfollowsymbolmessage.h" - -#include - -namespace ClangBackEnd { - -quint64 RequestFollowSymbolMessage::ticketCounter = 0; - -QDebug operator<<(QDebug debug, const RequestFollowSymbolMessage &message) -{ - debug.nospace() << "RequestFollowSymbolMessage("; - - debug.nospace() << message.fileContainer << ", "; - debug.nospace() << message.ticketNumber << ", "; - debug.nospace() << message.line << ", "; - debug.nospace() << message.column << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestfollowsymbolmessage.h b/src/libs/clangsupport/requestfollowsymbolmessage.h deleted file mode 100644 index b3eb0209577..00000000000 --- a/src/libs/clangsupport/requestfollowsymbolmessage.h +++ /dev/null @@ -1,90 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filecontainer.h" - -#include - -namespace ClangBackEnd { - -class RequestFollowSymbolMessage -{ -public: - RequestFollowSymbolMessage() = default; - RequestFollowSymbolMessage(const FileContainer &fileContainer, - quint32 line, - quint32 column) - : fileContainer(fileContainer) - , ticketNumber(++ticketCounter) - , line(line) - , column(column) - { - } - - friend QDataStream &operator<<(QDataStream &out, const RequestFollowSymbolMessage &message) - { - out << message.fileContainer; - out << message.ticketNumber; - out << message.line; - out << message.column; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RequestFollowSymbolMessage &message) - { - in >> message.fileContainer; - in >> message.ticketNumber; - in >> message.line; - in >> message.column; - - return in; - } - - friend bool operator==(const RequestFollowSymbolMessage &first, - const RequestFollowSymbolMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.line == second.line - && first.column == second.column - && first.fileContainer == second.fileContainer; - } - -public: - FileContainer fileContainer; - quint64 ticketNumber = 0; - quint32 line = 0; - quint32 column = 0; - static CLANGSUPPORT_EXPORT quint64 ticketCounter; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestFollowSymbolMessage &message); - -DECLARE_MESSAGE(RequestFollowSymbolMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestreferencesmessage.cpp b/src/libs/clangsupport/requestreferencesmessage.cpp deleted file mode 100644 index ae719e66563..00000000000 --- a/src/libs/clangsupport/requestreferencesmessage.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "requestreferencesmessage.h" - -#include - -namespace ClangBackEnd { - -quint64 RequestReferencesMessage::ticketCounter = 0; - -QDebug operator<<(QDebug debug, const RequestReferencesMessage &message) -{ - debug.nospace() << "RequestReferencesMessage("; - - debug.nospace() << message.fileContainer << ", "; - debug.nospace() << message.ticketNumber << ", "; - debug.nospace() << message.line << ", "; - debug.nospace() << message.column << ", "; - debug.nospace() << message.local << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requestreferencesmessage.h b/src/libs/clangsupport/requestreferencesmessage.h deleted file mode 100644 index 185376c49dd..00000000000 --- a/src/libs/clangsupport/requestreferencesmessage.h +++ /dev/null @@ -1,96 +0,0 @@ -/**************************************************************************** -** -** Copyright (C) 2017 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 "filecontainer.h" - -#include - -namespace ClangBackEnd { - -class RequestReferencesMessage -{ -public: - RequestReferencesMessage() = default; - RequestReferencesMessage(const FileContainer &fileContainer, - quint32 line, - quint32 column, - bool local = false) - : fileContainer(fileContainer) - , ticketNumber(++ticketCounter) - , line(line) - , column(column) - , local(local) - { - } - - friend QDataStream &operator<<(QDataStream &out, const RequestReferencesMessage &message) - { - out << message.fileContainer; - out << message.ticketNumber; - out << message.line; - out << message.column; - out << message.local; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RequestReferencesMessage &message) - { - in >> message.fileContainer; - in >> message.ticketNumber; - in >> message.line; - in >> message.column; - in >> message.local; - - return in; - } - - friend bool operator==(const RequestReferencesMessage &first, - const RequestReferencesMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.line == second.line - && first.column == second.column - && first.fileContainer == second.fileContainer - && first.local == second.local; - } - -public: - FileContainer fileContainer; - quint64 ticketNumber = 0; - quint32 line = 0; - quint32 column = 0; - bool local = false; - static CLANGSUPPORT_EXPORT quint64 ticketCounter; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestReferencesMessage &message); - -DECLARE_MESSAGE(RequestReferencesMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requesttooltipmessage.cpp b/src/libs/clangsupport/requesttooltipmessage.cpp deleted file mode 100644 index ab5aa3fb82b..00000000000 --- a/src/libs/clangsupport/requesttooltipmessage.cpp +++ /dev/null @@ -1,48 +0,0 @@ -/**************************************************************************** -** -** 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. -** -****************************************************************************/ - -#include "requesttooltipmessage.h" - -#include - -namespace ClangBackEnd { - -quint64 RequestToolTipMessage::ticketCounter = 0; - -QDebug operator<<(QDebug debug, const RequestToolTipMessage &message) -{ - debug.nospace() << "RequestToolTipMessage("; - - debug.nospace() << message.fileContainer << ", "; - debug.nospace() << message.ticketNumber << ", "; - debug.nospace() << message.line << ", "; - debug.nospace() << message.column << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/requesttooltipmessage.h b/src/libs/clangsupport/requesttooltipmessage.h deleted file mode 100644 index d05e6a4c929..00000000000 --- a/src/libs/clangsupport/requesttooltipmessage.h +++ /dev/null @@ -1,89 +0,0 @@ -/**************************************************************************** -** -** 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 "clangsupport_global.h" - -#include "filecontainer.h" - -#include - -namespace ClangBackEnd { - -// TODO: De-duplicate with RequestReferencesMessage? -class RequestToolTipMessage -{ -public: - RequestToolTipMessage() = default; - RequestToolTipMessage(const FileContainer &fileContainer, quint32 line, quint32 column) - : fileContainer(fileContainer) - , ticketNumber(++ticketCounter) - , line(line) - , column(column) - { - } - - friend QDataStream &operator<<(QDataStream &out, const RequestToolTipMessage &message) - { - out << message.fileContainer; - out << message.ticketNumber; - out << message.line; - out << message.column; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, RequestToolTipMessage &message) - { - in >> message.fileContainer; - in >> message.ticketNumber; - in >> message.line; - in >> message.column; - - return in; - } - - friend bool operator==(const RequestToolTipMessage &first, - const RequestToolTipMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.line == second.line - && first.column == second.column - && first.fileContainer == second.fileContainer; - } - -public: - FileContainer fileContainer; - quint64 ticketNumber = 0; - quint32 line = 0; - quint32 column = 0; - static CLANGSUPPORT_EXPORT quint64 ticketCounter; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestToolTipMessage &message); - -DECLARE_MESSAGE(RequestToolTipMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcelocationcontainer.cpp b/src/libs/clangsupport/sourcelocationcontainer.cpp deleted file mode 100644 index 2ec30a25122..00000000000 --- a/src/libs/clangsupport/sourcelocationcontainer.cpp +++ /dev/null @@ -1,74 +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. -** -****************************************************************************/ - -#include "sourcelocationcontainer.h" - -#include -#include - -namespace ClangBackEnd { - -QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container) -{ - out << container.filePath; - out << container.line; - out << container.column; - - return out; -} - -QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container) -{ - in >> container.filePath; - in >> container.line; - in >> container.column; - - return in; -} - -bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second) -{ - return !(first != second); -} - -bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second) -{ - return first.line != second.line - || first.column != second.column - || first.filePath != second.filePath; -} - -QDebug operator<<(QDebug debug, const SourceLocationContainer &container) -{ - debug.nospace() << "SourceLocationContainer(" - << container.filePath << ", " - << container.line << ", " - << container.column - << ")"; - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/sourcelocationcontainer.h b/src/libs/clangsupport/sourcelocationcontainer.h deleted file mode 100644 index 4f13488e212..00000000000 --- a/src/libs/clangsupport/sourcelocationcontainer.h +++ /dev/null @@ -1,60 +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 "utf8string.h" - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT SourceLocationContainer -{ -public: - SourceLocationContainer() = default; - SourceLocationContainer(const Utf8String &filePath, - int line, - int column) - : filePath(filePath), - line(line), - column(column) - { - } - -public: - Utf8String filePath; - int line = 0; - int column = 0; -}; - -CLANGSUPPORT_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container); -CLANGSUPPORT_EXPORT QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container); -CLANGSUPPORT_EXPORT bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second); -CLANGSUPPORT_EXPORT bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second); - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationContainer &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcelocationscontainer.cpp b/src/libs/clangsupport/sourcelocationscontainer.cpp deleted file mode 100644 index 19573ddbd1e..00000000000 --- a/src/libs/clangsupport/sourcelocationscontainer.cpp +++ /dev/null @@ -1,47 +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. -** -****************************************************************************/ - -#include "sourcelocationscontainer.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const SourceLocationsContainer &container) -{ - debug.nospace() << "SourceLocationsContainer(["; - for (const auto &sourceLocation: container.sourceLocationContainers()) { - debug.nospace() << "(" - << sourceLocation.filePath << "," - << sourceLocation.line << "," - << sourceLocation.column << "), "; - } - - debug.nospace() << "])"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcelocationscontainer.h b/src/libs/clangsupport/sourcelocationscontainer.h deleted file mode 100644 index 0be15acf900..00000000000 --- a/src/libs/clangsupport/sourcelocationscontainer.h +++ /dev/null @@ -1,92 +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 "sourcelocationcontainer.h" - -#include - -namespace ClangBackEnd { - -class CLANGSUPPORT_EXPORT SourceLocationsContainer -{ -public: - SourceLocationsContainer() = default; - SourceLocationsContainer(std::vector &&sourceLocationContainers) - : m_sourceLocationContainers(std::move(sourceLocationContainers)) - {} - - const std::vector &sourceLocationContainers() const - { - return m_sourceLocationContainers; - } - - bool hasContent() const - { - return !m_sourceLocationContainers.empty(); - } - - void insertSourceLocation(const Utf8String &filePath, int line, int column) - { - m_sourceLocationContainers.emplace_back(filePath, line, column); - } - - void reserve(std::size_t size) - { - m_sourceLocationContainers.reserve(size); - } - - friend QDataStream &operator<<(QDataStream &out, const SourceLocationsContainer &container) - { - out << container.m_sourceLocationContainers; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceLocationsContainer &container) - { - in >> container.m_sourceLocationContainers; - - return in; - } - - friend bool operator==(const SourceLocationsContainer &first, const SourceLocationsContainer &second) - { - return first.m_sourceLocationContainers == second.m_sourceLocationContainers; - } - - SourceLocationsContainer clone() const - { - return *this; - } - - std::vector m_sourceLocationContainers; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationsContainer &container); - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/sourcerangecontainer.cpp b/src/libs/clangsupport/sourcerangecontainer.cpp deleted file mode 100644 index d9146d0ff33..00000000000 --- a/src/libs/clangsupport/sourcerangecontainer.cpp +++ /dev/null @@ -1,54 +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. -** -****************************************************************************/ - -#include "sourcerangecontainer.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const SourceRangeContainer &container) -{ - debug.nospace() << "SourceRangeContainer(" - << container.start << ", " - << container.end - << ")"; - - return debug; -} - -QDebug operator<<(QDebug debug, const QVector &containers) -{ - debug.nospace() << "{"; - for (int i = 0; i < containers.size(); i++) { - debug.nospace() << containers[i]; - if (i < containers.size() - 1) - debug.nospace() << ", "; - } - debug.nospace() << "}"; - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/sourcerangecontainer.h b/src/libs/clangsupport/sourcerangecontainer.h deleted file mode 100644 index 39a0e6cb210..00000000000 --- a/src/libs/clangsupport/sourcerangecontainer.h +++ /dev/null @@ -1,90 +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 "sourcelocationcontainer.h" - -#include - -namespace ClangBackEnd { - -class SourceRangeContainer -{ -public: - SourceRangeContainer() = default; - SourceRangeContainer(SourceLocationContainer start, - SourceLocationContainer end) - : start(start), - end(end) - { - } - - bool contains(int line, int column) const - { - if (line < start.line || line > end.line) - return false; - if (line == start.line && column < start.column) - return false; - if (line == end.line && column > end.column) - return false; - return true; - } - - bool contains(const SourceLocationContainer &sourceLocation) const - { - return contains(sourceLocation.line, sourceLocation.column); - } - - friend QDataStream &operator<<(QDataStream &out, const SourceRangeContainer &container) - { - out << container.start; - out << container.end; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, SourceRangeContainer &container) - { - in >> container.start; - in >> container.end; - - return in; - } - - friend bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &second) - { - return first.start == second.start && first.end == second.end; - } - -public: - SourceLocationContainer start; - SourceLocationContainer end; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceRangeContainer &container); -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QVector &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/tokeninfocontainer.cpp b/src/libs/clangsupport/tokeninfocontainer.cpp deleted file mode 100644 index 41c0a69f7ee..00000000000 --- a/src/libs/clangsupport/tokeninfocontainer.cpp +++ /dev/null @@ -1,114 +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. -** -****************************************************************************/ - -#include "tokeninfocontainer.h" - -#include - -namespace ClangBackEnd { - -#define RETURN_TEXT_FOR_CASE(enumValue) case HighlightingType::enumValue: return #enumValue -static const char *highlightingTypeToCStringLiteral(HighlightingType type) -{ - switch (type) { - RETURN_TEXT_FOR_CASE(Invalid); - RETURN_TEXT_FOR_CASE(Comment); - RETURN_TEXT_FOR_CASE(Keyword); - RETURN_TEXT_FOR_CASE(StringLiteral); - RETURN_TEXT_FOR_CASE(NumberLiteral); - RETURN_TEXT_FOR_CASE(Function); - RETURN_TEXT_FOR_CASE(VirtualFunction); - RETURN_TEXT_FOR_CASE(Type); - RETURN_TEXT_FOR_CASE(LocalVariable); - RETURN_TEXT_FOR_CASE(GlobalVariable); - RETURN_TEXT_FOR_CASE(Field); - RETURN_TEXT_FOR_CASE(Enumeration); - RETURN_TEXT_FOR_CASE(Operator); - RETURN_TEXT_FOR_CASE(OverloadedOperator); - RETURN_TEXT_FOR_CASE(Preprocessor); - RETURN_TEXT_FOR_CASE(Label); - RETURN_TEXT_FOR_CASE(FunctionDefinition); - RETURN_TEXT_FOR_CASE(OutputArgument); - RETURN_TEXT_FOR_CASE(PreprocessorDefinition); - RETURN_TEXT_FOR_CASE(PreprocessorExpansion); - RETURN_TEXT_FOR_CASE(Punctuation); - RETURN_TEXT_FOR_CASE(Namespace); - RETURN_TEXT_FOR_CASE(Class); - RETURN_TEXT_FOR_CASE(Struct); - RETURN_TEXT_FOR_CASE(Enum); - RETURN_TEXT_FOR_CASE(Union); - RETURN_TEXT_FOR_CASE(TypeAlias); - RETURN_TEXT_FOR_CASE(Typedef); - RETURN_TEXT_FOR_CASE(QtProperty); - RETURN_TEXT_FOR_CASE(ObjectiveCClass); - RETURN_TEXT_FOR_CASE(ObjectiveCCategory); - RETURN_TEXT_FOR_CASE(ObjectiveCProtocol); - RETURN_TEXT_FOR_CASE(ObjectiveCInterface); - RETURN_TEXT_FOR_CASE(ObjectiveCImplementation); - RETURN_TEXT_FOR_CASE(ObjectiveCProperty); - RETURN_TEXT_FOR_CASE(ObjectiveCMethod); - RETURN_TEXT_FOR_CASE(PrimitiveType); - RETURN_TEXT_FOR_CASE(Declaration); - RETURN_TEXT_FOR_CASE(TemplateTypeParameter); - RETURN_TEXT_FOR_CASE(TemplateTemplateParameter); - default: return "UnhandledHighlightingType"; - } -} -#undef RETURN_TEXT_FOR_CASE - -QDebug operator<<(QDebug debug, const ExtraInfo &extraInfo) -{ - debug.nospace() << "ExtraInfo(" - << extraInfo.token << ", " - << extraInfo.typeSpelling << ", " - << extraInfo.semanticParentTypeSpelling << ", " - << extraInfo.cursorRange << ", " - << extraInfo.lexicalParentIndex << ", " - << static_cast(extraInfo.accessSpecifier) << ", " - << static_cast(extraInfo.storageClass) << ", " - << extraInfo.identifier << ", " - << extraInfo.includeDirectivePath << ", " - << extraInfo.declaration << ", " - << extraInfo.definition << ", " - << extraInfo.signal << ", " - << extraInfo.slot << ", " - << ")"; - return debug; -} - -QDebug operator<<(QDebug debug, const TokenInfoContainer &container) -{ - debug.nospace() << "TokenInfosContainer(" - << container.line << ", " - << container.column << ", " - << container.length << ", " - << highlightingTypeToCStringLiteral(container.types.mainHighlightingType) << ", " - << container.extraInfo - << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/tokeninfocontainer.h b/src/libs/clangsupport/tokeninfocontainer.h deleted file mode 100644 index 004bdd3cb9f..00000000000 --- a/src/libs/clangsupport/tokeninfocontainer.h +++ /dev/null @@ -1,344 +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 "sourcerangecontainer.h" - -#include "utf8string.h" - -#include - -#include - -namespace ClangBackEnd { - -inline QDataStream &operator<<(QDataStream &out, HighlightingType highlightingType); -inline QDataStream &operator<<(QDataStream &out, HighlightingTypes highlightingTypes); -inline QDataStream &operator>>(QDataStream &in, HighlightingType &highlightingType); -inline QDataStream &operator>>(QDataStream &in, HighlightingTypes &highlightingTypes); -inline bool operator==(const MixinHighlightingTypes &first, const MixinHighlightingTypes &second); -inline bool operator==(const HighlightingTypes &first, const HighlightingTypes &second); - -using ByteSizeBitset = std::bitset<8>; - -inline QDataStream &operator<<(QDataStream &out, ByteSizeBitset bits); -inline QDataStream &operator>>(QDataStream &in, ByteSizeBitset &bits); - -struct ExtraInfo -{ - ExtraInfo() - : identifier(false) - , includeDirectivePath(false) - , declaration(false) - , definition(false) - , signal(false) - , slot(false) - { - } - ExtraInfo(Utf8String token, Utf8String typeSpelling, - Utf8String semanticParentTypeSpelling, SourceRangeContainer cursorRange, - int lexicalParentIndex, AccessSpecifier accessSpecifier, StorageClass storageClass, - bool isIdentifier, bool isInclusion, bool isDeclaration, bool isDefinition, - bool isSignal, bool isSlot) - : token(token) - , typeSpelling(typeSpelling) - , semanticParentTypeSpelling(semanticParentTypeSpelling) - , cursorRange(cursorRange) - , lexicalParentIndex(lexicalParentIndex) - , accessSpecifier(accessSpecifier) - , storageClass(storageClass) - , identifier(isIdentifier) - , includeDirectivePath(isInclusion) - , declaration(isDeclaration) - , definition(isDefinition) - , signal(isSignal) - , slot(isSlot) - { - } - Utf8String token; - Utf8String typeSpelling; - Utf8String semanticParentTypeSpelling; - SourceRangeContainer cursorRange; - int lexicalParentIndex = -1; - AccessSpecifier accessSpecifier = AccessSpecifier::Invalid; - StorageClass storageClass = StorageClass::Invalid; - bool identifier : 1; - bool includeDirectivePath : 1; - bool declaration : 1; - bool definition : 1; - bool signal : 1; - bool slot : 1; -}; - -inline QDataStream &operator<<(QDataStream &out, const ExtraInfo &extraInfo); -inline QDataStream &operator>>(QDataStream &in, ExtraInfo &extraInfo); -inline bool operator==(const ExtraInfo &first, const ExtraInfo &second); - -class TokenInfoContainer -{ -public: - TokenInfoContainer() = default; - TokenInfoContainer(int line, int column, int length, HighlightingTypes types) - : line(line) - , column(column) - , length(length) - , types(types) - { - } - - TokenInfoContainer(int line, int column, int length, HighlightingTypes types, - const ExtraInfo &extraInfo) - : line(line) - , column(column) - , length(length) - , types(types) - , extraInfo(extraInfo) - , noExtraInfo(false) - { - } - - bool isInvalid() const - { - return line == 0 && column == 0 && length == 0; - } - - bool isGlobalDeclaration() const - { - if (types.mixinHighlightingTypes.contains( - ClangBackEnd::HighlightingType::TemplateTypeParameter) - || types.mixinHighlightingTypes.contains( - ClangBackEnd::HighlightingType::TemplateTemplateParameter)) { - return false; - } - - return extraInfo.declaration - && types.mainHighlightingType != HighlightingType::LocalVariable - && types.mainHighlightingType != HighlightingType::Parameter - && (types.mixinHighlightingTypes.contains(HighlightingType::Operator) - == extraInfo.token.startsWith("operator")); - } - - friend QDataStream &operator<<(QDataStream &out, const TokenInfoContainer &container) - { - out << container.line; - out << container.column; - out << container.length; - out << container.types; - out << container.noExtraInfo; - - if (container.noExtraInfo) - return out; - - out << container.extraInfo; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, TokenInfoContainer &container) - { - in >> container.line; - in >> container.column; - in >> container.length; - in >> container.types; - in >> container.noExtraInfo; - - if (container.noExtraInfo) - return in; - - in >> container.extraInfo; - - return in; - } - - friend bool operator==(const TokenInfoContainer &first, const TokenInfoContainer &second) - { - return first.line == second.line - && first.column == second.column - && first.length == second.length - && first.types == second.types - && first.noExtraInfo == second.noExtraInfo - && first.extraInfo == second.extraInfo; - } - - int line = 0; - int column = 0; - int length = 0; - HighlightingTypes types; - ExtraInfo extraInfo; - bool noExtraInfo = true; -}; - -inline QDataStream &operator<<(QDataStream &out, const ExtraInfo &extraInfo) -{ - out << extraInfo.token; - out << extraInfo.typeSpelling; - out << extraInfo.semanticParentTypeSpelling; - out << extraInfo.cursorRange; - out << extraInfo.lexicalParentIndex; - out << static_cast(extraInfo.accessSpecifier); - out << static_cast(extraInfo.storageClass); - out << extraInfo.identifier; - out << extraInfo.includeDirectivePath; - out << extraInfo.declaration; - out << extraInfo.definition; - out << extraInfo.signal; - out << extraInfo.slot; - return out; -} - -inline QDataStream &operator>>(QDataStream &in, ExtraInfo &extraInfo) -{ - in >> extraInfo.token; - in >> extraInfo.typeSpelling; - in >> extraInfo.semanticParentTypeSpelling; - in >> extraInfo.cursorRange; - in >> extraInfo.lexicalParentIndex; - - uint accessSpecifier; - uint storageClass; - bool isIdentifier; - bool isInclusion; - bool isDeclaration; - bool isDefinition; - bool isSignal; - bool isSlot; - - in >> accessSpecifier; - in >> storageClass; - in >> isIdentifier; - in >> isInclusion; - in >> isDeclaration; - in >> isDefinition; - in >> isSignal; - in >> isSlot; - - extraInfo.accessSpecifier = static_cast(accessSpecifier); - extraInfo.storageClass = static_cast(storageClass); - extraInfo.identifier = isIdentifier; - extraInfo.includeDirectivePath = isInclusion; - extraInfo.declaration = isDeclaration; - extraInfo.definition = isDefinition; - extraInfo.signal = isSignal; - extraInfo.slot = isSlot; - return in; -} - -inline bool operator==(const ExtraInfo &first, const ExtraInfo &second) -{ - return first.token == second.token - && first.typeSpelling == second.typeSpelling - && first.semanticParentTypeSpelling == second.semanticParentTypeSpelling - && first.cursorRange == second.cursorRange - && first.lexicalParentIndex == second.lexicalParentIndex - && first.accessSpecifier == second.accessSpecifier - && first.storageClass == second.storageClass - && first.identifier == second.identifier - && first.includeDirectivePath == second.includeDirectivePath - && first.declaration == second.declaration - && first.definition == second.definition - && first.signal == second.signal - && first.slot == second.slot; -} - -inline QDataStream &operator<<(QDataStream &out, HighlightingType highlightingType) -{ - out << static_cast(highlightingType); - - return out; -} - -inline QDataStream &operator<<(QDataStream &out, HighlightingTypes highlightingTypes) -{ - out << highlightingTypes.mainHighlightingType; - - out << highlightingTypes.mixinHighlightingTypes.size(); - - for (HighlightingType type : highlightingTypes.mixinHighlightingTypes) - out << type; - - return out; -} - - -inline QDataStream &operator>>(QDataStream &in, HighlightingType &highlightingType) -{ - quint8 highlightingTypeInt; - - in >> highlightingTypeInt; - - highlightingType = static_cast(highlightingTypeInt); - - return in; -} - -inline QDataStream &operator>>(QDataStream &in, HighlightingTypes &highlightingTypes) -{ - in >> highlightingTypes.mainHighlightingType ; - - quint8 size; - in >> size; - - for (int counter = 0; counter < size; ++counter) { - HighlightingType type; - in >> type; - highlightingTypes.mixinHighlightingTypes.push_back(type); - } - - return in; -} - -inline bool operator==(const MixinHighlightingTypes &first, const MixinHighlightingTypes &second) -{ - return first.size() == second.size() - && std::equal(first.begin(), first.end(), second.begin()); -} - -inline bool operator==(const HighlightingTypes &first, const HighlightingTypes &second) -{ - return first.mainHighlightingType == second.mainHighlightingType - && first.mixinHighlightingTypes == second.mixinHighlightingTypes; -} - -inline QDataStream &operator<<(QDataStream &out, ByteSizeBitset bits) -{ - // Narrow unsigned long to uint8_t - out << static_cast(bits.to_ulong()); - return out; -} - -inline QDataStream &operator>>(QDataStream &in, ByteSizeBitset &bits) -{ - uint8_t byteValue; - in >> byteValue; - bits = ByteSizeBitset(byteValue); - return in; -} - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const TokenInfoContainer &container); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/tooltipinfo.cpp b/src/libs/clangsupport/tooltipinfo.cpp deleted file mode 100644 index 379f53741b9..00000000000 --- a/src/libs/clangsupport/tooltipinfo.cpp +++ /dev/null @@ -1,65 +0,0 @@ -/**************************************************************************** -** -** 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. -** -****************************************************************************/ - -#include "tooltipinfo.h" - -#include - -namespace ClangBackEnd { - -#define RETURN_TEXT_FOR_CASE(enumValue) case ToolTipInfo::enumValue: return #enumValue -const char *qdocCategoryToString(ToolTipInfo::QdocCategory category) -{ - switch (category) { - RETURN_TEXT_FOR_CASE(Unknown); - RETURN_TEXT_FOR_CASE(ClassOrNamespace); - RETURN_TEXT_FOR_CASE(Enum); - RETURN_TEXT_FOR_CASE(Typedef); - RETURN_TEXT_FOR_CASE(Macro); - RETURN_TEXT_FOR_CASE(Brief); - RETURN_TEXT_FOR_CASE(Function); - } - - return "UnhandledQdocCategory"; -} -#undef RETURN_TEXT_FOR_CASE - -QDebug operator<<(QDebug debug, const ToolTipInfo &message) -{ - debug.nospace() << "ToolTipInfo("; - - debug.nospace() << message.text << ", "; - debug.nospace() << message.briefComment << ", "; - debug.nospace() << message.qdocIdCandidates << ", "; - debug.nospace() << message.qdocMark << ", "; - debug.nospace() << qdocCategoryToString(message.qdocCategory) << ", "; - debug.nospace() << message.sizeInBytes << ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/tooltipinfo.h b/src/libs/clangsupport/tooltipinfo.h deleted file mode 100644 index 3d443c5b640..00000000000 --- a/src/libs/clangsupport/tooltipinfo.h +++ /dev/null @@ -1,113 +0,0 @@ -/**************************************************************************** -** -** 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 "utf8string.h" -#include - -#include - -#include "clangsupport_global.h" - -namespace ClangBackEnd { - -class ToolTipInfo -{ -public: - enum QdocCategory : quint8 { - Unknown, - ClassOrNamespace, - Enum, - Typedef, - Macro, - Brief, - Function, - }; - -public: - ToolTipInfo() = default; - ToolTipInfo(const Utf8String &text) : text(text) {} - - friend QDataStream &operator<<(QDataStream &out, const ToolTipInfo &message) - { - out << message.text; - out << message.briefComment; - out << message.qdocIdCandidates; - out << message.qdocMark; - out << static_cast(message.qdocCategory); - out << message.value; - out << message.sizeInBytes; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ToolTipInfo &message) - { - quint8 qdocCategory; - - in >> message.text; - in >> message.briefComment; - in >> message.qdocIdCandidates; - in >> message.qdocMark; - in >> qdocCategory; - in >> message.value; - in >> message.sizeInBytes; - - message.qdocCategory = static_cast(qdocCategory); - - return in; - } - - friend bool operator==(const ToolTipInfo &first, const ToolTipInfo &second) - { - return first.text == second.text - && first.briefComment == second.briefComment - && first.qdocIdCandidates == second.qdocIdCandidates - && first.qdocMark == second.qdocMark - && first.qdocCategory == second.qdocCategory - && first.value == second.value - && first.sizeInBytes == second.sizeInBytes; - } - -public: - Utf8String text; - Utf8String briefComment; - - Utf8StringVector qdocIdCandidates; - Utf8String qdocMark; - QdocCategory qdocCategory = Unknown; - QVariant value; - - // For class definition and for class fields. - Utf8String sizeInBytes; -}; - -QDebug operator<<(QDebug debug, const ToolTipInfo &message); -std::ostream &operator<<(std::ostream &os, const ToolTipInfo &message); - -CLANGSUPPORT_EXPORT const char *qdocCategoryToString(ToolTipInfo::QdocCategory category); - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/tooltipmessage.cpp b/src/libs/clangsupport/tooltipmessage.cpp deleted file mode 100644 index 9cffb42f019..00000000000 --- a/src/libs/clangsupport/tooltipmessage.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/**************************************************************************** -** -** 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. -** -****************************************************************************/ - -#include "tooltipmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const ToolTipMessage &message) -{ - debug.nospace() << "ToolTipMessage(" - << message.fileContainer - << ", " << message.ticketNumber - << ", " << message.toolTipInfo; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/tooltipmessage.h b/src/libs/clangsupport/tooltipmessage.h deleted file mode 100644 index 547f8e466ad..00000000000 --- a/src/libs/clangsupport/tooltipmessage.h +++ /dev/null @@ -1,82 +0,0 @@ -/**************************************************************************** -** -** 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 "filecontainer.h" -#include "tooltipinfo.h" - -#include - -namespace ClangBackEnd { - -class ToolTipMessage -{ -public: - ToolTipMessage() = default; - ToolTipMessage(const FileContainer &fileContainer, - const ToolTipInfo &toolTipInfo, - quint64 ticketNumber) - : fileContainer(fileContainer) - , toolTipInfo(toolTipInfo) - , ticketNumber(ticketNumber) - { - } - - friend QDataStream &operator<<(QDataStream &out, const ToolTipMessage &message) - { - out << message.fileContainer; - out << message.toolTipInfo;; - out << message.ticketNumber; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ToolTipMessage &message) - { - in >> message.fileContainer; - in >> message.toolTipInfo; - in >> message.ticketNumber; - - return in; - } - - friend bool operator==(const ToolTipMessage &first, const ToolTipMessage &second) - { - return first.ticketNumber == second.ticketNumber - && first.fileContainer == second.fileContainer - && first.toolTipInfo == second.toolTipInfo; - } - -public: - FileContainer fileContainer; - ToolTipInfo toolTipInfo; - quint64 ticketNumber = 0; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ToolTipMessage &message); - -DECLARE_MESSAGE(ToolTipMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/unsavedfilesremovedmessage.cpp b/src/libs/clangsupport/unsavedfilesremovedmessage.cpp deleted file mode 100644 index 8da5ca1c1b9..00000000000 --- a/src/libs/clangsupport/unsavedfilesremovedmessage.cpp +++ /dev/null @@ -1,45 +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. -** -****************************************************************************/ - -#include "unsavedfilesremovedmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const UnsavedFilesRemovedMessage &message) -{ - debug.nospace() << "UnsavedFilesRemovedMessage("; - - for (const FileContainer &fileContainer : message.fileContainers) - debug.nospace() << fileContainer<< ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/unsavedfilesremovedmessage.h b/src/libs/clangsupport/unsavedfilesremovedmessage.h deleted file mode 100644 index 58714b407f2..00000000000 --- a/src/libs/clangsupport/unsavedfilesremovedmessage.h +++ /dev/null @@ -1,70 +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 "filecontainer.h" - -#include - -namespace ClangBackEnd { - -class UnsavedFilesRemovedMessage -{ -public: - UnsavedFilesRemovedMessage() = default; - UnsavedFilesRemovedMessage(const QVector &fileContainers) - : fileContainers(fileContainers) - { - } - - friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesRemovedMessage &message) - { - out << message.fileContainers; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, UnsavedFilesRemovedMessage &message) - { - in >> message.fileContainers; - - return in; - } - - friend bool operator==(const UnsavedFilesRemovedMessage &first, - const UnsavedFilesRemovedMessage &second) - { - return first.fileContainers == second.fileContainers; - } - -public: - QVector fileContainers; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnsavedFilesRemovedMessage &message); - -DECLARE_MESSAGE(UnsavedFilesRemovedMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/unsavedfilesupdatedmessage.cpp b/src/libs/clangsupport/unsavedfilesupdatedmessage.cpp deleted file mode 100644 index 80000a65664..00000000000 --- a/src/libs/clangsupport/unsavedfilesupdatedmessage.cpp +++ /dev/null @@ -1,45 +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. -** -****************************************************************************/ - -#include "unsavedfilesupdatedmessage.h" - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const UnsavedFilesUpdatedMessage &message) -{ - debug.nospace() << "UnsavedFilesUpdatedMessage("; - - for (const FileContainer &fileContainer : message.fileContainers) - debug.nospace() << fileContainer<< ", "; - - debug.nospace() << ")"; - - return debug; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/unsavedfilesupdatedmessage.h b/src/libs/clangsupport/unsavedfilesupdatedmessage.h deleted file mode 100644 index 5d796f7ae00..00000000000 --- a/src/libs/clangsupport/unsavedfilesupdatedmessage.h +++ /dev/null @@ -1,70 +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 "filecontainer.h" - -#include - -namespace ClangBackEnd { - -class UnsavedFilesUpdatedMessage -{ -public: - UnsavedFilesUpdatedMessage() = default; - UnsavedFilesUpdatedMessage(const QVector &fileContainers) - : fileContainers(fileContainers) - { - } - - friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesUpdatedMessage &message) - { - out << message.fileContainers; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, UnsavedFilesUpdatedMessage &message) - { - in >> message.fileContainers; - - return in; - } - - friend bool operator==(const UnsavedFilesUpdatedMessage &first, - const UnsavedFilesUpdatedMessage &second) - { - return first.fileContainers == second.fileContainers; - } - -public: - QVector fileContainers; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnsavedFilesUpdatedMessage &message); - -DECLARE_MESSAGE(UnsavedFilesUpdatedMessage); -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/utf8string.cpp b/src/libs/clangsupport/utf8string.cpp deleted file mode 100644 index ad7748cfa53..00000000000 --- a/src/libs/clangsupport/utf8string.cpp +++ /dev/null @@ -1,58 +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. -** -****************************************************************************/ - -#include "utf8string.h" - -#include "utf8stringvector.h" - -#include -#include - -#include - -QDebug operator<<(QDebug debug, const Utf8String &text) -{ - debug << text.constData(); - - return debug; -} - -std::ostream& operator<<(std::ostream &os, const Utf8String &utf8String) -{ - using std::ostream; - os << utf8String.constData(); - - return os; -} - -Utf8StringVector Utf8String::split(char separator) const -{ - Utf8StringVector utf8Vector; - - for (const QByteArray &byteArrayPart : byteArray.split(separator)) - utf8Vector.append(Utf8String::fromByteArray(byteArrayPart)); - - return utf8Vector; -} diff --git a/src/libs/clangsupport/utf8string.h b/src/libs/clangsupport/utf8string.h deleted file mode 100644 index ebd9aba0a6e..00000000000 --- a/src/libs/clangsupport/utf8string.h +++ /dev/null @@ -1,323 +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 -#include -#include -#include -#include - -#include -#include - -class Utf8StringVector; -class Utf8String; - -class Utf8String -{ - friend class Utf8StringVector; - -public: - Utf8String() = default; - - explicit Utf8String(const char *utf8Text) - : byteArray(utf8Text, utf8Text ? static_cast(std::strlen(utf8Text)) : -1) - {} - - explicit Utf8String(const char *utf8Text, int size) - : byteArray(utf8Text, size) - {} - - Utf8String(const QString &text) - : byteArray(text.toUtf8()) - { - } - - const char *constData() const - { - return byteArray.constData(); - } - - int byteSize() const - { - return byteArray.size(); - } - - static Utf8String fromUtf8(const char *utf8Text) - { - return Utf8String(utf8Text, -1); - } - - static Utf8String fromByteArray(const QByteArray &utf8ByteArray) - { - return Utf8String(utf8ByteArray); - } - const QByteArray &toByteArray() const - { - return byteArray; - } - - static Utf8String fromString(const QString &text) - { - return Utf8String::fromByteArray(text.toUtf8()); - } - - QString toString() const - { - return QString::fromUtf8(byteArray, byteArray.size()); - } - - Utf8String mid(int position, int length = -1) const - { - return Utf8String(byteArray.mid(position, length)); - } - - void replace(const Utf8String &before, const Utf8String &after) - { - byteArray.replace(before.byteArray, after.byteArray); - } - - void replace(int position, int length, const Utf8String &after) - { - byteArray.replace(position, length, after.byteArray); - } - - CLANGSUPPORT_EXPORT Utf8StringVector split(char separator) const; - - void clear() - { - byteArray.clear(); - } - - void append(const Utf8String &textToAppend) - { - byteArray.append(textToAppend.byteArray); - } - - void chop(int n) - { - byteArray.chop(n); - } - - int indexOf(const Utf8String &text) const - { - return byteArray.indexOf(text.byteArray); - } - - int indexOf(const char *text) const - { - return byteArray.indexOf(text); - } - - int lastIndexOf(const Utf8String &text) const - { - return byteArray.lastIndexOf(text.byteArray); - } - - int lastIndexOf(const char *text) const - { - return byteArray.lastIndexOf(text); - } - - int indexOf(char character) const - { - return byteArray.indexOf(character); - } - - bool contains(const Utf8String &text) const - { - return byteArray.contains(text.byteArray); - } - - bool contains(const char *text) const - { - return byteArray.contains(text); - } - - bool contains(char character) const - { - return byteArray.contains(character); - } - - bool startsWith(const Utf8String &text) const - { - return byteArray.startsWith(text.byteArray); - } - - bool startsWith(const char *text) const - { - return byteArray.startsWith(text); - } - - bool startsWith(char character) const - { - return byteArray.startsWith(character); - } - - bool endsWith(const Utf8String &text) const - { - return byteArray.endsWith(text.byteArray); - } - - bool endsWith(const char *text) const - { - return byteArray.endsWith(text); - } - - bool endsWith(char character) const - { - return byteArray.endsWith(character); - } - - bool isNull() const - { - return byteArray.isNull(); - } - - bool isEmpty() const - { - return byteArray.isEmpty(); - } - - bool hasContent() const - { - return !isEmpty(); - } - - void reserve(int reserveSize) - { - byteArray.reserve(reserveSize); - } - - template - static Utf8String number(T number, int base = 10) - { - return Utf8String::fromByteArray(QByteArray::number(number, base)); - } - - const Utf8String &operator+=(const Utf8String &text) - { - byteArray += text.byteArray; - - return *this; - } - - static void registerType() - { - qRegisterMetaType("Utf8String"); - } - - operator QString() const - { - return toString(); - } - - operator const QByteArray &() const - { - return byteArray; - } - - friend const Utf8String operator+(const Utf8String &first, const Utf8String &second) - { - return Utf8String(first.byteArray + second.byteArray); - } - - friend bool operator!=(const Utf8String &first, const Utf8String &second) - { - return first.byteArray != second.byteArray; - } - - friend bool operator==(const Utf8String &first, const Utf8String &second) - { - return first.byteArray == second.byteArray; - } - - friend bool operator==(const Utf8String &first, const char *second) - { - return first.byteArray == second; - } - - friend bool operator==(const char *first, const Utf8String &second) - { - return second == first; - } - - friend bool operator!=(const Utf8String &first, const char *second) - { - return first.byteArray != second; - } - - friend bool operator!=(const char *first, const Utf8String &second) { return second != first; } - - friend bool operator==(const Utf8String &first, const QString &second) - { - return first.byteArray == second.toUtf8(); - } - - friend bool operator<(const Utf8String &first, const Utf8String &second) - { - if (first.byteSize() == second.byteSize()) - return first.byteArray < second.byteArray; - - return first.byteSize() < second.byteSize(); - } - - friend QDataStream &operator<<(QDataStream &datastream, const Utf8String &text) - { - datastream << text.byteArray; - - return datastream; - } - - friend QDataStream &operator>>(QDataStream &datastream, Utf8String &text) - { - datastream >> text.byteArray; - - return datastream; - } - - friend auto qHash(const Utf8String &utf8String) - { - return qHash(utf8String.byteArray); - } - -protected: - explicit Utf8String(const QByteArray &utf8ByteArray) - : byteArray(utf8ByteArray) - { - } - -private: - QByteArray byteArray; -}; - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const Utf8String &text); -CLANGSUPPORT_EXPORT std::ostream &operator<<(std::ostream &os, const Utf8String &utf8String); - -#define Utf8StringLiteral(str) Utf8String::fromByteArray(QByteArrayLiteral(str)) diff --git a/src/libs/clangsupport/utf8stringvector.cpp b/src/libs/clangsupport/utf8stringvector.cpp deleted file mode 100644 index f892a173db1..00000000000 --- a/src/libs/clangsupport/utf8stringvector.cpp +++ /dev/null @@ -1,113 +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. -** -****************************************************************************/ - -#include "utf8stringvector.h" - -#include -#include - -#include - -Utf8StringVector::Utf8StringVector() -{ -} - -Utf8StringVector::Utf8StringVector(std::initializer_list initializerList) - : QVector(initializerList) -{ - -} - -Utf8StringVector::Utf8StringVector(const Utf8String &utf8String) -{ - append(utf8String); -} - -Utf8StringVector::Utf8StringVector(const QVector &vector) - : QVector(vector) -{ - -} - -Utf8StringVector::Utf8StringVector(const QStringList &stringList) -{ - reserve(stringList.count()); - - foreach (const QString &string, stringList) - append(Utf8String(string)); -} - -Utf8StringVector::Utf8StringVector(int size, const Utf8String &text) - : QVector(size, text) -{ -} - -Utf8String Utf8StringVector::join(const Utf8String &separator) const -{ - Utf8String joindedString; - - joindedString.reserve(totalByteSize() + separator.byteSize() * count()); - - for (auto position = begin(); position != end(); ++position) { - joindedString.append(*position); - if (std::next(position) != end()) - joindedString.append(separator); - } - - return joindedString; -} - -Utf8StringVector Utf8StringVector::fromIntegerVector(const QVector &integerVector) -{ - Utf8StringVector utf8StringVector; - utf8StringVector.reserve(integerVector.count()); - - foreach (int integer, integerVector) - utf8StringVector.append(Utf8String::number(integer)); - - return utf8StringVector; -} - -void Utf8StringVector::registerType() -{ - qRegisterMetaType("Utf8StringVector"); -} - -int Utf8StringVector::totalByteSize() const -{ - int totalSize = 0; - - for (const Utf8String &utf8String : *this) - totalSize += utf8String.byteSize(); - - return totalSize; -} - -QDebug operator<<(QDebug debug, const Utf8StringVector &textVector) -{ - debug << "Utf8StringVector(" << textVector.join(Utf8StringLiteral(", ")).constData() << ")"; - - return debug; -} diff --git a/src/libs/clangsupport/utf8stringvector.h b/src/libs/clangsupport/utf8stringvector.h deleted file mode 100644 index 31c681ecb95..00000000000 --- a/src/libs/clangsupport/utf8stringvector.h +++ /dev/null @@ -1,105 +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 "utf8string.h" - -#include -#include - -#include - -class CLANGSUPPORT_EXPORT Utf8StringVector : public QVector -{ -public: - Utf8StringVector(); - Utf8StringVector(std::initializer_list initializerList); - explicit Utf8StringVector(const Utf8String &utf8String); - Utf8StringVector(const QVector &vector); - explicit Utf8StringVector(const QStringList &stringList); - explicit Utf8StringVector(int size, const Utf8String &text); - - Utf8String join(const Utf8String &separator) const; - - static Utf8StringVector fromIntegerVector(const QVector &integerVector); - - static void registerType(); - - inline bool removeFast(const Utf8String &valueToBeRemoved); - -protected: - int totalByteSize() const; -}; - -bool Utf8StringVector::removeFast(const Utf8String &valueToBeRemoved) -{ - auto position = std::remove(begin(), end(), valueToBeRemoved); - - bool hasEntry = position != end(); - - erase(position, end()); - - return hasEntry; -} - -namespace std { // it has to be in std namespace for lookup - -template -ostream &operator<<(ostream &out, const QVector &vector) -{ - out << "["; - - copy(vector.cbegin(), vector.cend(), ostream_iterator(out, ", ")); - - out << "]"; - - return out; -} - -inline -ostream &operator<<(ostream &out, const Utf8StringVector &vector) -{ - out << "["; - - copy(vector.cbegin(), vector.cend(), ostream_iterator(out, ", ")); - - out << "]"; - - return out; -} - -} // namespace std - -inline QDataStream &operator<<(QDataStream &s, const Utf8StringVector &v) -{ return s << static_cast &>(v); } - -inline QDataStream &operator>>(QDataStream &s, Utf8StringVector &v) -{ return s >> static_cast &>(v); } - -CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const Utf8StringVector &textVector); - -Q_DECLARE_METATYPE(Utf8StringVector) diff --git a/src/libs/clangsupport/writemessageblock.cpp b/src/libs/clangsupport/writemessageblock.cpp deleted file mode 100644 index b3fe4a51edb..00000000000 --- a/src/libs/clangsupport/writemessageblock.cpp +++ /dev/null @@ -1,106 +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. -** -****************************************************************************/ - -#include "writemessageblock.h" - -#include "messageenvelop.h" - -#include -#include -#include -#include - -namespace ClangBackEnd { - -WriteMessageBlock::WriteMessageBlock(QIODevice *ioDevice) - : m_ioDevice(ioDevice) -{} - -WriteMessageBlock::WriteMessageBlock(QLocalSocket *localSocket) - : m_ioDevice(localSocket) - , m_localSocket(localSocket) -{} - -void WriteMessageBlock::write(const MessageEnvelop &message) -{ - QDataStream out(&m_block, QIODevice::WriteOnly | QIODevice::Append); - - int startOffset = m_block.size(); - const qint32 dummyBockSize = 0; - out << dummyBockSize; - - out << m_messageCounter; - - out << message; - - out.device()->seek(startOffset); - out << qint32(m_block.size() - startOffset - sizeof(qint32)); - - ++m_messageCounter; - - flushBlock(); -} - -qint64 WriteMessageBlock::counter() const -{ - return m_messageCounter; -} - -void WriteMessageBlock::resetState() -{ - m_block.clear(); - m_messageCounter = 0; -} - -void WriteMessageBlock::setIoDevice(QIODevice *ioDevice) -{ - m_ioDevice = ioDevice; - if (m_localSocket != ioDevice) - m_localSocket = nullptr; - - flushBlock(); -} - -void WriteMessageBlock::setLocalSocket(QLocalSocket *localSocket) -{ - m_localSocket = localSocket; - - setIoDevice(localSocket); -} - -void WriteMessageBlock::flushBlock() -{ - if (m_ioDevice) { - const qint64 bytesWritten = m_ioDevice->write(m_block); - m_block.clear(); - if (bytesWritten == -1) - qWarning() << "Failed to write data:" << m_ioDevice->errorString(); - if (m_localSocket) - m_localSocket->flush(); - } -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/writemessageblock.h b/src/libs/clangsupport/writemessageblock.h deleted file mode 100644 index e8baa978d05..00000000000 --- a/src/libs/clangsupport/writemessageblock.h +++ /dev/null @@ -1,68 +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 -#include - -#include "clangsupport_global.h" - -QT_BEGIN_NAMESPACE -class QVariant; -class QDataStream; -class QIODevice; -class QLocalSocket; -QT_END_NAMESPACE - -namespace ClangBackEnd { - -class MessageEnvelop; - -class CLANGSUPPORT_EXPORT WriteMessageBlock -{ -public: - WriteMessageBlock(QIODevice *ioDevice = nullptr); - WriteMessageBlock(QLocalSocket *localSocket); - - void write(const MessageEnvelop &message); - - qint64 counter() const; - - void resetState(); - - void setIoDevice(QIODevice *ioDevice); - void setLocalSocket(QLocalSocket *localSocket); - - void flushBlock(); - -private: - QByteArray m_block; - qint64 m_messageCounter = 0; - QIODevice *m_ioDevice = {}; - QLocalSocket *m_localSocket = {}; -}; - -} // namespace ClangBackEnd diff --git a/src/libs/libs.qbs b/src/libs/libs.qbs index 99beea8dc65..2b1cda7cfc6 100644 --- a/src/libs/libs.qbs +++ b/src/libs/libs.qbs @@ -8,7 +8,6 @@ Project { references: [ "advanceddockingsystem/advanceddockingsystem.qbs", "aggregation/aggregation.qbs", - "clangsupport/clangsupport.qbs", "cplusplus/cplusplus.qbs", "extensionsystem/extensionsystem.qbs", "glsl/glsl.qbs", diff --git a/src/plugins/clangcodemodel/clangutils.h b/src/plugins/clangcodemodel/clangutils.h index b69d99748bb..4480bdc5438 100644 --- a/src/plugins/clangcodemodel/clangutils.h +++ b/src/plugins/clangcodemodel/clangutils.h @@ -46,8 +46,6 @@ class CppEditorDocumentHandle; namespace TextEditor { class TextDocumentManipulatorInterface; } -namespace ClangBackEnd { class TokenInfoContainer; } - namespace ProjectExplorer { class Project; } namespace ClangCodeModel { diff --git a/src/plugins/clangtools/CMakeLists.txt b/src/plugins/clangtools/CMakeLists.txt index 51c5d0ba195..51bccb10233 100644 --- a/src/plugins/clangtools/CMakeLists.txt +++ b/src/plugins/clangtools/CMakeLists.txt @@ -4,7 +4,7 @@ set(CLANG_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PAT add_qtc_plugin(ClangTools CONDITION TARGET yaml-cpp - DEPENDS ClangSupport yaml-cpp + DEPENDS yaml-cpp PLUGIN_DEPENDS Core Debugger CppEditor PLUGIN_RECOMMENDS CppEditor PLUGIN_TEST_DEPENDS QmakeProjectManager QbsProjectManager diff --git a/tests/unit/CMakeLists.txt b/tests/unit/CMakeLists.txt index 815b20fa182..8eb2367774f 100644 --- a/tests/unit/CMakeLists.txt +++ b/tests/unit/CMakeLists.txt @@ -21,8 +21,6 @@ if (NOT QT_CREATOR_API_DEFINED) set(CMAKE_INCLUDE_CURRENT_DIR ON) - set(BUILD_EXECUTABLES echo) - set(IMPLICIT_DEPENDS Qt5::Test) include(QtCreatorIDEBranding) @@ -38,5 +36,4 @@ if (NOT QT_CREATOR_API_DEFINED) find_package(Threads) endif() -add_subdirectory(echoserver) add_subdirectory(unittest) diff --git a/tests/unit/echoserver/CMakeLists.txt b/tests/unit/echoserver/CMakeLists.txt deleted file mode 100644 index 1be94e375d0..00000000000 --- a/tests/unit/echoserver/CMakeLists.txt +++ /dev/null @@ -1,9 +0,0 @@ -add_qtc_executable(echo - DEPENDS Qt5::Core Qt5::Network ClangSupport - DEFINES CLANGSUPPORT_TESTS DONT_CHECK_MESSAGE_COUNTER - SOURCES - echoclangcodemodelserver.cpp echoclangcodemodelserver.h - echoserverprocessmain.cpp - SKIP_INSTALL - PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR} -) diff --git a/tests/unit/echoserver/echoclangcodemodelserver.cpp b/tests/unit/echoserver/echoclangcodemodelserver.cpp deleted file mode 100644 index 67ba74cae94..00000000000 --- a/tests/unit/echoserver/echoclangcodemodelserver.cpp +++ /dev/null @@ -1,107 +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. -** -****************************************************************************/ - -#include "echoclangcodemodelserver.h" - -#include -#include - -#include -#include - -namespace ClangBackEnd { - -void EchoClangCodeModelServer::dispatch(const MessageEnvelop &message) -{ - ClangCodeModelServerInterface::dispatch(message); -} - -void EchoClangCodeModelServer::end() -{ - QCoreApplication::quit(); -} - -void EchoClangCodeModelServer::documentsOpened(const DocumentsOpenedMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::documentsChanged(const DocumentsChangedMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::documentsClosed(const DocumentsClosedMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::requestCompletions(const RequestCompletionsMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::requestAnnotations(const RequestAnnotationsMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::requestReferences(const RequestReferencesMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::requestFollowSymbol(const RequestFollowSymbolMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::requestToolTip(const RequestToolTipMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) -{ - echoMessage(message); -} - -void EchoClangCodeModelServer::echoMessage(const MessageEnvelop &message) -{ - client()->echo(EchoMessage(message)); -} - -} // namespace ClangBackEnd - diff --git a/tests/unit/echoserver/echoclangcodemodelserver.h b/tests/unit/echoserver/echoclangcodemodelserver.h deleted file mode 100644 index 58db3613e3c..00000000000 --- a/tests/unit/echoserver/echoclangcodemodelserver.h +++ /dev/null @@ -1,58 +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 -#include - -namespace ClangBackEnd { - -class EchoClangCodeModelServer : public ClangCodeModelServerInterface, - public IpcClientProvider -{ -public: - void dispatch(const MessageEnvelop &message) override; - void end() override; - - void documentsOpened(const DocumentsOpenedMessage &message) override; - void documentsChanged(const DocumentsChangedMessage &message) override; - void documentsClosed(const DocumentsClosedMessage &message) override; - void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) override; - - void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) override; - void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) override; - - void requestCompletions(const RequestCompletionsMessage &message) override; - void requestAnnotations(const RequestAnnotationsMessage &message) override; - void requestReferences(const RequestReferencesMessage &message) override; - void requestFollowSymbol(const RequestFollowSymbolMessage &message) override; - void requestToolTip(const RequestToolTipMessage &message) override; - -private: - void echoMessage(const MessageEnvelop &message); -}; - -} // namespace ClangBackEnd diff --git a/tests/unit/echoserver/echoserver.qbs b/tests/unit/echoserver/echoserver.qbs deleted file mode 100644 index 77df73a6d60..00000000000 --- a/tests/unit/echoserver/echoserver.qbs +++ /dev/null @@ -1,30 +0,0 @@ -import qbs.FileInfo - -QtcProduct { - name: "echoserver" - type: "application" - targetName: "echo" - consoleApplication: true - destinationDirectory: FileInfo.joinPaths(project.buildDirectory, - FileInfo.relativePath(project.ide_source_tree, sourceDirectory)) - install: false - - Depends { name: "qtc" } - Depends { name: "ClangSupport" } - Depends { name: "Sqlite" } - Depends { name: "Utils" } - Depends { name: "Qt.network" } - - cpp.defines: ["CLANGSUPPORT_TESTS", "DONT_CHECK_MESSAGE_COUNTER"] - cpp.dynamicLibraries: qbs.targetOS.contains("unix:") ? ["dl"] : [] - cpp.rpaths: [ - FileInfo.joinPaths(project.buildDirectory, qtc.ide_library_path), - FileInfo.joinPaths(project.buildDirectory, qtc.ide_plugin_path) - ] - - files: [ - "echoclangcodemodelserver.cpp", - "echoclangcodemodelserver.h", - "echoserverprocessmain.cpp", - ] -} diff --git a/tests/unit/echoserver/echoserverprocessmain.cpp b/tests/unit/echoserver/echoserverprocessmain.cpp deleted file mode 100644 index 5225007617f..00000000000 --- a/tests/unit/echoserver/echoserverprocessmain.cpp +++ /dev/null @@ -1,57 +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. -** -****************************************************************************/ - -#include "echoclangcodemodelserver.h" - -#include -#include - -#include - -using ClangBackEnd::ClangCodeModelClientProxy; -using ClangBackEnd::ConnectionServer; -using ClangBackEnd::EchoClangCodeModelServer; - -int main(int argc, char *argv[]) -{ - QCoreApplication::setOrganizationName("QtProject"); - QCoreApplication::setOrganizationDomain("qt-project.org"); - QCoreApplication::setApplicationName("EchoCodeModelBackend"); - QCoreApplication::setApplicationVersion("1.0.0"); - - QCoreApplication application(argc, argv); - - if (application.arguments().count() < 2) - return 1; - if (application.arguments().contains("connectionName")) - return 0; - - EchoClangCodeModelServer echoClangCodeModelServer; - ConnectionServer connectionServer; - connectionServer.setServer(&echoClangCodeModelServer); - connectionServer.start(application.arguments()[1]); - - return application.exec(); -} diff --git a/tests/unit/unit.qbs b/tests/unit/unit.qbs index cd81873834c..f6c9dc3e9d3 100644 --- a/tests/unit/unit.qbs +++ b/tests/unit/unit.qbs @@ -2,7 +2,6 @@ Project { name: "C++ unit tests" condition: project.withAutotests references: [ - "echoserver/echoserver.qbs", "unittest/unittest.qbs", ] } diff --git a/tests/unit/unittest/CMakeLists.txt b/tests/unit/unittest/CMakeLists.txt index e37839e2af7..dc243e75aa6 100644 --- a/tests/unit/unittest/CMakeLists.txt +++ b/tests/unit/unittest/CMakeLists.txt @@ -42,19 +42,14 @@ add_qtc_test(unittest GTEST DONT_CHECK_MESSAGE_COUNTER QTC_RESOURCE_DIR="${CMAKE_CURRENT_LIST_DIR}/../../../share/qtcreator" TESTDATA_DIR="${CMAKE_CURRENT_BINARY_DIR}/data" - ECHOSERVER="$/echo" TEST_RELATIVE_LIBEXEC_PATH="${TEST_RELATIVE_LIBEXEC_PATH}" SOURCES abstractviewmock.h - clientserverinprocess-test.cpp - clientserveroutsideprocess-test.cpp compare-operators.h conditionally-disabled-tests.h - dummyclangipcclient.h dynamicastmatcherdiagnosticcontainer-matcher.h eventspy.cpp eventspy.h fakeprocess.cpp fakeprocess.h - filesystem-utilities.h googletest.h google-using-declarations.h gtest-creator-printing.cpp gtest-creator-printing.h @@ -62,22 +57,16 @@ add_qtc_test(unittest GTEST gtest-qt-printing.cpp gtest-qt-printing.h gtest-std-printing.h lastchangedrowid-test.cpp - lineprefixer-test.cpp matchingtext-test.cpp - mockclangcodemodelclient.h - mockclangcodemodelserver.h mockfutureinterface.h mockmutex.h mockqfilesystemwatcher.h - mockqueue.h mocksqlitestatement.h mocksqlitetransactionbackend.h mocksyntaxhighligher.h mocktimer.cpp mocktimer.h nodelistproperty-test.cpp - processcreator-test.cpp processevents-utilities.cpp processevents-utilities.h - readandwritemessageblock-test.cpp sizedarray-test.cpp smallstring-test.cpp sourcerangecontainer-matcher.h @@ -88,7 +77,6 @@ add_qtc_test(unittest GTEST sqlitetransaction-test.cpp unittests-main.cpp unittest-utility-functions.h - utf8-test.cpp sqlitecolumn-test.cpp sqlitedatabasebackend-test.cpp sqlitedatabase-test.cpp @@ -169,9 +157,7 @@ extend_qtc_test(unittest DEPENDS libclang SOURCES activationsequenceprocessor-test.cpp - chunksreportedmonitor.cpp readexporteddiagnostics-test.cpp - chunksreportedmonitor.h clangcompareoperators.h diagnosticcontainer-matcher.h ) @@ -354,11 +340,8 @@ if (NOT TARGET CPlusPlus) add_subdirectory(../../../src/libs/3rdparty/cplusplus ${CMAKE_CURRENT_BINARY_DIR}/3rd_cplusplus) add_subdirectory(../../../src/libs/cplusplus ${CMAKE_CURRENT_BINARY_DIR}/cplusplus) endif() -if (NOT TARGET ClangSupport) - add_subdirectory(../../../src/libs/clangsupport ${CMAKE_CURRENT_BINARY_DIR}/clangsupport) -endif() -extend_qtc_test(unittest DEPENDS Utils CPlusPlus ClangSupport) +extend_qtc_test(unittest DEPENDS Utils CPlusPlus) extend_qtc_test(unittest SOURCES_PREFIX ../../../src/plugins/clangcodemodel diff --git a/tests/unit/unittest/chunksreportedmonitor.cpp b/tests/unit/unittest/chunksreportedmonitor.cpp deleted file mode 100644 index 542a5936866..00000000000 --- a/tests/unit/unittest/chunksreportedmonitor.cpp +++ /dev/null @@ -1,59 +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. -** -****************************************************************************/ - -#include "googletest.h" - -#include "chunksreportedmonitor.h" - -#include - -namespace ClangBackEnd { - -ChunksReportedMonitor::ChunksReportedMonitor(const QFuture &future) - : m_future(future) -{ - connect(&m_futureWatcher, &QFutureWatcher::resultsReadyAt, - this, &ChunksReportedMonitor::onResultsReadyAt); - m_futureWatcher.setFuture(future); -} - -bool ChunksReportedMonitor::waitUntilFinished(int timeoutInMs) -{ - QSignalSpy spy(&m_futureWatcher, SIGNAL(finished())); - return spy.wait(timeoutInMs); -} - -void ChunksReportedMonitor::onResultsReadyAt(int, int) -{ - ++m_resultsReadyCounter; -} - -uint ChunksReportedMonitor::resultsReadyCounter() -{ - waitUntilFinished(); - return m_resultsReadyCounter; -} - -} // namespace ClangBackEnd diff --git a/tests/unit/unittest/chunksreportedmonitor.h b/tests/unit/unittest/chunksreportedmonitor.h deleted file mode 100644 index 01058492fca..00000000000 --- a/tests/unit/unittest/chunksreportedmonitor.h +++ /dev/null @@ -1,55 +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 -#include -#include - -#include - -namespace ClangBackEnd { - -class ChunksReportedMonitor : public QObject -{ - Q_OBJECT - -public: - ChunksReportedMonitor(const QFuture &future); - - uint resultsReadyCounter(); - -private: - bool waitUntilFinished(int timeoutInMs = 5000); - void onResultsReadyAt(int beginIndex, int endIndex); - -private: - QFuture m_future; - QFutureWatcher m_futureWatcher; - uint m_resultsReadyCounter = 0; -}; - -} // namespace ClangBackEnd diff --git a/tests/unit/unittest/clientserverinprocess-test.cpp b/tests/unit/unittest/clientserverinprocess-test.cpp deleted file mode 100644 index 2fe5f89bac9..00000000000 --- a/tests/unit/unittest/clientserverinprocess-test.cpp +++ /dev/null @@ -1,258 +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. -** -****************************************************************************/ - -#include "googletest.h" - -#include "mockclangcodemodelclient.h" -#include "mockclangcodemodelserver.h" - -#include -#include - -#include - -#include -#include - -#include -#include -#include - -#include - -using namespace ClangBackEnd; - -namespace { - -using ::testing::Args; -using ::testing::Property; -using ::testing::Eq; - -class ClientServerInProcess : public ::testing::Test -{ -protected: - ClientServerInProcess(); - - void SetUp(); - void TearDown(); - - - void scheduleServerMessages(); - void scheduleClientMessages(); - -protected: - Utf8String filePath{Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_function.cpp")}; - ClangBackEnd::FileContainer fileContainer{filePath, - Utf8StringLiteral("unsaved content"), - true, - 1}; - QBuffer buffer; - MockClangCodeModelClient mockClangCodeModelClient; - MockClangCodeModelServer mockClangCodeModelServer; - - ClangBackEnd::ClangCodeModelServerProxy serverProxy; - ClangBackEnd::ClangCodeModelClientProxy clientProxy; -}; - -TEST_F(ClientServerInProcess, SendEndMessage) -{ - EXPECT_CALL(mockClangCodeModelServer, end()) - .Times(1); - - serverProxy.end(); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendAliveMessage) -{ - EXPECT_CALL(mockClangCodeModelClient, alive()) - .Times(1); - - clientProxy.alive(); - scheduleClientMessages(); -} - -TEST_F(ClientServerInProcess, SendDocumentsOpenedMessage) -{ - ClangBackEnd::DocumentsOpenedMessage message({fileContainer}, filePath, {filePath}); - - EXPECT_CALL(mockClangCodeModelServer, documentsOpened(message)) - .Times(1); - - serverProxy.documentsOpened(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendUpdateTranslationUnitsForEditorMessage) -{ - ClangBackEnd::DocumentsChangedMessage message({fileContainer}); - - EXPECT_CALL(mockClangCodeModelServer, documentsChanged(message)) - .Times(1); - - serverProxy.documentsChanged(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendDocumentsClosedMessage) -{ - ClangBackEnd::DocumentsClosedMessage message({fileContainer}); - - EXPECT_CALL(mockClangCodeModelServer, documentsClosed(message)) - .Times(1); - - serverProxy.documentsClosed(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendRegisterUnsavedFilesForEditorMessage) -{ - ClangBackEnd::UnsavedFilesUpdatedMessage message({fileContainer}); - - EXPECT_CALL(mockClangCodeModelServer, unsavedFilesUpdated(message)) - .Times(1); - - serverProxy.unsavedFilesUpdated(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendUnregisterUnsavedFilesForEditorMessage) -{ - ClangBackEnd::UnsavedFilesRemovedMessage message({fileContainer}); - - EXPECT_CALL(mockClangCodeModelServer, unsavedFilesRemoved(message)) - .Times(1); - - serverProxy.unsavedFilesRemoved(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendCompleteCodeMessage) -{ - ClangBackEnd::RequestCompletionsMessage message(Utf8StringLiteral("foo.cpp"), 24, 33); - - EXPECT_CALL(mockClangCodeModelServer, requestCompletions(message)) - .Times(1); - - serverProxy.requestCompletions(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendRequestAnnotationsMessage) -{ - ClangBackEnd::RequestAnnotationsMessage message( - {Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("projectId")}); - - EXPECT_CALL(mockClangCodeModelServer, requestAnnotations(message)) - .Times(1); - - serverProxy.requestAnnotations(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendCompletionsMessage) -{ - ClangBackEnd::CodeCompletions codeCompletions({Utf8StringLiteral("newFunction()")}); - ClangBackEnd::CompletionsMessage message(codeCompletions, 1); - - EXPECT_CALL(mockClangCodeModelClient, completions(message)) - .Times(1); - - clientProxy.completions(message); - scheduleClientMessages(); -} - -TEST_F(ClientServerInProcess, DocumentVisibilityChangedMessage) -{ - ClangBackEnd::DocumentVisibilityChangedMessage - message(Utf8StringLiteral(TESTDATA_DIR "/fileone.cpp"), - {Utf8StringLiteral(TESTDATA_DIR "/fileone.cpp"), - Utf8StringLiteral(TESTDATA_DIR "/filetwo.cpp")}); - - EXPECT_CALL(mockClangCodeModelServer, documentVisibilityChanged(message)) - .Times(1); - - serverProxy.documentVisibilityChanged(message); - scheduleServerMessages(); -} - -TEST_F(ClientServerInProcess, SendAnnotationsMessage) -{ - ClangBackEnd::HighlightingTypes types; - types.mainHighlightingType = ClangBackEnd::HighlightingType::Keyword; - ClangBackEnd::TokenInfoContainer tokenInfo(1, 1, 1, types); - ClangBackEnd::DiagnosticContainer diagnostic(Utf8StringLiteral("don't do that"), - Utf8StringLiteral("warning"), - {Utf8StringLiteral("-Wpadded"), Utf8StringLiteral("-Wno-padded")}, - ClangBackEnd::DiagnosticSeverity::Warning, - {Utf8StringLiteral("foo.cpp"), 20u, 103u}, - {{{Utf8StringLiteral("foo.cpp"), 20u, 103u}, {Utf8StringLiteral("foo.cpp"), 20u, 110u}}}, - {}, - {}); - - ClangBackEnd::AnnotationsMessage message(fileContainer, - {diagnostic}, - {}, - {tokenInfo}, - QVector()); - - EXPECT_CALL(mockClangCodeModelClient, annotations(message)) - .Times(1); - - clientProxy.annotations(message); - scheduleClientMessages(); -} - -ClientServerInProcess::ClientServerInProcess() - : serverProxy(&mockClangCodeModelClient, &buffer), - clientProxy(&mockClangCodeModelServer, &buffer) -{ -} - -void ClientServerInProcess::SetUp() -{ - buffer.open(QIODevice::ReadWrite); -} - -void ClientServerInProcess::TearDown() -{ - buffer.close(); -} - -void ClientServerInProcess::scheduleServerMessages() -{ - buffer.seek(0); - clientProxy.readMessages(); - buffer.buffer().clear(); -} - -void ClientServerInProcess::scheduleClientMessages() -{ - buffer.seek(0); - serverProxy.readMessages(); - buffer.buffer().clear(); -} - -} diff --git a/tests/unit/unittest/clientserveroutsideprocess-test.cpp b/tests/unit/unittest/clientserveroutsideprocess-test.cpp deleted file mode 100644 index 75e838c8a66..00000000000 --- a/tests/unit/unittest/clientserveroutsideprocess-test.cpp +++ /dev/null @@ -1,156 +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. -** -****************************************************************************/ - -#include "googletest.h" - -#include "mockclangcodemodelclient.h" - -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include -#include - -using namespace ClangBackEnd; - -using ::testing::Eq; -using ::testing::SizeIs; - -class ClientServerOutsideProcess : public ::testing::Test -{ -protected: - void SetUp(); - void TearDown(); - -protected: - NiceMock mockClangCodeModelClient; - ClangBackEnd::ClangCodeModelConnectionClient client{&mockClangCodeModelClient}; -}; - -using ClientServerOutsideProcessSlowTest = ClientServerOutsideProcess; - -TEST_F(ClientServerOutsideProcessSlowTest, RestartProcessAsynchronously) -{ - QSignalSpy clientSpy(&client, &ConnectionClient::connectedToLocalSocket); - - client.restartProcessAsynchronously(); - - ASSERT_TRUE(clientSpy.wait(100000)); - ASSERT_TRUE(client.isProcessRunning()); - ASSERT_TRUE(client.isConnected()); -} - -TEST_F(ClientServerOutsideProcessSlowTest, RestartProcessAfterAliveTimeout) -{ - QSignalSpy clientSpy(&client, &ConnectionClient::connectedToLocalSocket); - - client.setProcessAliveTimerInterval(1); - - ASSERT_TRUE(clientSpy.wait(100000)); - ASSERT_THAT(clientSpy, SizeIs(1)); -} - -TEST_F(ClientServerOutsideProcessSlowTest, RestartProcessAfterTermination) -{ - QSignalSpy clientSpy(&client, &ConnectionClient::connectedToLocalSocket); - - client.processForTestOnly()->kill(); - - ASSERT_TRUE(clientSpy.wait(100000)); - ASSERT_THAT(clientSpy, SizeIs(1)); -} - -TEST_F(ClientServerOutsideProcess, SendDocumentsOpenedMessage) -{ - auto filePath = Utf8StringLiteral("foo.cpp"); - ClangBackEnd::FileContainer fileContainer(filePath, Utf8StringLiteral("projectId")); - ClangBackEnd::DocumentsOpenedMessage documentsOpenedMessage({fileContainer}, - filePath, - {filePath}); - EchoMessage echoMessage(documentsOpenedMessage); - - EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage)); - - client.serverProxy().documentsOpened(documentsOpenedMessage); - ASSERT_TRUE(client.waitForEcho()); -} - -TEST_F(ClientServerOutsideProcess, SendDocumentsClosedMessage) -{ - FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), Utf8StringLiteral("projectId")); - ClangBackEnd::DocumentsClosedMessage documentsClosedMessage({fileContainer}); - EchoMessage echoMessage(documentsClosedMessage); - - EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage)); - - client.serverProxy().documentsClosed(documentsClosedMessage); - ASSERT_TRUE(client.waitForEcho()); -} - -TEST_F(ClientServerOutsideProcess, SendCompleteCodeMessage) -{ - RequestCompletionsMessage codeCompleteMessage(Utf8StringLiteral("foo.cpp"), 24, 33); - EchoMessage echoMessage(codeCompleteMessage); - - EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage)); - - client.serverProxy().requestCompletions(codeCompleteMessage); - ASSERT_TRUE(client.waitForEcho()); -} - -void ClientServerOutsideProcess::SetUp() -{ - QSignalSpy clientSpy(&client, &ConnectionClient::connectedToLocalSocket); - client.setProcessPath(Utils::HostOsInfo::withExecutableSuffix(QStringLiteral(ECHOSERVER))); - - client.startProcessAndConnectToServerAsynchronously(); - - ASSERT_TRUE(clientSpy.wait(100000)); - ASSERT_THAT(clientSpy, SizeIs(1)); - - client.setProcessAliveTimerInterval(1000000); - - ASSERT_TRUE(client.isConnected()); -} - -void ClientServerOutsideProcess::TearDown() -{ - client.setProcessAliveTimerInterval(1000000); - client.waitForConnected(); - - ASSERT_TRUE(client.isProcessRunning()); - ASSERT_TRUE(client.isConnected()); - - client.finishProcess(); -} diff --git a/tests/unit/unittest/dummyclangipcclient.h b/tests/unit/unittest/dummyclangipcclient.h deleted file mode 100644 index b58fd912842..00000000000 --- a/tests/unit/unittest/dummyclangipcclient.h +++ /dev/null @@ -1,42 +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 - -class DummyIpcClient: public ClangBackEnd::ClangCodeModelClientInterface -{ -public: - void dispatch(const ClangBackEnd::MessageEnvelop &) override {} - - void alive() override {} - void echo(const ClangBackEnd::EchoMessage &) override {} - void completions(const ClangBackEnd::CompletionsMessage &) override {} - void annotations(const ClangBackEnd::AnnotationsMessage &) override {} - void references(const ClangBackEnd::ReferencesMessage &) override {} - void followSymbol(const ClangBackEnd::FollowSymbolMessage &) override {} - void tooltip(const ClangBackEnd::ToolTipMessage &) override {} -}; diff --git a/tests/unit/unittest/filesystem-utilities.h b/tests/unit/unittest/filesystem-utilities.h deleted file mode 100644 index bb6c007d641..00000000000 --- a/tests/unit/unittest/filesystem-utilities.h +++ /dev/null @@ -1,62 +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 - -#include -#include - -#include -#include - -template -ClangBackEnd::NativeFilePath toNativePath(const char (&text)[Size]) -{ - ClangBackEnd::FilePath path = text; - - return ClangBackEnd::NativeFilePath{path}; -} - -inline Utils::PathString toNativePath(const QString &text) -{ - ClangBackEnd::FilePath path{text}; - - return ClangBackEnd::NativeFilePath{path}.path(); -} - -inline Utils::PathString toNativePath(Utils::SmallStringView text) -{ - ClangBackEnd::FilePath path{text}; - - return ClangBackEnd::NativeFilePath{path}.path(); -} - -inline QString resourcePath() -{ - return QDir::cleanPath(QCoreApplication::applicationDirPath() + '/' + RELATIVE_DATA_PATH - + "/indexing_preincludes"); -} diff --git a/tests/unit/unittest/gtest-creator-printing.cpp b/tests/unit/unittest/gtest-creator-printing.cpp index 9d90fdb3e0f..3d247803386 100644 --- a/tests/unit/unittest/gtest-creator-printing.cpp +++ b/tests/unit/unittest/gtest-creator-printing.cpp @@ -31,8 +31,6 @@ #include #include -#include -#include #include #include #include @@ -43,16 +41,20 @@ #include #include #include -#include #include #include #include #include -void PrintTo(const Utf8String &text, ::std::ostream *os) +namespace std { +template ostream &operator<<(ostream &out, const QVector &vector) { - *os << text; + out << "["; + copy(vector.cbegin(), vector.cend(), ostream_iterator(out, ", ")); + out << "]"; + return out; } +} // namespace std namespace Utils { @@ -421,490 +423,6 @@ std::ostream &operator<<(std::ostream &out, const ConstTupleIterator &iterator) } // namespace SessionChangeSetInternal } // namespace Sqlite -namespace ClangBackEnd { - -std::ostream &operator<<(std::ostream &os, const FollowSymbolResult &result) -{ - os << "(" - << result.range - << ", " << result.isResultOnlyForFallBack - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const FollowSymbolMessage &message) -{ - os << "(" - << message.fileContainer << ", " - << message.ticketNumber << ", " - << message.result << ", " - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const RequestCompletionsMessage &message) -{ - os << "(" - << message.filePath << ", " - << message.line << ", " - << message.column << ", " - << message.ticketNumber << ", " - << message.funcNameStartLine << ", " - << message.funcNameStartColumn - - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const DocumentsOpenedMessage &message) -{ - os << "DocumentsOpenedMessage(" - << message.fileContainers << ", " - << message.currentEditorFilePath << ", " - << message.visibleEditorFilePaths << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const EndMessage &/*message*/) -{ - return os << "()"; -} - -std::ostream &operator<<(std::ostream &os, const AliveMessage &/*message*/) -{ - return os << "()"; -} - -std::ostream &operator<<(std::ostream &os, const CompletionsMessage &message) -{ - os << "(" - << message.codeCompletions << ", " - << message.ticketNumber - - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const AnnotationsMessage &message) -{ - os << "AnnotationsMessage(" - << message.fileContainer - << "," << message.diagnostics.size() - << "," << !message.firstHeaderErrorDiagnostic.text.isEmpty() - << "," << message.tokenInfos.size() - << "," << message.skippedPreprocessorRanges.size() - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const ReferencesMessage &message) -{ - os << "(" - << message.fileContainer << ", " - << message.ticketNumber << ", " - << message.isLocalVariable << ", " - << message.references << ", " - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const ToolTipMessage &message) -{ - os << "(" - << message.fileContainer << ", " - << message.ticketNumber << ", " - << message.toolTipInfo << ", " - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const EchoMessage &/*message*/) -{ - return os << "()"; -} - -std::ostream &operator<<(std::ostream &os, const DocumentsClosedMessage &message) -{ - os << "(" - << message.fileContainers - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const CodeCompletion &message) -{ - os << "(" - << message.text << ", " - << message.priority << ", " - << message.completionKind << ", " - << message.availability << ", " - << message.hasParameters - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const CodeCompletionChunk &chunk) -{ - os << "(" - << chunk.kind << ", " - << chunk.text; - - if (chunk.isOptional) - os << ", optional"; - - os << ")"; - - return os; -} - -static const char *severityToText(DiagnosticSeverity severity) -{ - switch (severity) { - case DiagnosticSeverity::Ignored: return "Ignored"; - case DiagnosticSeverity::Note: return "Note"; - case DiagnosticSeverity::Warning: return "Warning"; - case DiagnosticSeverity::Error: return "Error"; - case DiagnosticSeverity::Fatal: return "Fatal"; - } - - Q_UNREACHABLE(); -} - -std::ostream &operator<<(std::ostream &os, const DiagnosticContainer &container) -{ - os << "(" - << severityToText(container.severity) << ": " - << container.text << ", " - << container.category << ", " - << container.enableOption << ", " - << container.location << ", " - << container.ranges << ", " - << container.fixIts << ", " - << container.children << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const FileContainer &container) -{ - os << "(" - << container.filePath << ", " - << container.compilationArguments << ", " - << container.documentRevision << ", " - << container.textCodecName; - - if (container.hasUnsavedFileContent) - os << ", " - << container.unsavedFileContent; - - os << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const FixItContainer &container) -{ - os << "(" - << container.text << ", " - << container.range - << ")"; - - return os; -} - -#define RETURN_TEXT_FOR_CASE(enumValue) case HighlightingType::enumValue: return #enumValue -static const char *highlightingTypeToCStringLiteral(HighlightingType type) -{ - switch (type) { - RETURN_TEXT_FOR_CASE(Invalid); - RETURN_TEXT_FOR_CASE(Comment); - RETURN_TEXT_FOR_CASE(Keyword); - RETURN_TEXT_FOR_CASE(StringLiteral); - RETURN_TEXT_FOR_CASE(NumberLiteral); - RETURN_TEXT_FOR_CASE(Function); - RETURN_TEXT_FOR_CASE(VirtualFunction); - RETURN_TEXT_FOR_CASE(Type); - RETURN_TEXT_FOR_CASE(LocalVariable); - RETURN_TEXT_FOR_CASE(Parameter); - RETURN_TEXT_FOR_CASE(GlobalVariable); - RETURN_TEXT_FOR_CASE(Field); - RETURN_TEXT_FOR_CASE(Enumeration); - RETURN_TEXT_FOR_CASE(Operator); - RETURN_TEXT_FOR_CASE(Preprocessor); - RETURN_TEXT_FOR_CASE(Label); - RETURN_TEXT_FOR_CASE(FunctionDefinition); - RETURN_TEXT_FOR_CASE(OutputArgument); - RETURN_TEXT_FOR_CASE(OverloadedOperator); - RETURN_TEXT_FOR_CASE(PreprocessorDefinition); - RETURN_TEXT_FOR_CASE(PreprocessorExpansion); - RETURN_TEXT_FOR_CASE(PrimitiveType); - RETURN_TEXT_FOR_CASE(Punctuation); - RETURN_TEXT_FOR_CASE(Declaration); - RETURN_TEXT_FOR_CASE(Namespace); - RETURN_TEXT_FOR_CASE(Class); - RETURN_TEXT_FOR_CASE(Struct); - RETURN_TEXT_FOR_CASE(Enum); - RETURN_TEXT_FOR_CASE(Union); - RETURN_TEXT_FOR_CASE(TypeAlias); - RETURN_TEXT_FOR_CASE(Typedef); - RETURN_TEXT_FOR_CASE(QtProperty); - RETURN_TEXT_FOR_CASE(ObjectiveCClass); - RETURN_TEXT_FOR_CASE(ObjectiveCCategory); - RETURN_TEXT_FOR_CASE(ObjectiveCProtocol); - RETURN_TEXT_FOR_CASE(ObjectiveCInterface); - RETURN_TEXT_FOR_CASE(ObjectiveCImplementation); - RETURN_TEXT_FOR_CASE(ObjectiveCProperty); - RETURN_TEXT_FOR_CASE(ObjectiveCMethod); - RETURN_TEXT_FOR_CASE(TemplateTypeParameter); - RETURN_TEXT_FOR_CASE(TemplateTemplateParameter); - RETURN_TEXT_FOR_CASE(AngleBracketOpen); - RETURN_TEXT_FOR_CASE(AngleBracketClose); - RETURN_TEXT_FOR_CASE(DoubleAngleBracketClose); - RETURN_TEXT_FOR_CASE(TernaryIf); - RETURN_TEXT_FOR_CASE(TernaryElse); - } - - return ""; -} -#undef RETURN_TEXT_FOR_CASE - -std::ostream &operator<<(std::ostream &os, HighlightingType highlightingType) -{ - return os << highlightingTypeToCStringLiteral(highlightingType); -} - -std::ostream &operator<<(std::ostream &os, HighlightingTypes types) -{ - os << "(" - << types.mainHighlightingType; - - if (!types.mixinHighlightingTypes.empty()) - os << ", "<< types.mixinHighlightingTypes; - - os << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const ExtraInfo &extraInfo) -{ - os << "(" - << extraInfo.token << ", " - << extraInfo.typeSpelling << ", " - << extraInfo.semanticParentTypeSpelling << ", " - << static_cast(extraInfo.accessSpecifier) << ", " - << static_cast(extraInfo.storageClass) << ", " - << extraInfo.identifier << ", " - << extraInfo.includeDirectivePath << ", " - << extraInfo.declaration << ", " - << extraInfo.definition << ", " - << extraInfo.signal << ", " - << extraInfo.slot - << ")"; - return os; -} - -std::ostream &operator<<(std::ostream &os, const TokenInfoContainer &container) -{ - os << "(" - << container.line << ", " - << container.column << ", " - << container.length << ", " - << container.types << ", " - << container.extraInfo << ", " - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const UnsavedFilesUpdatedMessage &message) -{ - os << "(" - << message.fileContainers - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const RequestAnnotationsMessage &message) -{ - os << "(" - << message.fileContainer.filePath << "," - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const RequestFollowSymbolMessage &message) -{ - os << "(" - << message.fileContainer << ", " - << message.ticketNumber << ", " - << message.line << ", " - << message.column << ", " - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const RequestReferencesMessage &message) -{ - os << "(" - << message.fileContainer << ", " - << message.ticketNumber << ", " - << message.line << ", " - << message.column << ", " - << message.local << ", " - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &out, const RequestToolTipMessage &message) -{ - out << "(" - << message.fileContainer << ", " - << message.ticketNumber << ", " - << message.line << ", " - << message.column << ", " - << ")"; - - return out; -} - -namespace { - -std::ostream &operator<<(std::ostream &os, const ToolTipInfo::QdocCategory category) -{ - return os << qdocCategoryToString(category); -} -} // namespace - -std::ostream &operator<<(std::ostream &out, const ToolTipInfo &info) -{ - out << "(" - << info.text << ", " - << info.briefComment << ", " - << info.qdocIdCandidates << ", " - << info.qdocMark << ", " - << info.qdocCategory - << info.sizeInBytes << ", " - << ")"; - - return out; -} - -std::ostream &operator<<(std::ostream &os, const SourceLocationContainer &container) -{ - os << "(" - << container.filePath << ", " - << container.line << ", " - << container.column - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const SourceRangeContainer &container) -{ - os << "(" - << container.start << ", " - << container.end - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const UnsavedFilesRemovedMessage &message) -{ - os << "(" - << message.fileContainers - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const DocumentsChangedMessage &message) -{ - os << "DocumentsChangedMessage(" - << message.fileContainers - << ")"; - - return os; -} - -std::ostream &operator<<(std::ostream &os, const DocumentVisibilityChangedMessage &message) -{ - os << "(" - << message.currentEditorFilePath << ", " - << message.visibleEditorFilePaths - << ")"; - - return os; -} - -namespace { -const char *symbolKindString(SymbolKind symbolKind) -{ - using ClangBackEnd::SymbolKind; - - switch (symbolKind) { - case SymbolKind::None: return "None"; - case SymbolKind::Enumeration: return "Enumeration"; - case SymbolKind::Record: return "Record"; - case SymbolKind::Function: return "Function"; - case SymbolKind::Variable: return "Variable"; - case SymbolKind::Macro: return "Macro"; - } - - return ""; -} - -const char *symbolTagString(SymbolTag symbolTag) -{ - using ClangBackEnd::SymbolTag; - - switch (symbolTag) { - case SymbolTag::None: return "None"; - case SymbolTag::Class: return "Class"; - case SymbolTag::Struct: return "Struct"; - case SymbolTag::Union: return "Union"; - case SymbolTag::MsvcInterface: return "MsvcInterface"; - } - - return ""; -} -} // namespace - -std::ostream &operator<<(std::ostream &out, SymbolKind symbolKind) -{ - return out << symbolKindString(symbolKind); -} - -std::ostream &operator<<(std::ostream &out, SymbolTag symbolTag) -{ - return out << symbolTagString(symbolTag); -} - -std::ostream &operator<<(std::ostream &out, SymbolTags symbolTags) -{ - std::copy(symbolTags.cbegin(), symbolTags.cend(), std::ostream_iterator(out, ", ")); - - return out; -} - -} // namespace ClangBackEnd - namespace Debugger { std::ostream &operator<<(std::ostream &out, const DiagnosticLocation &loc) { diff --git a/tests/unit/unittest/gtest-creator-printing.h b/tests/unit/unittest/gtest-creator-printing.h index 7e89dca0481..83971a2a4f9 100644 --- a/tests/unit/unittest/gtest-creator-printing.h +++ b/tests/unit/unittest/gtest-creator-printing.h @@ -30,17 +30,12 @@ #include #include -#include - #include #include #include -class Utf8String; -void PrintTo(const Utf8String &text, ::std::ostream *os); - namespace Sqlite { class Value; class ValueView; @@ -112,93 +107,6 @@ void PrintTo(const Utils::PathString &text, ::std::ostream *os); } // namespace Utils -namespace ClangBackEnd { -class AliveMessage; -class CompletionsMessage; -class EchoMessage; -class AnnotationsMessage; -class ReferencesMessage; -class ToolTipMessage; -class FollowSymbolResult; -class FollowSymbolMessage; -class RequestCompletionsMessage; -class EndMessage; -class DocumentsOpenedMessage; -class DocumentsClosedMessage; -class CodeCompletion; -class CodeCompletionChunk; -class DiagnosticContainer; -class FileContainer; -class FixItContainer; -class FullTokenInfo; -class HighlightingMarkContainer; -class UnsavedFilesUpdatedMessage; -class RequestAnnotationsMessage; -class RequestFollowSymbolMessage; -class RequestReferencesMessage; -class RequestToolTipMessage; -class SourceLocationContainer; -class SourceRangeContainer; -class TokenInfo; -template -class TokenProcessor; -class DocumentsChangedMessage; -class DocumentVisibilityChangedMessage; -class ToolTipInfo; -class SuspendResumeJobsEntry; -class ReferencesResult; -struct ExtraInfo; -class TokenInfoContainer; -class UnsavedFilesRemovedMessage; - -std::ostream &operator<<(std::ostream &out, const AliveMessage &message); -std::ostream &operator<<(std::ostream &out, const CompletionsMessage &message); -std::ostream &operator<<(std::ostream &out, const EchoMessage &message); -std::ostream &operator<<(std::ostream &out, const AnnotationsMessage &message); -std::ostream &operator<<(std::ostream &out, const ReferencesMessage &message); -std::ostream &operator<<(std::ostream &out, const ToolTipMessage &message); -std::ostream &operator<<(std::ostream &out, const FollowSymbolResult &result); -std::ostream &operator<<(std::ostream &out, const FollowSymbolMessage &message); -std::ostream &operator<<(std::ostream &out, const RequestCompletionsMessage &message); -std::ostream &operator<<(std::ostream &out, const EndMessage &message); -std::ostream &operator<<(std::ostream &out, const DocumentsOpenedMessage &message); -std::ostream &operator<<(std::ostream &out, const DocumentsClosedMessage &message); -std::ostream &operator<<(std::ostream &out, const CodeCompletion &message); -std::ostream &operator<<(std::ostream &out, const CodeCompletionChunk &chunk); -std::ostream &operator<<(std::ostream &out, const DiagnosticContainer &container); -std::ostream &operator<<(std::ostream &out, const FileContainer &container); -std::ostream &operator<<(std::ostream &out, const FixItContainer &container); -std::ostream &operator<<(std::ostream &out, HighlightingType highlightingType); -std::ostream &operator<<(std::ostream &out, HighlightingTypes types); -std::ostream &operator<<(std::ostream &out, const HighlightingMarkContainer &container); -std::ostream &operator<<(std::ostream &out, const UnsavedFilesUpdatedMessage &message); -std::ostream &operator<<(std::ostream &out, const RequestAnnotationsMessage &message); -std::ostream &operator<<(std::ostream &out, const RequestFollowSymbolMessage &message); -std::ostream &operator<<(std::ostream &out, const RequestReferencesMessage &message); -std::ostream &operator<<(std::ostream &out, const RequestToolTipMessage &message); -std::ostream &operator<<(std::ostream &out, const ToolTipInfo &info); -std::ostream &operator<<(std::ostream &out, const SourceLocationContainer &container); -std::ostream &operator<<(std::ostream &out, const SourceRangeContainer &container); -std::ostream &operator<<(std::ostream &out, const DocumentsChangedMessage &message); -std::ostream &operator<<(std::ostream &out, const DocumentVisibilityChangedMessage &message); -std::ostream &operator<<(std::ostream &out, const TokenInfo& tokenInfo); -template -std::ostream &operator<<(std::ostream &out, const TokenProcessor &tokenInfos); -extern template -std::ostream &operator<<(std::ostream &out, const TokenProcessor &tokenInfos); -extern template std::ostream &operator<<(std::ostream &out, - const TokenProcessor &tokenInfos); -std::ostream &operator<<(std::ostream &out, SymbolKind symbolKind); -std::ostream &operator<<(std::ostream &out, SymbolTag symbolTag); -std::ostream &operator<<(std::ostream &out, SymbolTags symbolTags); -std::ostream &operator<<(std::ostream &os, const SuspendResumeJobsEntry &entry); -std::ostream &operator<<(std::ostream &os, const ReferencesResult &value); -std::ostream &operator<<(std::ostream &os, const ExtraInfo &extraInfo); -std::ostream &operator<<(std::ostream &os, const TokenInfoContainer &container); -std::ostream &operator<<(std::ostream &os, const UnsavedFilesRemovedMessage &message); - -} // namespace ClangBackEnd - namespace Debugger { class DiagnosticLocation; std::ostream &operator<<(std::ostream &out, const DiagnosticLocation &loc); diff --git a/tests/unit/unittest/lineprefixer-test.cpp b/tests/unit/unittest/lineprefixer-test.cpp deleted file mode 100644 index 222a0f282bb..00000000000 --- a/tests/unit/unittest/lineprefixer-test.cpp +++ /dev/null @@ -1,135 +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. -** -****************************************************************************/ - -#include "googletest.h" - -#include -#include - -namespace { - -QByteArray runPrefixer(QList inputChunks); - -TEST(LinePrefixer, OneChunkEndsWithNewline) -{ - const QList inputChunks = {"hello\n"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX hello\n"); -} - -TEST(LinePrefixer, OneChunkEndsWithoutNewline) -{ - const QList inputChunks = {"hello"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX hello"); -} - -TEST(LinePrefixer, OneChunkStartsWithNewline) -{ - const QList inputChunks = {"\nhello"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX \n" - "PREFIX hello"); -} - -TEST(LinePrefixer, OneChunkStartsAndEndsWithNewline) -{ - const QList inputChunks = {"\nhello\n"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX \n" - "PREFIX hello\n"); -} - -TEST(LinePrefixer, OneChunkEndsWithExtraNewline) -{ - const QList inputChunks = {"hello\n\n"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX hello\n" - "PREFIX \n"); -} - -TEST(LinePrefixer, OneChunkEndsWithTwoExtraNewlines) -{ - const QList inputChunks = {"hello\n\n\n"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX hello\n" - "PREFIX \n" - "PREFIX \n"); -} - -TEST(LinePrefixer, ChunkWithoutNewlineAndChunkWithNewline) -{ - const QList inputChunks = {"hello", "\n"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX hello\n"); -} - -TEST(LinePrefixer, ChunkWithoutNewlineAndChunkWithTwoNewlines) -{ - const QList inputChunks = {"hello", "\n\n"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX hello\n" - "PREFIX \n"); -} - -TEST(LinePrefixer, ChunkWithTwoNewlinesAndChunkWithoutNewline) -{ - const QList inputChunks = {"\n\n", "hello"}; - - auto text = runPrefixer(inputChunks); - - ASSERT_THAT(text, "PREFIX \n" - "PREFIX \n" - "PREFIX hello"); -} - -QByteArray runPrefixer(QList inputChunks) -{ - QByteArray actualOutput; - ClangBackEnd::LinePrefixer prefixer("PREFIX "); - - for (const auto &chunk : inputChunks) - actualOutput += prefixer.prefix(chunk); - - return actualOutput; -} - -} // anonymous namespace diff --git a/tests/unit/unittest/mockclangcodemodelclient.h b/tests/unit/unittest/mockclangcodemodelclient.h deleted file mode 100644 index 9244e05eb8b..00000000000 --- a/tests/unit/unittest/mockclangcodemodelclient.h +++ /dev/null @@ -1,50 +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 "googletest.h" - -#include -#include - -class MockClangCodeModelClient : public ClangBackEnd::ClangCodeModelClientInterface -{ -public: - MOCK_METHOD0(alive, - void()); - MOCK_METHOD1(echo, - void(const ClangBackEnd::EchoMessage &message)); - MOCK_METHOD1(completions, - void(const ClangBackEnd::CompletionsMessage &message)); - MOCK_METHOD1(annotations, - void(const ClangBackEnd::AnnotationsMessage &message)); - MOCK_METHOD1(references, - void(const ClangBackEnd::ReferencesMessage &message)); - MOCK_METHOD1(followSymbol, - void(const ClangBackEnd::FollowSymbolMessage &message)); - MOCK_METHOD1(tooltip, - void(const ClangBackEnd::ToolTipMessage &message)); -}; diff --git a/tests/unit/unittest/mockclangcodemodelserver.h b/tests/unit/unittest/mockclangcodemodelserver.h deleted file mode 100644 index 7cbe596b369..00000000000 --- a/tests/unit/unittest/mockclangcodemodelserver.h +++ /dev/null @@ -1,62 +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 "googletest.h" - -#include - -class MockClangCodeModelServer : public ClangBackEnd::ClangCodeModelServerInterface { -public: - MOCK_METHOD0(end, - void()); - - MOCK_METHOD1(documentsOpened, - void(const ClangBackEnd::DocumentsOpenedMessage &message)); - MOCK_METHOD1(documentsChanged, - void(const ClangBackEnd::DocumentsChangedMessage &message)); - MOCK_METHOD1(documentsClosed, - void(const ClangBackEnd::DocumentsClosedMessage &message)); - MOCK_METHOD1(documentVisibilityChanged, - void(const ClangBackEnd::DocumentVisibilityChangedMessage &message)); - - MOCK_METHOD1(unsavedFilesUpdated, - void(const ClangBackEnd::UnsavedFilesUpdatedMessage &message)); - MOCK_METHOD1(unsavedFilesRemoved, - void(const ClangBackEnd::UnsavedFilesRemovedMessage &message)); - - MOCK_METHOD1(requestCompletions, - void(const ClangBackEnd::RequestCompletionsMessage &message)); - MOCK_METHOD1(requestAnnotations, - void(const ClangBackEnd::RequestAnnotationsMessage &message)); - MOCK_METHOD1(requestReferences, - void(const ClangBackEnd::RequestReferencesMessage &message)); - MOCK_METHOD1(requestFollowSymbol, - void(const ClangBackEnd::RequestFollowSymbolMessage &message)); - MOCK_METHOD1(requestToolTip, - void(const ClangBackEnd::RequestToolTipMessage &message)); - -}; diff --git a/tests/unit/unittest/mockqueue.h b/tests/unit/unittest/mockqueue.h deleted file mode 100644 index 74c35139149..00000000000 --- a/tests/unit/unittest/mockqueue.h +++ /dev/null @@ -1,37 +0,0 @@ -/**************************************************************************** -** -** 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 "googletest.h" - -#include - -class MockQueue : public ClangBackEnd::QueueInterface -{ -public: - MOCK_METHOD0(processEntries, void()); -}; - diff --git a/tests/unit/unittest/readandwritemessageblock-test.cpp b/tests/unit/unittest/readandwritemessageblock-test.cpp deleted file mode 100644 index a13def699d0..00000000000 --- a/tests/unit/unittest/readandwritemessageblock-test.cpp +++ /dev/null @@ -1,337 +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. -** -****************************************************************************/ - -#include "googletest.h" - -#include -#include - -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -using namespace testing; -namespace CodeModelBackeEndTest { - -class ReadAndWriteMessageBlock : public ::testing::Test -{ -protected: - ReadAndWriteMessageBlock(); - - virtual void SetUp() override; - virtual void TearDown() override; - - template - void CompareMessage(const Type &message); - - ClangBackEnd::MessageEnvelop writeCompletionsMessage(); - void popLastCharacterFromBuffer(); - void pushLastCharacterToBuffer(); - void readPartialMessage(); - -protected: - Utf8String filePath{Utf8StringLiteral("foo.cpp")}; - ClangBackEnd::FileContainer fileContainer{filePath, - Utf8StringLiteral("unsaved content"), - true, - 1}; - QBuffer buffer; - ClangBackEnd::WriteMessageBlock writeMessageBlock; - ClangBackEnd::ReadMessageBlock readMessageBlock; - char lastCharacter = 0; -}; - -ReadAndWriteMessageBlock::ReadAndWriteMessageBlock() - : writeMessageBlock(&buffer), - readMessageBlock(&buffer) -{ -} - -void ReadAndWriteMessageBlock::SetUp() -{ - buffer.open(QIODevice::ReadWrite); - writeMessageBlock = ClangBackEnd::WriteMessageBlock(&buffer); - readMessageBlock = ClangBackEnd::ReadMessageBlock(&buffer); -} - -void ReadAndWriteMessageBlock::TearDown() -{ - buffer.close(); -} - -TEST_F(ReadAndWriteMessageBlock, WriteMessageAndTestSize) -{ - writeMessageBlock.write(ClangBackEnd::EndMessage()); - - ASSERT_EQ(17, buffer.size()); -} - -TEST_F(ReadAndWriteMessageBlock, WriteSecondMessageAndTestSize) -{ - writeMessageBlock.write(ClangBackEnd::EndMessage()); - - ASSERT_EQ(17, buffer.size()); -} - -TEST_F(ReadAndWriteMessageBlock, WriteTwoMessagesAndTestCount) -{ - writeMessageBlock.write(ClangBackEnd::EndMessage()); - writeMessageBlock.write(ClangBackEnd::EndMessage()); - - ASSERT_EQ(2, writeMessageBlock.counter()); -} - -TEST_F(ReadAndWriteMessageBlock, ReadThreeMessagesAndTestCount) -{ - writeMessageBlock.write(ClangBackEnd::EndMessage()); - writeMessageBlock.write(ClangBackEnd::EndMessage()); - writeMessageBlock.write(ClangBackEnd::EndMessage()); - buffer.seek(0); - - ASSERT_THAT(readMessageBlock.readAll(), SizeIs(3)); -} - -TEST_F(ReadAndWriteMessageBlock, WriteMessagesToWriteBlockWithoutIoDeviceAndNoMessagesAreSent) -{ - ClangBackEnd::WriteMessageBlock writeMessageBlock; - - writeMessageBlock.write(ClangBackEnd::EndMessage()); - writeMessageBlock.write(ClangBackEnd::EndMessage()); - buffer.seek(0); - - ASSERT_THAT(readMessageBlock.readAll(), IsEmpty()); -} - -TEST_F(ReadAndWriteMessageBlock, WriteMessagesToWriteBlockWithoutIoDeviceAndSetIoDeviceToNullPointerLater) -{ - ClangBackEnd::WriteMessageBlock writeMessageBlock; - writeMessageBlock.write(ClangBackEnd::EndMessage()); - writeMessageBlock.write(ClangBackEnd::EndMessage()); - - writeMessageBlock.setLocalSocket(nullptr); - buffer.seek(0); - - ASSERT_THAT(readMessageBlock.readAll(), IsEmpty()); -} - -TEST_F(ReadAndWriteMessageBlock, WriteMessagesToWriteBlockWithoutIoDeviceAndSetIoDeviceLater) -{ - ClangBackEnd::WriteMessageBlock writeMessageBlock; - writeMessageBlock.write(ClangBackEnd::EndMessage()); - writeMessageBlock.write(ClangBackEnd::EndMessage()); - - writeMessageBlock.setIoDevice(&buffer); - buffer.seek(0); - - ASSERT_THAT(readMessageBlock.readAll(), SizeIs(2)); -} - -TEST_F(ReadAndWriteMessageBlock, ResetStateResetsCounter) -{ - writeMessageBlock.write(ClangBackEnd::EndMessage()); - writeMessageBlock.write(ClangBackEnd::EndMessage()); - buffer.seek(0); - - writeMessageBlock.resetState(); - - ASSERT_THAT(writeMessageBlock.counter(), 0); -} - -TEST_F(ReadAndWriteMessageBlock, ResetStateResetsWritingBlock) -{ - ClangBackEnd::WriteMessageBlock writeMessageBlock; - writeMessageBlock.write(ClangBackEnd::EndMessage()); - - writeMessageBlock.resetState(); - - writeMessageBlock.setIoDevice(&buffer); - buffer.seek(0); - ASSERT_THAT(readMessageBlock.readAll(), IsEmpty()); -} - -TEST_F(ReadAndWriteMessageBlock, CompareEndMessage) -{ - CompareMessage(ClangBackEnd::EndMessage()); -} - -TEST_F(ReadAndWriteMessageBlock, CompareAliveMessage) -{ - CompareMessage(ClangBackEnd::AliveMessage()); -} - -TEST_F(ReadAndWriteMessageBlock, CompareDocumentsOpenedMessage) -{ - CompareMessage(ClangBackEnd::DocumentsOpenedMessage({fileContainer}, filePath, {filePath})); -} - -TEST_F(ReadAndWriteMessageBlock, CompareDocumentsChangedMessage) -{ - CompareMessage(ClangBackEnd::DocumentsChangedMessage({fileContainer})); -} - -TEST_F(ReadAndWriteMessageBlock, CompareDocumentsClosedMessage) -{ - CompareMessage(ClangBackEnd::DocumentsClosedMessage({fileContainer})); -} - -TEST_F(ReadAndWriteMessageBlock, CompareRequestCompletionsMessage) -{ - CompareMessage(ClangBackEnd::RequestCompletionsMessage(Utf8StringLiteral("foo.cpp"), 24, 33)); -} - -TEST_F(ReadAndWriteMessageBlock, CompareCompletionsMessage) -{ - ClangBackEnd::CodeCompletions codeCompletions({Utf8StringLiteral("newFunction()")}); - - CompareMessage(ClangBackEnd::CompletionsMessage(codeCompletions, 1)); -} - -TEST_F(ReadAndWriteMessageBlock, CompareAnnotationsMessage) -{ - ClangBackEnd::DiagnosticContainer diagnostic(Utf8StringLiteral("don't do that"), - Utf8StringLiteral("warning"), - {Utf8StringLiteral("-Wpadded"), Utf8StringLiteral("-Wno-padded")}, - ClangBackEnd::DiagnosticSeverity::Warning, - {Utf8StringLiteral("foo.cpp"), 20u, 103u}, - {{{Utf8StringLiteral("foo.cpp"), 20u, 103u}, {Utf8StringLiteral("foo.cpp"), 20u, 110u}}}, - {}, - {}); - - ClangBackEnd::HighlightingTypes types; - types.mainHighlightingType = ClangBackEnd::HighlightingType::Keyword; - ClangBackEnd::TokenInfoContainer tokenInfo(1, 1, 1, types); - - CompareMessage(ClangBackEnd::AnnotationsMessage(fileContainer, - {diagnostic}, - {}, - {tokenInfo}, - QVector())); -} - -TEST_F(ReadAndWriteMessageBlock, CompareUnsavedFilesUpdatedMessage) -{ - CompareMessage(ClangBackEnd::UnsavedFilesUpdatedMessage({fileContainer})); -} - -TEST_F(ReadAndWriteMessageBlock, CompareUnsavedFilesRemovedMessage) -{ - CompareMessage(ClangBackEnd::UnsavedFilesRemovedMessage({fileContainer})); -} - -TEST_F(ReadAndWriteMessageBlock, CompareRequestAnnotationsMessage) -{ - CompareMessage(ClangBackEnd::RequestAnnotationsMessage(fileContainer)); -} - -TEST_F(ReadAndWriteMessageBlock, CompareRequestReferencesMessage) -{ - CompareMessage(ClangBackEnd::RequestReferencesMessage{fileContainer, 13, 37}); -} - -TEST_F(ReadAndWriteMessageBlock, CompareRequestFollowSymbolMessage) -{ - CompareMessage(ClangBackEnd::RequestFollowSymbolMessage{fileContainer, 13, 37}); -} - -TEST_F(ReadAndWriteMessageBlock, CompareReferencesMessage) -{ - const QVector references{ - true, - {{fileContainer.filePath, 12, 34}, - {fileContainer.filePath, 56, 78}} - }; - CompareMessage(ClangBackEnd::ReferencesMessage(fileContainer, references, true, 1)); -} - -TEST_F(ReadAndWriteMessageBlock, GetInvalidMessageForAPartialBuffer) -{ - writeCompletionsMessage(); - popLastCharacterFromBuffer(); - buffer.seek(0); - - readPartialMessage(); -} - -TEST_F(ReadAndWriteMessageBlock, ReadMessageAfterInterruption) -{ - const auto writeMessage = writeCompletionsMessage(); - popLastCharacterFromBuffer(); - buffer.seek(0); - readPartialMessage(); - pushLastCharacterToBuffer(); - - ASSERT_EQ(readMessageBlock.read(), writeMessage); -} - -ClangBackEnd::MessageEnvelop ReadAndWriteMessageBlock::writeCompletionsMessage() -{ - ClangBackEnd::CompletionsMessage message( - ClangBackEnd::CodeCompletions({Utf8StringLiteral("newFunction()")}), 1); - - writeMessageBlock.write(message); - - return message; -} - -void ReadAndWriteMessageBlock::popLastCharacterFromBuffer() -{ - auto &internalBuffer = buffer.buffer(); - lastCharacter = internalBuffer.at(internalBuffer.size() - 1); - internalBuffer.chop(1); -} - -void ReadAndWriteMessageBlock::pushLastCharacterToBuffer() -{ - buffer.buffer().push_back(lastCharacter); -} - -void ReadAndWriteMessageBlock::readPartialMessage() -{ - const ClangBackEnd::MessageEnvelop readMessage = readMessageBlock.read(); - - ASSERT_FALSE(readMessage.isValid()); -} - -template -void ReadAndWriteMessageBlock::CompareMessage(const Type &message) -{ - const ClangBackEnd::MessageEnvelop writeMessage = message; - writeMessageBlock.write(writeMessage); - buffer.seek(0); - - const ClangBackEnd::MessageEnvelop readMessage = readMessageBlock.read(); - - ASSERT_EQ(writeMessage, readMessage); -} - -} diff --git a/tests/unit/unittest/sqlitedatabase-test.cpp b/tests/unit/unittest/sqlitedatabase-test.cpp index 92cdf01961c..f95c4d84737 100644 --- a/tests/unit/unittest/sqlitedatabase-test.cpp +++ b/tests/unit/unittest/sqlitedatabase-test.cpp @@ -31,7 +31,6 @@ #include #include #include -#include #include diff --git a/tests/unit/unittest/unittest-utility-functions.h b/tests/unit/unittest/unittest-utility-functions.h index 5102769e78f..31dac0e98e4 100644 --- a/tests/unit/unittest/unittest-utility-functions.h +++ b/tests/unit/unittest/unittest-utility-functions.h @@ -29,8 +29,6 @@ #include #include -#include - inline bool operator==(const QString &first, const char *second) { @@ -45,11 +43,4 @@ Utils::PathString temporaryDirPath() return Utils::PathString::fromQString(Utils::TemporaryDirectory::masterDirectoryPath()); } -inline QVector addPlatformArguments(std::initializer_list arguments = {}) -{ - QVector result{arguments}; - if (Utils::HostOsInfo::isWindowsHost()) - result.append(Utf8StringLiteral("-fno-delayed-template-parsing")); - return result; -} } // namespace UnitTest diff --git a/tests/unit/unittest/unittest.qbs b/tests/unit/unittest/unittest.qbs index 8fed770aba9..598980bec18 100644 --- a/tests/unit/unittest/unittest.qbs +++ b/tests/unit/unittest/unittest.qbs @@ -14,7 +14,6 @@ Project { FileInfo.relativePath(project.ide_source_tree, sourceDirectory)) install: false - Depends { name: "echoserver" } Depends { name: "libclang"; required: false } Depends { name: "clang_defines" } @@ -40,7 +39,6 @@ Project { "QT_RESTRICTED_CAST_FROM_ASCII", "QT_USE_FAST_OPERATOR_PLUS", "QT_USE_FAST_CONCATENATION", - "CLANGSUPPORT_STATIC_LIBRARY", "CLANGTOOLS_STATIC_LIBRARY", "CPPEDITOR_STATIC_LIBRARY", "DEBUGGER_STATIC_LIBRARY", @@ -48,8 +46,6 @@ Project { "DONT_CHECK_MESSAGE_COUNTER", 'QTC_RESOURCE_DIR="' + path + "/../../../share/qtcreator" + '"', 'TESTDATA_DIR="' + FileInfo.joinPaths(sourceDirectory, "data") + '"', - 'ECHOSERVER="' + FileInfo.joinPaths(project.buildDirectory, "tests", "unit", - "echoserver", "echo") + '"', 'RELATIVE_DATA_PATH="' + FileInfo.relativePath(destinationDirectory, FileInfo.joinPaths(project.sourceDirectory, "share", "qtcreator")) + '"', ]; @@ -99,10 +95,8 @@ Project { "../mockup", "../../../src/libs", "../../../src/libs/3rdparty", - "../../../src/libs/clangsupport", "../../../src/plugins", "../../../src/plugins/clangcodemodel", - "../../../src/tools/clangbackend/source", "../../../share/qtcreator/qml/qmlpuppet/types", ]; if (libclang.present) { @@ -127,18 +121,14 @@ Project { } files: [ - "clientserverinprocess-test.cpp", - "clientserveroutsideprocess-test.cpp", "compare-operators.h", "conditionally-disabled-tests.h", "createtablesqlstatementbuilder-test.cpp", - "dummyclangipcclient.h", "dynamicastmatcherdiagnosticcontainer-matcher.h", "eventspy.cpp", "eventspy.h", "fakeprocess.cpp", "fakeprocess.h", - "filesystem-utilities.h", "google-using-declarations.h", "googletest.h", "gtest-creator-printing.cpp", @@ -146,23 +136,17 @@ Project { "gtest-llvm-printing.h", "gtest-qt-printing.cpp", "gtest-qt-printing.h", - "lineprefixer-test.cpp", "matchingtext-test.cpp", - "mockclangcodemodelclient.h", - "mockclangcodemodelserver.h", "mockfutureinterface.h", "mockmutex.h", "mockqfilesystemwatcher.h", - "mockqueue.h", "mocksqlitestatement.h", "mocksqlitetransactionbackend.h", "mocksyntaxhighligher.h", "mocktimer.cpp", "mocktimer.h", - "processcreator-test.cpp", "processevents-utilities.cpp", "processevents-utilities.h", - "readandwritemessageblock-test.cpp", "sizedarray-test.cpp", "smallstring-test.cpp", "sourcerangecontainer-matcher.h", @@ -185,7 +169,6 @@ Project { "sqlstatementbuilder-test.cpp", "unittest-utility-functions.h", "unittests-main.cpp", - "utf8-test.cpp", ] Group { @@ -193,8 +176,6 @@ Project { condition: libclang.present && (!qbs.targetOS.contains("windows") || libclang.llvmBuildModeMatches) files: [ "activationsequenceprocessor-test.cpp", - "chunksreportedmonitor.cpp", - "chunksreportedmonitor.h", "clangcompareoperators.h", "diagnosticcontainer-matcher.h", "readexporteddiagnostics-test.cpp", @@ -216,15 +197,6 @@ Project { fileTags: [] } - Group { - name: "sources from clangsupport" - prefix: "../../../src/libs/clangsupport/" - files: [ - "*.cpp", - "*.h", - ] - } - Group { name: "sources from clangcodemodel" prefix: "../../../src/plugins/clangcodemodel/" diff --git a/tests/unit/unittest/utf8-test.cpp b/tests/unit/unittest/utf8-test.cpp deleted file mode 100644 index 663955dcbc0..00000000000 --- a/tests/unit/unittest/utf8-test.cpp +++ /dev/null @@ -1,282 +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. -** -****************************************************************************/ - -#include "googletest.h" - -#include - -#include - -using namespace ::testing; - -TEST(Utf8, QStringConversionConstructor) -{ - ASSERT_THAT(Utf8String(QStringLiteral("text")), Utf8StringLiteral("text")); -} - -TEST(Utf8, QByteArrayConversionFunction) -{ - ASSERT_THAT(Utf8String::fromByteArray("text"), Utf8StringLiteral("text")); -} - -TEST(Utf8, QStringConversionFunction) -{ - ASSERT_THAT(Utf8String::fromString(QStringLiteral("text")), Utf8StringLiteral("text")); -} - -TEST(Utf8, Utf8ConversationFunction) -{ - ASSERT_THAT(Utf8String::fromUtf8("text"), Utf8StringLiteral("text")); -} - -TEST(Utf8, Mid) -{ - Utf8String text(Utf8StringLiteral("some text")); - - ASSERT_THAT(text.mid(5, 4), Utf8StringLiteral("text")); - ASSERT_THAT(text.mid(5), Utf8StringLiteral("text")); -} - -TEST(Utf8, ByteSize) -{ - ASSERT_THAT(Utf8StringLiteral("text").byteSize(), 4); -} - -TEST(Utf8, Append) -{ - Utf8String text(Utf8StringLiteral("some ")); - text.append(Utf8StringLiteral("text")); - - ASSERT_THAT(text, Utf8StringLiteral("some text")); -} - -TEST(Utf8, ToByteArray) -{ - Utf8String text(Utf8StringLiteral("some text")); - - ASSERT_THAT(text.toByteArray(), QByteArrayLiteral("some text")); -} - -TEST(Utf8, ToString) -{ - Utf8String text(Utf8StringLiteral("some text")); - - ASSERT_THAT(text.toString(), QStringLiteral("some text")); -} - - -TEST(Utf8, Contains) -{ - Utf8String text(Utf8StringLiteral("some text")); - - ASSERT_TRUE(text.contains(Utf8StringLiteral("text"))); - ASSERT_TRUE(text.contains("text")); - ASSERT_TRUE(text.contains('x')); -} - -TEST(Utf8, EqualOperator) -{ - ASSERT_TRUE(Utf8StringLiteral("text") == Utf8StringLiteral("text")); - ASSERT_FALSE(Utf8StringLiteral("text") == Utf8StringLiteral("text2")); -} - -TEST(Utf8, SmallerOperator) -{ - ASSERT_TRUE(Utf8StringLiteral("some") < Utf8StringLiteral("text")); - ASSERT_TRUE(Utf8StringLiteral("text") < Utf8StringLiteral("texta")); - ASSERT_FALSE(Utf8StringLiteral("text") < Utf8StringLiteral("some")); - ASSERT_FALSE(Utf8StringLiteral("text") < Utf8StringLiteral("text")); -} - -TEST(Utf8, UnequalOperator) -{ - ASSERT_FALSE(Utf8StringLiteral("text") != Utf8StringLiteral("text")); - ASSERT_TRUE(Utf8StringLiteral("text") != Utf8StringLiteral("text2")); -} - -TEST(Utf8, Join) -{ - Utf8StringVector vector; - - vector.append(Utf8StringLiteral("some")); - vector.append(Utf8StringLiteral("text")); - - ASSERT_THAT(Utf8StringLiteral("some, text"), vector.join(Utf8StringLiteral(", "))); -} - -TEST(Utf8, Split) -{ - Utf8String test(Utf8StringLiteral("some text")); - - Utf8StringVector splittedText = test.split(' '); - - ASSERT_THAT(splittedText.at(0), Utf8StringLiteral("some")); - ASSERT_THAT(splittedText.at(1), Utf8StringLiteral("text")); -} - -TEST(Utf8, IsEmpty) -{ - ASSERT_FALSE(Utf8StringLiteral("text").isEmpty()); - ASSERT_TRUE(Utf8String().isEmpty()); -} - -TEST(Utf8, HasContent) -{ - ASSERT_TRUE(Utf8StringLiteral("text").hasContent()); - ASSERT_FALSE(Utf8String().hasContent()); -} - -TEST(Utf8, Replace) -{ - Utf8String text(Utf8StringLiteral("some text")); - - text.replace(Utf8StringLiteral("some"), Utf8StringLiteral("any")); - - ASSERT_THAT(text, Utf8StringLiteral("any text")); -} - -TEST(Utf8, ReplaceNBytesFromIndexPosition) -{ - Utf8String text(Utf8StringLiteral("min")); - - text.replace(1, 1, Utf8StringLiteral("aa")); - - ASSERT_THAT(text, Utf8StringLiteral("maan")); -} - -TEST(Utf8, StartsWith) -{ - Utf8String text(Utf8StringLiteral("$column")); - - ASSERT_TRUE(text.startsWith(Utf8StringLiteral("$col"))); - ASSERT_FALSE(text.startsWith(Utf8StringLiteral("col"))); - ASSERT_TRUE(text.startsWith("$col")); - ASSERT_FALSE(text.startsWith("col")); - ASSERT_TRUE(text.startsWith('$')); - ASSERT_FALSE(text.startsWith('@')); -} - -TEST(Utf8, EndsWith) -{ - Utf8String text(Utf8StringLiteral("/my/path")); - - ASSERT_TRUE(text.endsWith(Utf8StringLiteral("path"))); -} - -TEST(Utf8, Clear) -{ - Utf8String text(Utf8StringLiteral("$column")); - - text.clear(); - - ASSERT_TRUE(text.isEmpty()); -} - -TEST(Utf8, Number) -{ - ASSERT_THAT(Utf8String::number(20), Utf8StringLiteral("20")); -} - -TEST(Utf8, FromIntegerVector) -{ - QVector integers({1, 2, 3}); - - ASSERT_THAT(Utf8StringVector::fromIntegerVector(integers).join(Utf8StringLiteral(", ")), Utf8StringLiteral("1, 2, 3")); -} - -TEST(Utf8, PlusOperator) -{ - auto text = Utf8StringLiteral("foo") + Utf8StringLiteral("bar"); - - ASSERT_THAT(text, Utf8StringLiteral("foobar")); -} - -TEST(Utf8, PlusAssignmentOperator) -{ - Utf8String text("foo", 3); - - text += Utf8StringLiteral("bar"); - - ASSERT_THAT(text, Utf8StringLiteral("foobar")); -} - -TEST(Utf8, CompareCharPointer) -{ - Utf8String text("foo", 3); - - ASSERT_TRUE(text == "foo"); - ASSERT_FALSE(text == "foo2"); -} - -TEST(Utf8, RemoveFastFromVectorFailed) -{ - Utf8StringVector values({Utf8StringLiteral("a"), - Utf8StringLiteral("b"), - Utf8StringLiteral("c"), - Utf8StringLiteral("d")}); - - ASSERT_FALSE(values.removeFast(Utf8StringLiteral("e"))); -} - -TEST(Utf8, RemoveFastFromVector) -{ - Utf8StringVector values({Utf8StringLiteral("a"), - Utf8StringLiteral("b"), - Utf8StringLiteral("c"), - Utf8StringLiteral("d")}); - - bool removed = values.removeFast(Utf8StringLiteral("b")); - - ASSERT_TRUE(removed); - ASSERT_THAT(values, Not(Contains(Utf8StringLiteral("b")))); -} - -TEST(Utf8, ConverteAutomaticallyFromQString) -{ - QString text(QStringLiteral("foo")); - - Utf8String utf8Text(text); - - ASSERT_THAT(utf8Text, Utf8StringLiteral("foo")); -} - -TEST(Utf8, ConverteAutomaticallyToQString) -{ - Utf8String utf8Text(Utf8StringLiteral("foo")); - - QString text = utf8Text; - - ASSERT_THAT(text, QStringLiteral("foo")); -} - -TEST(Utf8, ConverteAutomaticallyToQByteArray) -{ - Utf8String utf8Text(Utf8StringLiteral("foo")); - - QByteArray bytes = utf8Text; - - ASSERT_THAT(bytes, QByteArrayLiteral("foo")); -} -