From 92693b9ac9893593e07e913b9a7ad56665ab321d Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 22 Sep 2017 16:49:44 +0200 Subject: [PATCH] Clang: Remove unused messages Change-Id: Ibe2678de726a867308fac16c6a14b0eff10cbacb Reviewed-by: Tim Jenssen --- .../clangcodemodelclientinterface.cpp | 6 -- .../clangcodemodelclientinterface.h | 4 - .../clangcodemodelclientmessages.h | 2 - .../clangcodemodelclientproxy.cpp | 10 --- .../clangsupport/clangcodemodelclientproxy.h | 2 - src/libs/clangsupport/clangsupport-lib.pri | 4 - src/libs/clangsupport/clangsupport_global.h | 3 - src/libs/clangsupport/messageenvelop.cpp | 6 -- .../projectpartsdonotexistmessage.cpp | 55 ------------ .../projectpartsdonotexistmessage.h | 77 ---------------- .../translationunitdoesnotexistmessage.cpp | 55 ------------ .../translationunitdoesnotexistmessage.h | 88 ------------------- .../clangbackendipcintegration.h | 3 - .../unittest/clientserverinprocess-test.cpp | 24 ----- tests/unit/unittest/dummyclangipcclient.h | 2 - .../unit/unittest/mockclangcodemodelclient.h | 4 - 16 files changed, 345 deletions(-) delete mode 100644 src/libs/clangsupport/projectpartsdonotexistmessage.cpp delete mode 100644 src/libs/clangsupport/projectpartsdonotexistmessage.h delete mode 100644 src/libs/clangsupport/translationunitdoesnotexistmessage.cpp delete mode 100644 src/libs/clangsupport/translationunitdoesnotexistmessage.h diff --git a/src/libs/clangsupport/clangcodemodelclientinterface.cpp b/src/libs/clangsupport/clangcodemodelclientinterface.cpp index 77bd1a589ea..0de9f39044a 100644 --- a/src/libs/clangsupport/clangcodemodelclientinterface.cpp +++ b/src/libs/clangsupport/clangcodemodelclientinterface.cpp @@ -44,12 +44,6 @@ void ClangCodeModelClientInterface::dispatch(const MessageEnvelop &messageEnvelo case MessageType::CodeCompletedMessage: codeCompleted(messageEnvelop.message()); break; - case MessageType::TranslationUnitDoesNotExistMessage: - translationUnitDoesNotExist(messageEnvelop.message()); - break; - case MessageType::ProjectPartsDoNotExistMessage: - projectPartsDoNotExist(messageEnvelop.message()); - break; case MessageType::DocumentAnnotationsChangedMessage: documentAnnotationsChanged(messageEnvelop.message()); break; diff --git a/src/libs/clangsupport/clangcodemodelclientinterface.h b/src/libs/clangsupport/clangcodemodelclientinterface.h index 04682ff4830..3577abb1543 100644 --- a/src/libs/clangsupport/clangcodemodelclientinterface.h +++ b/src/libs/clangsupport/clangcodemodelclientinterface.h @@ -35,7 +35,6 @@ class CodeCompletedMessage; class CompleteCodeMessage; class DocumentAnnotationsChangedMessage; class EchoMessage; -class ProjectPartsDoNotExistMessage; class ReferencesMessage; class FollowSymbolMessage; class RegisterProjectPartsForEditorMessage; @@ -44,7 +43,6 @@ class RegisterUnsavedFilesForEditorMessage; class RequestDocumentAnnotationsMessage; class RequestReferencesMessage; class RequestFollowSymbolMessage; -class TranslationUnitDoesNotExistMessage; class UnregisterProjectPartsForEditorMessage; class UnregisterTranslationUnitsForEditorMessage; class UnregisterUnsavedFilesForEditorMessage; @@ -59,8 +57,6 @@ public: virtual void alive() = 0; virtual void echo(const EchoMessage &message) = 0; virtual void codeCompleted(const CodeCompletedMessage &message) = 0; - virtual void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) = 0; - virtual void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) = 0; virtual void documentAnnotationsChanged(const DocumentAnnotationsChangedMessage &message) = 0; virtual void references(const ReferencesMessage &message) = 0; virtual void followSymbol(const FollowSymbolMessage &message) = 0; diff --git a/src/libs/clangsupport/clangcodemodelclientmessages.h b/src/libs/clangsupport/clangcodemodelclientmessages.h index 99f9a41c054..5b5c9b42edb 100644 --- a/src/libs/clangsupport/clangcodemodelclientmessages.h +++ b/src/libs/clangsupport/clangcodemodelclientmessages.h @@ -29,7 +29,5 @@ #include "cmbcodecompletedmessage.h" #include "cmbechomessage.h" #include "documentannotationschangedmessage.h" -#include "projectpartsdonotexistmessage.h" #include "referencesmessage.h" #include "followsymbolmessage.h" -#include "translationunitdoesnotexistmessage.h" diff --git a/src/libs/clangsupport/clangcodemodelclientproxy.cpp b/src/libs/clangsupport/clangcodemodelclientproxy.cpp index b9ec51cac96..6a285c23668 100644 --- a/src/libs/clangsupport/clangcodemodelclientproxy.cpp +++ b/src/libs/clangsupport/clangcodemodelclientproxy.cpp @@ -80,16 +80,6 @@ void ClangCodeModelClientProxy::codeCompleted(const CodeCompletedMessage &messag m_writeMessageBlock.write(message); } -void ClangCodeModelClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) -{ - m_writeMessageBlock.write(message); -} - -void ClangCodeModelClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) -{ - m_writeMessageBlock.write(message); -} - void ClangCodeModelClientProxy::documentAnnotationsChanged(const DocumentAnnotationsChangedMessage &message) { m_writeMessageBlock.write(message); diff --git a/src/libs/clangsupport/clangcodemodelclientproxy.h b/src/libs/clangsupport/clangcodemodelclientproxy.h index a86321888de..91cf900eb46 100644 --- a/src/libs/clangsupport/clangcodemodelclientproxy.h +++ b/src/libs/clangsupport/clangcodemodelclientproxy.h @@ -54,8 +54,6 @@ public: void alive() override; void echo(const EchoMessage &message) override; void codeCompleted(const CodeCompletedMessage &message) override; - void translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message) override; - void projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message) override; void documentAnnotationsChanged(const DocumentAnnotationsChangedMessage &message) override; void references(const ReferencesMessage &message) override; void followSymbol(const FollowSymbolMessage &message) override; diff --git a/src/libs/clangsupport/clangsupport-lib.pri b/src/libs/clangsupport/clangsupport-lib.pri index 6c7d00b7d87..25b48dfc075 100644 --- a/src/libs/clangsupport/clangsupport-lib.pri +++ b/src/libs/clangsupport/clangsupport-lib.pri @@ -53,7 +53,6 @@ SOURCES += \ $$PWD/projectpartcontainer.cpp \ $$PWD/projectpartcontainerv2.cpp \ $$PWD/projectpartpch.cpp \ - $$PWD/projectpartsdonotexistmessage.cpp \ $$PWD/readmessageblock.cpp \ $$PWD/refactoringclientinterface.cpp \ $$PWD/refactoringclientproxy.cpp \ @@ -79,7 +78,6 @@ SOURCES += \ $$PWD/sourcerangescontainer.cpp \ $$PWD/sourcerangesforquerymessage.cpp \ $$PWD/sourcerangewithtextcontainer.cpp \ - $$PWD/translationunitdoesnotexistmessage.cpp \ $$PWD/unregisterunsavedfilesforeditormessage.cpp \ $$PWD/updatepchprojectpartsmessage.cpp \ $$PWD/updatetranslationunitsforeditormessage.cpp \ @@ -138,7 +136,6 @@ HEADERS += \ $$PWD/projectpartcontainer.h \ $$PWD/projectpartcontainerv2.h \ $$PWD/projectpartpch.h \ - $$PWD/projectpartsdonotexistmessage.h \ $$PWD/readmessageblock.h \ $$PWD/refactoringclientinterface.h \ $$PWD/refactoringclientproxy.h \ @@ -165,7 +162,6 @@ HEADERS += \ $$PWD/sourcerangesforquerymessage.h \ $$PWD/sourcerangewithtextcontainer.h \ $$PWD/stringcache.h \ - $$PWD/translationunitdoesnotexistmessage.h \ $$PWD/unregisterunsavedfilesforeditormessage.h \ $$PWD/updatepchprojectpartsmessage.h \ $$PWD/updatetranslationunitsforeditormessage.h \ diff --git a/src/libs/clangsupport/clangsupport_global.h b/src/libs/clangsupport/clangsupport_global.h index 18e15f52ea6..b2fc639291a 100644 --- a/src/libs/clangsupport/clangsupport_global.h +++ b/src/libs/clangsupport/clangsupport_global.h @@ -124,9 +124,6 @@ enum class MessageType : quint8 { CompleteCodeMessage, CodeCompletedMessage, - TranslationUnitDoesNotExistMessage, - ProjectPartsDoNotExistMessage, - SourceLocationsForRenamingMessage, RequestSourceLocationsForRenamingMessage, diff --git a/src/libs/clangsupport/messageenvelop.cpp b/src/libs/clangsupport/messageenvelop.cpp index 489806a986b..58139c4c8fd 100644 --- a/src/libs/clangsupport/messageenvelop.cpp +++ b/src/libs/clangsupport/messageenvelop.cpp @@ -83,12 +83,6 @@ QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop) case MessageType::ReferencesMessage: qDebug() << messageEnvelop.message(); break; - case MessageType::TranslationUnitDoesNotExistMessage: - qDebug() << messageEnvelop.message(); - break; - case MessageType::ProjectPartsDoNotExistMessage: - qDebug() << messageEnvelop.message(); - break; case MessageType::DocumentAnnotationsChangedMessage: qDebug() << messageEnvelop.message(); break; diff --git a/src/libs/clangsupport/projectpartsdonotexistmessage.cpp b/src/libs/clangsupport/projectpartsdonotexistmessage.cpp deleted file mode 100644 index 18fc44e0ab7..00000000000 --- a/src/libs/clangsupport/projectpartsdonotexistmessage.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 "projectpartsdonotexistmessage.h" - -#include - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message) -{ - debug.nospace() << "ProjectPartDoesNotExistMessage("; - - debug.nospace() << message.projectPartIds(); - - debug.nospace() << ")"; - - return debug; -} - -std::ostream &operator<<(std::ostream &os, const ProjectPartsDoNotExistMessage &message) -{ - os << "(" - << message.projectPartIds() - << ")"; - - return os; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/projectpartsdonotexistmessage.h b/src/libs/clangsupport/projectpartsdonotexistmessage.h deleted file mode 100644 index 1c579929062..00000000000 --- a/src/libs/clangsupport/projectpartsdonotexistmessage.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 "clangsupport_global.h" - -#include - -#include - -namespace ClangBackEnd { - -class ProjectPartsDoNotExistMessage -{ -public: - ProjectPartsDoNotExistMessage() = default; - ProjectPartsDoNotExistMessage(const Utf8StringVector &projectPartIds) - : m_projectPartIds(projectPartIds) - { - } - - const Utf8StringVector &projectPartIds() const - { - return m_projectPartIds; - } - - friend QDataStream &operator<<(QDataStream &out, const ProjectPartsDoNotExistMessage &message) - { - out << message.m_projectPartIds; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, ProjectPartsDoNotExistMessage &message) - { - in >> message.m_projectPartIds; - - return in; - } - - friend bool operator==(const ProjectPartsDoNotExistMessage &first, const ProjectPartsDoNotExistMessage &second) - { - return first.m_projectPartIds == second.m_projectPartIds; - } - -private: - Utf8StringVector m_projectPartIds; -}; - -CMBIPC_EXPORT QDebug operator<<(QDebug debug, const ProjectPartsDoNotExistMessage &message); -std::ostream &operator<<(std::ostream &os, const ProjectPartsDoNotExistMessage &message); - -DECLARE_MESSAGE(ProjectPartsDoNotExistMessage) -} // namespace ClangBackEnd diff --git a/src/libs/clangsupport/translationunitdoesnotexistmessage.cpp b/src/libs/clangsupport/translationunitdoesnotexistmessage.cpp deleted file mode 100644 index 28f54325bb3..00000000000 --- a/src/libs/clangsupport/translationunitdoesnotexistmessage.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 "translationunitdoesnotexistmessage.h" - -#include - -#include - -namespace ClangBackEnd { - -QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message) -{ - debug.nospace() << "TranslationUnitDoesNotExistMessage("; - - debug.nospace() << message.fileContainer(); - - debug.nospace() << ")"; - - return debug; -} - -std::ostream &operator<<(std::ostream &os, const TranslationUnitDoesNotExistMessage &message) -{ - os << "(" - << message.fileContainer() - << ")"; - - return os; -} - -} // namespace ClangBackEnd - diff --git a/src/libs/clangsupport/translationunitdoesnotexistmessage.h b/src/libs/clangsupport/translationunitdoesnotexistmessage.h deleted file mode 100644 index 67c6601fae9..00000000000 --- a/src/libs/clangsupport/translationunitdoesnotexistmessage.h +++ /dev/null @@ -1,88 +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 TranslationUnitDoesNotExistMessage -{ -public: - TranslationUnitDoesNotExistMessage() = default; - TranslationUnitDoesNotExistMessage(const FileContainer &fileContainer) - : m_fileContainer(fileContainer) - { - } - - TranslationUnitDoesNotExistMessage(const Utf8String &filePath, const Utf8String &projectPartId) - : m_fileContainer(filePath, projectPartId) - { - } - - const FileContainer &fileContainer() const - { - return m_fileContainer; - } - - const Utf8String &filePath() const - { - return m_fileContainer.filePath(); - } - - const Utf8String &projectPartId() const - { - return m_fileContainer.projectPartId(); - } - - friend QDataStream &operator<<(QDataStream &out, const TranslationUnitDoesNotExistMessage &message) - { - out << message.m_fileContainer; - - return out; - } - - friend QDataStream &operator>>(QDataStream &in, TranslationUnitDoesNotExistMessage &message) - { - in >> message.m_fileContainer; - - return in; - } - - friend bool operator==(const TranslationUnitDoesNotExistMessage &first, const TranslationUnitDoesNotExistMessage &second) - { - return first.m_fileContainer == second.m_fileContainer; - } - -private: - FileContainer m_fileContainer; -}; - -CMBIPC_EXPORT QDebug operator<<(QDebug debug, const TranslationUnitDoesNotExistMessage &message); -std::ostream &operator<<(std::ostream &os, const TranslationUnitDoesNotExistMessage &message); - -DECLARE_MESSAGE(TranslationUnitDoesNotExistMessage) -} // namespace ClangBackEnd diff --git a/src/plugins/clangcodemodel/clangbackendipcintegration.h b/src/plugins/clangcodemodel/clangbackendipcintegration.h index 63c9d768017..589c0357818 100644 --- a/src/plugins/clangcodemodel/clangbackendipcintegration.h +++ b/src/plugins/clangcodemodel/clangbackendipcintegration.h @@ -94,9 +94,6 @@ private: void references(const ClangBackEnd::ReferencesMessage &message) override; void followSymbol(const ClangBackEnd::FollowSymbolMessage &message) override; - void translationUnitDoesNotExist(const ClangBackEnd::TranslationUnitDoesNotExistMessage &) override {} - void projectPartsDoNotExist(const ClangBackEnd::ProjectPartsDoNotExistMessage &) override {} - private: AliveHandler m_aliveHandler; QHash m_assistProcessorsTable; diff --git a/tests/unit/unittest/clientserverinprocess-test.cpp b/tests/unit/unittest/clientserverinprocess-test.cpp index d085a3f779c..f45677e4476 100644 --- a/tests/unit/unittest/clientserverinprocess-test.cpp +++ b/tests/unit/unittest/clientserverinprocess-test.cpp @@ -30,7 +30,6 @@ #include #include -#include #include @@ -226,29 +225,6 @@ TEST_F(ClientServerInProcess, UpdateVisibleTranslationUnitsMessage) scheduleServerMessages(); } -TEST_F(ClientServerInProcess, SendTranslationUnitDoesNotExistMessage) -{ - ClangBackEnd::TranslationUnitDoesNotExistMessage message(fileContainer); - - EXPECT_CALL(mockClangCodeModelClient, translationUnitDoesNotExist(message)) - .Times(1); - - clientProxy.translationUnitDoesNotExist(message); - scheduleClientMessages(); -} - - -TEST_F(ClientServerInProcess, SendProjectPartDoesNotExistMessage) -{ - ClangBackEnd::ProjectPartsDoNotExistMessage message({Utf8StringLiteral("projectId")}); - - EXPECT_CALL(mockClangCodeModelClient, projectPartsDoNotExist(message)) - .Times(1); - - clientProxy.projectPartsDoNotExist(message); - scheduleClientMessages(); -} - TEST_F(ClientServerInProcess, SendDocumentAnnotationsChangedMessage) { ClangBackEnd::HighlightingMarkContainer highlightingMark(1, 1, 1, ClangBackEnd::HighlightingType::Keyword); diff --git a/tests/unit/unittest/dummyclangipcclient.h b/tests/unit/unittest/dummyclangipcclient.h index 027182bfdb7..3908f9e89f2 100644 --- a/tests/unit/unittest/dummyclangipcclient.h +++ b/tests/unit/unittest/dummyclangipcclient.h @@ -35,8 +35,6 @@ public: void alive() override {} void echo(const ClangBackEnd::EchoMessage &) override {} void codeCompleted(const ClangBackEnd::CodeCompletedMessage &) override {} - void translationUnitDoesNotExist(const ClangBackEnd::TranslationUnitDoesNotExistMessage &) override {} - void projectPartsDoNotExist(const ClangBackEnd::ProjectPartsDoNotExistMessage &) override {} void documentAnnotationsChanged(const ClangBackEnd::DocumentAnnotationsChangedMessage &) override {} void references(const ClangBackEnd::ReferencesMessage &) override {} void followSymbol(const ClangBackEnd::FollowSymbolMessage &) override {} diff --git a/tests/unit/unittest/mockclangcodemodelclient.h b/tests/unit/unittest/mockclangcodemodelclient.h index 47da03e33d1..2e287909ddf 100644 --- a/tests/unit/unittest/mockclangcodemodelclient.h +++ b/tests/unit/unittest/mockclangcodemodelclient.h @@ -39,10 +39,6 @@ public: void(const ClangBackEnd::EchoMessage &message)); MOCK_METHOD1(codeCompleted, void(const ClangBackEnd::CodeCompletedMessage &message)); - MOCK_METHOD1(translationUnitDoesNotExist, - void(const ClangBackEnd::TranslationUnitDoesNotExistMessage &message)); - MOCK_METHOD1(projectPartsDoNotExist, - void(const ClangBackEnd::ProjectPartsDoNotExistMessage &message)); MOCK_METHOD1(documentAnnotationsChanged, void(const ClangBackEnd::DocumentAnnotationsChangedMessage &message)); MOCK_METHOD1(references,