Clang: Rename Ipc* in ClangCodeModel*

We want to share more functionality of the IPC mechanism and for what we
need more interface classes. But we use this names already for the
ClangCodeModel implementation. So we rename the them to ClangCodeModel*.

Change-Id: Ie320e0d3b993586a9bcc6a5aa0d32427af41202e
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
This commit is contained in:
Marco Bubke
2016-06-29 16:49:56 +02:00
parent ee1da81f55
commit d027cab44e
30 changed files with 280 additions and 280 deletions

View File

@@ -8,19 +8,19 @@ QT += network
INCLUDEPATH += $$PWD
SOURCES += $$PWD/ipcserverinterface.cpp \
$$PWD/ipcserverproxy.cpp \
$$PWD/ipcclientinterface.cpp \
SOURCES += $$PWD/clangcodemodelserverinterface.cpp \
$$PWD/clangcodemodelserverproxy.cpp \
$$PWD/clangcodemodelclientinterface.cpp \
$$PWD/cmbendmessage.cpp \
$$PWD/cmbalivemessage.cpp \
$$PWD/ipcclientproxy.cpp \
$$PWD/clangcodemodelclientproxy.cpp \
$$PWD/writemessageblock.cpp \
$$PWD/readmessageblock.cpp \
$$PWD/ipcinterface.cpp \
$$PWD/connectionserver.cpp \
$$PWD/connectionclient.cpp \
$$PWD/cmbechomessage.cpp \
$$PWD/ipcclientdispatcher.cpp \
$$PWD/clangcodemodelclientdispatcher.cpp \
$$PWD/cmbregistertranslationunitsforeditormessage.cpp \
$$PWD/filecontainer.cpp \
$$PWD/cmbunregistertranslationunitsforeditormessage.cpp \
@@ -51,19 +51,19 @@ SOURCES += $$PWD/ipcserverinterface.cpp \
$$PWD/messageenvelop.cpp
HEADERS += \
$$PWD/ipcserverinterface.h \
$$PWD/ipcserverproxy.h \
$$PWD/ipcclientinterface.h \
$$PWD/clangcodemodelserverinterface.h \
$$PWD/clangcodemodelserverproxy.h \
$$PWD/clangcodemodelclientinterface.h \
$$PWD/cmbendmessage.h \
$$PWD/cmbalivemessage.h \
$$PWD/ipcclientproxy.h \
$$PWD/clangcodemodelclientproxy.h \
$$PWD/writemessageblock.h \
$$PWD/readmessageblock.h \
$$PWD/ipcinterface.h \
$$PWD/connectionserver.h \
$$PWD/connectionclient.h \
$$PWD/cmbechomessage.h \
$$PWD/ipcclientdispatcher.h \
$$PWD/clangcodemodelclientdispatcher.h \
$$PWD/cmbregistertranslationunitsforeditormessage.h \
$$PWD/filecontainer.h \
$$PWD/cmbunregistertranslationunitsforeditormessage.h \

View File

@@ -23,59 +23,59 @@
**
****************************************************************************/
#include "ipcclientdispatcher.h"
#include "clangcodemodelclientdispatcher.h"
#include <QDebug>
namespace ClangBackEnd {
void IpcClientDispatcher::addClient(IpcClientInterface *client)
void ClangCodeModelClientDispatcher::addClient(ClangCodeModelClientInterface *client)
{
clients.append(client);
}
void IpcClientDispatcher::removeClient(IpcClientInterface *client)
void ClangCodeModelClientDispatcher::removeClient(ClangCodeModelClientInterface *client)
{
clients.removeOne(client);
}
void IpcClientDispatcher::alive()
void ClangCodeModelClientDispatcher::alive()
{
for (auto *client : clients)
client->alive();
}
void IpcClientDispatcher::echo(const EchoMessage &message)
void ClangCodeModelClientDispatcher::echo(const EchoMessage &message)
{
for (auto *client : clients)
client->echo(message);
}
void IpcClientDispatcher::codeCompleted(const CodeCompletedMessage &message)
void ClangCodeModelClientDispatcher::codeCompleted(const CodeCompletedMessage &message)
{
for (auto *client : clients)
client->codeCompleted(message);
}
void IpcClientDispatcher::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
void ClangCodeModelClientDispatcher::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
{
for (auto *client : clients)
client->translationUnitDoesNotExist(message);
}
void IpcClientDispatcher::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
void ClangCodeModelClientDispatcher::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
{
for (auto *client : clients)
client->projectPartsDoNotExist(message);
}
void IpcClientDispatcher::diagnosticsChanged(const DiagnosticsChangedMessage &message)
void ClangCodeModelClientDispatcher::diagnosticsChanged(const DiagnosticsChangedMessage &message)
{
for (auto *client : clients)
client->diagnosticsChanged(message);
}
void IpcClientDispatcher::highlightingChanged(const HighlightingChangedMessage &message)
void ClangCodeModelClientDispatcher::highlightingChanged(const HighlightingChangedMessage &message)
{
for (auto *client : clients)
client->highlightingChanged(message);

View File

@@ -25,17 +25,17 @@
#pragma once
#include "ipcclientinterface.h"
#include "clangcodemodelclientinterface.h"
#include <QVector>
namespace ClangBackEnd {
class CMBIPC_EXPORT IpcClientDispatcher : public ClangBackEnd::IpcClientInterface
class CMBIPC_EXPORT ClangCodeModelClientDispatcher : public ClangBackEnd::ClangCodeModelClientInterface
{
public:
void addClient(IpcClientInterface *client);
void removeClient(IpcClientInterface *client);
void addClient(ClangCodeModelClientInterface *client);
void removeClient(ClangCodeModelClientInterface *client);
void alive() override;
void echo(const EchoMessage &message) override;
@@ -46,7 +46,7 @@ public:
void highlightingChanged(const HighlightingChangedMessage &message) override;
private:
QVector<IpcClientInterface*> clients;
QVector<ClangCodeModelClientInterface*> clients;
};
} // namespace ClangBackEnd

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "ipcclientinterface.h"
#include "clangcodemodelclientinterface.h"
#include "cmbcodecompletedmessage.h"
#include "cmbechomessage.h"
@@ -38,7 +38,7 @@
namespace ClangBackEnd {
void IpcClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
void ClangCodeModelClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
{
switch (messageEnvelop.messageType()) {
case MessageType::AliveMessage:
@@ -63,7 +63,7 @@ void IpcClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
highlightingChanged(messageEnvelop.message<HighlightingChangedMessage>());
break;
default:
qWarning() << "Unknown IpcClientMessage";
qWarning() << "Unknown ClangCodeModelClientMessage";
}
}

View File

@@ -29,7 +29,7 @@
namespace ClangBackEnd {
class IpcServerInterface;
class ClangCodeModelServerInterface;
class RegisterTranslationUnitForEditorMessage;
class UpdateTranslationUnitsForEditorMessage;
class RegisterProjectPartsForEditorMessage;
@@ -48,7 +48,7 @@ class UpdateVisibleTranslationUnitsMessage;
class RequestHighlightingMessage;
class HighlightingChangedMessage;
class CMBIPC_EXPORT IpcClientInterface : public IpcInterface
class CMBIPC_EXPORT ClangCodeModelClientInterface : public IpcInterface
{
public:
void dispatch(const MessageEnvelop &messageEnvelop) override;

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "ipcclientproxy.h"
#include "clangcodemodelclientproxy.h"
#include "cmbalivemessage.h"
#include "cmbcodecompletedmessage.h"
@@ -31,7 +31,7 @@
#include "cmbregistertranslationunitsforeditormessage.h"
#include "diagnosticschangedmessage.h"
#include "highlightingchangedmessage.h"
#include "ipcserverinterface.h"
#include "clangcodemodelserverinterface.h"
#include "messageenvelop.h"
#include "projectpartsdonotexistmessage.h"
#include "translationunitdoesnotexistmessage.h"
@@ -43,16 +43,16 @@
namespace ClangBackEnd {
IpcClientProxy::IpcClientProxy(IpcServerInterface *server, QIODevice *ioDevice)
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice)
: writeMessageBlock(ioDevice),
readMessageBlock(ioDevice),
server(server),
ioDevice(ioDevice)
{
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcClientProxy::readMessages();});
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {ClangCodeModelClientProxy::readMessages();});
}
IpcClientProxy::IpcClientProxy(IpcClientProxy &&other)
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelClientProxy &&other)
: writeMessageBlock(std::move(other.writeMessageBlock)),
readMessageBlock(std::move(other.readMessageBlock)),
server(std::move(other.server)),
@@ -61,7 +61,7 @@ IpcClientProxy::IpcClientProxy(IpcClientProxy &&other)
}
IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
ClangCodeModelClientProxy &ClangCodeModelClientProxy::operator=(ClangCodeModelClientProxy &&other)
{
writeMessageBlock = std::move(other.writeMessageBlock);
readMessageBlock = std::move(other.readMessageBlock);
@@ -71,48 +71,48 @@ IpcClientProxy &IpcClientProxy::operator=(IpcClientProxy &&other)
return *this;
}
void IpcClientProxy::alive()
void ClangCodeModelClientProxy::alive()
{
writeMessageBlock.write(AliveMessage());
}
void IpcClientProxy::echo(const EchoMessage &message)
void ClangCodeModelClientProxy::echo(const EchoMessage &message)
{
writeMessageBlock.write(message);
}
void IpcClientProxy::codeCompleted(const CodeCompletedMessage &message)
void ClangCodeModelClientProxy::codeCompleted(const CodeCompletedMessage &message)
{
writeMessageBlock.write(message);
}
void IpcClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
void ClangCodeModelClientProxy::translationUnitDoesNotExist(const TranslationUnitDoesNotExistMessage &message)
{
writeMessageBlock.write(message);
}
void IpcClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
void ClangCodeModelClientProxy::projectPartsDoNotExist(const ProjectPartsDoNotExistMessage &message)
{
writeMessageBlock.write(message);
}
void IpcClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message)
void ClangCodeModelClientProxy::diagnosticsChanged(const DiagnosticsChangedMessage &message)
{
writeMessageBlock.write(message);
}
void IpcClientProxy::highlightingChanged(const HighlightingChangedMessage &message)
void ClangCodeModelClientProxy::highlightingChanged(const HighlightingChangedMessage &message)
{
writeMessageBlock.write(message);
}
void IpcClientProxy::readMessages()
void ClangCodeModelClientProxy::readMessages()
{
for (const MessageEnvelop &message : readMessageBlock.readAll())
server->dispatch(message);
}
bool IpcClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const
bool ClangCodeModelClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const
{
return this->ioDevice == ioDevice;
}

View File

@@ -26,7 +26,7 @@
#pragma once
#include "clangbackendipc_global.h"
#include "ipcclientinterface.h"
#include "clangcodemodelclientinterface.h"
#include "readmessageblock.h"
#include "writemessageblock.h"
@@ -41,15 +41,15 @@ QT_END_NAMESPACE
namespace ClangBackEnd {
class CMBIPC_EXPORT IpcClientProxy : public IpcClientInterface
class CMBIPC_EXPORT ClangCodeModelClientProxy : public ClangCodeModelClientInterface
{
public:
explicit IpcClientProxy(IpcServerInterface *server, QIODevice *ioDevice);
IpcClientProxy(const IpcClientProxy&) = delete;
const IpcClientProxy &operator=(const IpcClientProxy&) = delete;
explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice);
ClangCodeModelClientProxy(const ClangCodeModelClientProxy&) = delete;
const ClangCodeModelClientProxy &operator=(const ClangCodeModelClientProxy&) = delete;
IpcClientProxy(IpcClientProxy&&other);
IpcClientProxy &operator=(IpcClientProxy&&other);
ClangCodeModelClientProxy(ClangCodeModelClientProxy&&other);
ClangCodeModelClientProxy &operator=(ClangCodeModelClientProxy&&other);
void alive() override;
void echo(const EchoMessage &message) override;
@@ -66,7 +66,7 @@ public:
private:
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
IpcServerInterface *server = nullptr;
ClangCodeModelServerInterface *server = nullptr;
QIODevice *ioDevice = nullptr;
};

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "ipcserverinterface.h"
#include "clangcodemodelserverinterface.h"
#include "cmbcompletecodemessage.h"
#include "cmbregisterprojectsforeditormessage.h"
@@ -43,7 +43,7 @@
namespace ClangBackEnd {
void IpcServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
void ClangCodeModelServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
{
switch (messageEnvelop.messageType()) {
case MessageType::EndMessage:
@@ -83,21 +83,21 @@ void IpcServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
updateVisibleTranslationUnits(messageEnvelop.message<UpdateVisibleTranslationUnitsMessage>());
break;
default:
qWarning() << "Unknown IpcServerMessage";
qWarning() << "Unknown ClangCodeModelServerMessage";
}
}
void IpcServerInterface::addClient(IpcClientInterface *client)
void ClangCodeModelServerInterface::addClient(ClangCodeModelClientInterface *client)
{
clientDispatcher.addClient(client);
}
void IpcServerInterface::removeClient(IpcClientInterface *client)
void ClangCodeModelServerInterface::removeClient(ClangCodeModelClientInterface *client)
{
clientDispatcher.removeClient(client);
}
IpcClientInterface *IpcServerInterface::client()
ClangCodeModelClientInterface *ClangCodeModelServerInterface::client()
{
return &clientDispatcher;
}

View File

@@ -27,13 +27,13 @@
#include "ipcinterface.h"
#include "ipcclientdispatcher.h"
#include "clangcodemodelclientdispatcher.h"
namespace ClangBackEnd {
class IpcClientInterface;
class ClangCodeModelClientInterface;
class CMBIPC_EXPORT IpcServerInterface : public IpcInterface
class CMBIPC_EXPORT ClangCodeModelServerInterface : public IpcInterface
{
public:
void dispatch(const MessageEnvelop &messageEnvelop) override;
@@ -51,13 +51,13 @@ public:
virtual void requestHighlighting(const RequestHighlightingMessage &message) = 0;
virtual void updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message) = 0;
void addClient(IpcClientInterface *client);
void removeClient(IpcClientInterface *client);
void addClient(ClangCodeModelClientInterface *client);
void removeClient(ClangCodeModelClientInterface *client);
IpcClientInterface *client();
ClangCodeModelClientInterface *client();
private:
IpcClientDispatcher clientDispatcher;
ClangCodeModelClientDispatcher clientDispatcher;
};
} // namespace ClangBackEnd

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "ipcserverproxy.h"
#include "clangcodemodelserverproxy.h"
#include <cmbalivemessage.h>
#include <cmbcompletecodemessage.h>
@@ -32,7 +32,7 @@
#include <cmbregistertranslationunitsforeditormessage.h>
#include <cmbunregisterprojectsforeditormessage.h>
#include <cmbunregistertranslationunitsforeditormessage.h>
#include <ipcclientinterface.h>
#include <clangcodemodelclientinterface.h>
#include <messageenvelop.h>
#include <registerunsavedfilesforeditormessage.h>
#include <requestdiagnosticsmessage.h>
@@ -47,82 +47,82 @@
namespace ClangBackEnd {
IpcServerProxy::IpcServerProxy(IpcClientInterface *client, QIODevice *ioDevice)
ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice)
: writeMessageBlock(ioDevice),
readMessageBlock(ioDevice),
client(client)
{
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {IpcServerProxy::readMessages();});
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () {ClangCodeModelServerProxy::readMessages();});
}
void IpcServerProxy::readMessages()
void ClangCodeModelServerProxy::readMessages()
{
for (const auto &message : readMessageBlock.readAll())
client->dispatch(message);
}
void IpcServerProxy::resetCounter()
void ClangCodeModelServerProxy::resetCounter()
{
writeMessageBlock.resetCounter();
readMessageBlock.resetCounter();
}
void IpcServerProxy::end()
void ClangCodeModelServerProxy::end()
{
writeMessageBlock.write(EndMessage());
}
void IpcServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
void ClangCodeModelServerProxy::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message)
void ClangCodeModelServerProxy::updateTranslationUnitsForEditor(const ClangBackEnd::UpdateTranslationUnitsForEditorMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
void ClangCodeModelServerProxy::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
void ClangCodeModelServerProxy::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
void ClangCodeModelServerProxy::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
{
writeMessageBlock.write(message);
}
void ClangBackEnd::IpcServerProxy::registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message)
void ClangBackEnd::ClangCodeModelServerProxy::registerUnsavedFilesForEditor(const ClangBackEnd::RegisterUnsavedFilesForEditorMessage &message)
{
writeMessageBlock.write(message);
}
void ClangBackEnd::IpcServerProxy::unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message)
void ClangBackEnd::ClangCodeModelServerProxy::unregisterUnsavedFilesForEditor(const ClangBackEnd::UnregisterUnsavedFilesForEditorMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::completeCode(const CompleteCodeMessage &message)
void ClangCodeModelServerProxy::completeCode(const CompleteCodeMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message)
void ClangCodeModelServerProxy::requestDiagnostics(const ClangBackEnd::RequestDiagnosticsMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::requestHighlighting(const RequestHighlightingMessage &message)
void ClangCodeModelServerProxy::requestHighlighting(const RequestHighlightingMessage &message)
{
writeMessageBlock.write(message);
}
void IpcServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
void ClangCodeModelServerProxy::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
{
writeMessageBlock.write(message);
}

View File

@@ -24,7 +24,7 @@
****************************************************************************/
#pragma once
#include "ipcserverinterface.h"
#include "clangcodemodelserverinterface.h"
#include "readmessageblock.h"
#include "writemessageblock.h"
@@ -42,12 +42,12 @@ QT_END_NAMESPACE
namespace ClangBackEnd {
class CMBIPC_EXPORT IpcServerProxy : public IpcServerInterface
class CMBIPC_EXPORT ClangCodeModelServerProxy : public ClangCodeModelServerInterface
{
public:
IpcServerProxy(IpcClientInterface *client, QIODevice *ioDevice);
IpcServerProxy(const IpcServerProxy&) = delete;
IpcServerProxy &operator=(const IpcServerProxy&) = delete;
ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice);
ClangCodeModelServerProxy(const ClangCodeModelServerProxy&) = delete;
ClangCodeModelServerProxy &operator=(const ClangCodeModelServerProxy&) = delete;
void end() override;
void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) override;
@@ -69,7 +69,7 @@ public:
private:
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
IpcClientInterface *client;
ClangCodeModelClientInterface *client;
};
} // namespace ClangBackEnd

View File

@@ -56,7 +56,7 @@ QString connectionName()
}
}
ConnectionClient::ConnectionClient(IpcClientInterface *client)
ConnectionClient::ConnectionClient(ClangCodeModelClientInterface *client)
: serverProxy_(client, &localSocket),
isAliveTimerResetted(false),
stdErrPrefixer("clangbackend.stderr: "),
@@ -263,7 +263,7 @@ bool ConnectionClient::waitForEcho()
return localSocket.waitForReadyRead();
}
IpcServerProxy &ConnectionClient::serverProxy()
ClangCodeModelServerProxy &ConnectionClient::serverProxy()
{
return serverProxy_;
}

View File

@@ -25,7 +25,7 @@
#pragma once
#include "ipcserverproxy.h"
#include "clangcodemodelserverproxy.h"
#include "lineprefixer.h"
#include <QLocalSocket>
@@ -49,7 +49,7 @@ class CMBIPC_EXPORT ConnectionClient : public QObject
Q_OBJECT
public:
ConnectionClient(IpcClientInterface *client);
ConnectionClient(ClangCodeModelClientInterface *client);
~ConnectionClient();
bool connectToServer();
@@ -72,7 +72,7 @@ public:
bool waitForEcho();
IpcServerProxy &serverProxy();
ClangCodeModelServerProxy &serverProxy();
QProcess *processForTestOnly() const;
@@ -100,7 +100,7 @@ private:
private:
mutable std::unique_ptr<QProcess> process_;
QLocalSocket localSocket;
IpcServerProxy serverProxy_;
ClangCodeModelServerProxy serverProxy_;
QTimer processAliveTimer;
QString processPath_;
bool isAliveTimerResetted;

View File

@@ -25,7 +25,7 @@
#include "connectionserver.h"
#include <ipcserverinterface.h>
#include <clangcodemodelserverinterface.h>
#include <QCoreApplication>
#include <QLocalSocket>
@@ -62,7 +62,7 @@ void ConnectionServer::start()
localServer.listen(connectionName);
}
void ConnectionServer::setIpcServer(IpcServerInterface *ipcServer)
void ConnectionServer::setClangCodeModelServer(ClangCodeModelServerInterface *ipcServer)
{
this->ipcServer = ipcServer;
@@ -70,7 +70,7 @@ void ConnectionServer::setIpcServer(IpcServerInterface *ipcServer)
int ConnectionServer::clientProxyCount() const
{
return static_cast<int>(ipcClientProxies.size());
return static_cast<int>(ipcServerProxies.size());
}
void ConnectionServer::timerEvent(QTimerEvent *timerEvent)
@@ -83,9 +83,9 @@ void ConnectionServer::handleNewConnection()
{
QLocalSocket *localSocket(nextPendingConnection());
ipcClientProxies.emplace_back(ipcServer, localSocket);
ipcServerProxies.emplace_back(ipcServer, localSocket);
ipcServer->addClient(&ipcClientProxies.back());
ipcServer->addClient(&ipcServerProxies.back());
localSockets.push_back(localSocket);
@@ -111,9 +111,9 @@ void ConnectionServer::handleSocketDisconnect()
void ConnectionServer::removeClientProxyWithLocalSocket(QLocalSocket *localSocket)
{
ipcClientProxies.erase(std::remove_if(ipcClientProxies.begin(),
ipcClientProxies.end(),
[localSocket](const IpcClientProxy &client) { return client.isUsingThatIoDevice(localSocket);}));
ipcServerProxies.erase(std::remove_if(ipcServerProxies.begin(),
ipcServerProxies.end(),
[localSocket](const ClangCodeModelClientProxy &client) { return client.isUsingThatIoDevice(localSocket);}));
}
QLocalSocket *ConnectionServer::nextPendingConnection()

View File

@@ -25,7 +25,7 @@
#pragma once
#include <ipcclientproxy.h>
#include <clangcodemodelclientproxy.h>
#include <QLocalServer>
@@ -33,8 +33,8 @@
namespace ClangBackEnd {
class IpcServerInterface;
class IpcClientProxy;
class ClangCodeModelServerInterface;
class ClangCodeModelClientProxy;
class CMBIPC_EXPORT ConnectionServer : public QObject
{
@@ -44,7 +44,7 @@ public:
~ConnectionServer();
void start();
void setIpcServer(IpcServerInterface *ipcServer);
void setClangCodeModelServer(ClangCodeModelServerInterface *ipcServer);
int clientProxyCount() const;
@@ -66,9 +66,9 @@ private:
void exitApplicationIfNoSockedIsConnected();
private:
std::vector<IpcClientProxy> ipcClientProxies;
std::vector<ClangCodeModelClientProxy> ipcServerProxies;
std::vector<QLocalSocket*> localSockets;
IpcServerInterface *ipcServer;
ClangCodeModelServerInterface *ipcServer;
QLocalServer localServer;
static QString connectionName;
int aliveTimerId;

View File

@@ -29,7 +29,7 @@
#include <clangbackendipc/connectionclient.h>
#include <clangbackendipc/filecontainer.h>
#include <clangbackendipc/ipcclientinterface.h>
#include <clangbackendipc/clangcodemodelclientinterface.h>
#include <clangbackendipc/projectpartcontainer.h>
#include <QObject>
@@ -57,7 +57,7 @@ class ModelManagerSupportClang;
class ClangCompletionAssistProcessor;
class IpcReceiver : public ClangBackEnd::IpcClientInterface
class IpcReceiver : public ClangBackEnd::ClangCodeModelClientInterface
{
public:
IpcReceiver();

View File

@@ -28,7 +28,7 @@
#include <QLoggingCategory>
#include <connectionserver.h>
#include <clangipcserver.h>
#include <clangcodemodelserver.h>
QString processArguments(QCoreApplication &application)
{
@@ -62,10 +62,10 @@ int main(int argc, char *argv[])
clang_toggleCrashRecovery(true);
clang_enableStackTraces();
ClangBackEnd::ClangIpcServer clangIpcServer;
ClangBackEnd::ClangCodeModelServer clangCodeModelServer;
ClangBackEnd::ConnectionServer connectionServer(connection);
connectionServer.start();
connectionServer.setIpcServer(&clangIpcServer);
connectionServer.setClangCodeModelServer(&clangCodeModelServer);
return application.exec();
}

View File

@@ -1,6 +1,6 @@
INCLUDEPATH += $$PWD
HEADERS += $$PWD/clangipcserver.h \
HEADERS += $$PWD/clangcodemodelserver.h \
$$PWD/codecompleter.h \
$$PWD/clangstring.h \
$$PWD/translationunitisnullexception.h \
@@ -36,7 +36,7 @@ HEADERS += $$PWD/clangipcserver.h \
$$PWD/highlightingmarksiterator.h \
$$PWD/utf8positionfromlinecolumn.h
SOURCES += $$PWD/clangipcserver.cpp \
SOURCES += $$PWD/clangcodemodelserver.cpp \
$$PWD/codecompleter.cpp \
$$PWD/clangstring.cpp \
$$PWD/translationunitisnullexception.cpp \

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "clangipcserver.h"
#include "clangcodemodelserver.h"
#include "clangfilesystemwatcher.h"
#include "codecompleter.h"
@@ -86,7 +86,7 @@ int delayedDocumentAnnotationsTimerInterval()
}
ClangIpcServer::ClangIpcServer()
ClangCodeModelServer::ClangCodeModelServer()
: translationUnits(projects, unsavedFiles)
{
const auto sendDocumentAnnotations
@@ -104,7 +104,7 @@ ClangIpcServer::ClangIpcServer()
else
sendDocumentAnnotationsTimer.stop();
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::sendDelayedDocumentAnnotationsTimer:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::sendDelayedDocumentAnnotationsTimer:" << exception.what();
}
};
@@ -123,14 +123,14 @@ ClangIpcServer::ClangIpcServer()
onFileChanged);
}
void ClangIpcServer::end()
void ClangCodeModelServer::end()
{
QCoreApplication::exit();
}
void ClangIpcServer::registerTranslationUnitsForEditor(const ClangBackEnd::RegisterTranslationUnitForEditorMessage &message)
void ClangCodeModelServer::registerTranslationUnitsForEditor(const ClangBackEnd::RegisterTranslationUnitForEditorMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::registerTranslationUnitsForEditor");
TIME_SCOPE_DURATION("ClangCodeModelServer::registerTranslationUnitsForEditor");
try {
auto createdTranslationUnits = translationUnits.create(message.fileContainers());
@@ -142,13 +142,13 @@ void ClangIpcServer::registerTranslationUnitsForEditor(const ClangBackEnd::Regis
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::registerTranslationUnitsForEditor:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::registerTranslationUnitsForEditor:" << exception.what();
}
}
void ClangIpcServer::updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message)
void ClangCodeModelServer::updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::updateTranslationUnitsForEditor");
TIME_SCOPE_DURATION("ClangCodeModelServer::updateTranslationUnitsForEditor");
try {
const auto newerFileContainers = translationUnits.newerFileContainers(message.fileContainers());
@@ -162,13 +162,13 @@ void ClangIpcServer::updateTranslationUnitsForEditor(const UpdateTranslationUnit
} catch (const TranslationUnitDoesNotExistException &exception) {
client()->translationUnitDoesNotExist(TranslationUnitDoesNotExistMessage(exception.fileContainer()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::updateTranslationUnitsForEditor:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::updateTranslationUnitsForEditor:" << exception.what();
}
}
void ClangIpcServer::unregisterTranslationUnitsForEditor(const ClangBackEnd::UnregisterTranslationUnitsForEditorMessage &message)
void ClangCodeModelServer::unregisterTranslationUnitsForEditor(const ClangBackEnd::UnregisterTranslationUnitsForEditorMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::unregisterTranslationUnitsForEditor");
TIME_SCOPE_DURATION("ClangCodeModelServer::unregisterTranslationUnitsForEditor");
try {
translationUnits.remove(message.fileContainers());
@@ -178,39 +178,39 @@ void ClangIpcServer::unregisterTranslationUnitsForEditor(const ClangBackEnd::Unr
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::unregisterTranslationUnitsForEditor:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::unregisterTranslationUnitsForEditor:" << exception.what();
}
}
void ClangIpcServer::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
void ClangCodeModelServer::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::registerProjectPartsForEditor");
TIME_SCOPE_DURATION("ClangCodeModelServer::registerProjectPartsForEditor");
try {
projects.createOrUpdate(message.projectContainers());
translationUnits.setTranslationUnitsDirtyIfProjectPartChanged();
sendDocumentAnnotationsTimer.start(0);
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::registerProjectPartsForEditor:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::registerProjectPartsForEditor:" << exception.what();
}
}
void ClangIpcServer::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
void ClangCodeModelServer::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::unregisterProjectPartsForEditor");
TIME_SCOPE_DURATION("ClangCodeModelServer::unregisterProjectPartsForEditor");
try {
projects.remove(message.projectPartIds());
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::unregisterProjectPartsForEditor:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::unregisterProjectPartsForEditor:" << exception.what();
}
}
void ClangIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message)
void ClangCodeModelServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::registerUnsavedFilesForEditor");
TIME_SCOPE_DURATION("ClangCodeModelServer::registerUnsavedFilesForEditor");
try {
unsavedFiles.createOrUpdate(message.fileContainers());
@@ -219,13 +219,13 @@ void ClangIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesFor
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::registerUnsavedFilesForEditor:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::registerUnsavedFilesForEditor:" << exception.what();
}
}
void ClangIpcServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
void ClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::unregisterUnsavedFilesForEditor");
TIME_SCOPE_DURATION("ClangCodeModelServer::unregisterUnsavedFilesForEditor");
try {
unsavedFiles.remove(message.fileContainers());
@@ -235,13 +235,13 @@ void ClangIpcServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFile
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::unregisterUnsavedFilesForEditor:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::unregisterUnsavedFilesForEditor:" << exception.what();
}
}
void ClangIpcServer::completeCode(const ClangBackEnd::CompleteCodeMessage &message)
void ClangCodeModelServer::completeCode(const ClangBackEnd::CompleteCodeMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::completeCode");
TIME_SCOPE_DURATION("ClangCodeModelServer::completeCode");
try {
CodeCompleter codeCompleter(translationUnits.translationUnit(message.filePath(), message.projectPartId()));
@@ -256,13 +256,13 @@ void ClangIpcServer::completeCode(const ClangBackEnd::CompleteCodeMessage &messa
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::completeCode:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::completeCode:" << exception.what();
}
}
void ClangIpcServer::requestDiagnostics(const RequestDiagnosticsMessage &message)
void ClangCodeModelServer::requestDiagnostics(const RequestDiagnosticsMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::requestDiagnostics");
TIME_SCOPE_DURATION("ClangCodeModelServer::requestDiagnostics");
try {
auto translationUnit = translationUnits.translationUnit(message.file().filePath(),
@@ -275,13 +275,13 @@ void ClangIpcServer::requestDiagnostics(const RequestDiagnosticsMessage &message
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::requestDiagnostics:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::requestDiagnostics:" << exception.what();
}
}
void ClangIpcServer::requestHighlighting(const RequestHighlightingMessage &message)
void ClangCodeModelServer::requestHighlighting(const RequestHighlightingMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::requestHighlighting");
TIME_SCOPE_DURATION("ClangCodeModelServer::requestHighlighting");
try {
auto translationUnit = translationUnits.translationUnit(message.fileContainer().filePath(),
@@ -295,35 +295,35 @@ void ClangIpcServer::requestHighlighting(const RequestHighlightingMessage &messa
} catch (const ProjectPartDoNotExistException &exception) {
client()->projectPartsDoNotExist(ProjectPartsDoNotExistMessage(exception.projectPartIds()));
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::requestHighlighting:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::requestHighlighting:" << exception.what();
}
}
void ClangIpcServer::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
void ClangCodeModelServer::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
{
TIME_SCOPE_DURATION("ClangIpcServer::updateVisibleTranslationUnits");
TIME_SCOPE_DURATION("ClangCodeModelServer::updateVisibleTranslationUnits");
try {
translationUnits.setUsedByCurrentEditor(message.currentEditorFilePath());
translationUnits.setVisibleInEditors(message.visibleEditorFilePaths());
sendDocumentAnnotationsTimer.start(0);
} catch (const std::exception &exception) {
qWarning() << "Error in ClangIpcServer::updateVisibleTranslationUnits:" << exception.what();
qWarning() << "Error in ClangCodeModelServer::updateVisibleTranslationUnits:" << exception.what();
}
}
const TranslationUnits &ClangIpcServer::translationUnitsForTestOnly() const
const TranslationUnits &ClangCodeModelServer::translationUnitsForTestOnly() const
{
return translationUnits;
}
void ClangIpcServer::startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(const Utf8String &filePath)
void ClangCodeModelServer::startDocumentAnnotationsTimerIfFileIsNotATranslationUnit(const Utf8String &filePath)
{
if (!translationUnits.hasTranslationUnit(filePath))
sendDocumentAnnotationsTimer.start(0);
}
void ClangIpcServer::startDocumentAnnotations()
void ClangCodeModelServer::startDocumentAnnotations()
{
DocumentAnnotationsSendState sendState = DocumentAnnotationsSendState::MaybeThereAreDocumentAnnotations;
@@ -331,7 +331,7 @@ void ClangIpcServer::startDocumentAnnotations()
sendState = translationUnits.sendDocumentAnnotations();
}
void ClangIpcServer::reparseVisibleDocuments(std::vector<TranslationUnit> &translationUnits)
void ClangCodeModelServer::reparseVisibleDocuments(std::vector<TranslationUnit> &translationUnits)
{
for (TranslationUnit &translationUnit : translationUnits)
if (translationUnit.isVisibleInEditor())

View File

@@ -25,7 +25,7 @@
#pragma once
#include "ipcserverinterface.h"
#include "clangcodemodelserverinterface.h"
#include "projectpart.h"
#include "projects.h"
@@ -40,10 +40,10 @@
namespace ClangBackEnd {
class ClangIpcServer : public IpcServerInterface
class ClangCodeModelServer : public ClangCodeModelServerInterface
{
public:
ClangIpcServer();
ClangCodeModelServer();
void end() override;
void registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message) override;

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "echoipcserver.h"
#include "echoclangcodemodelserver.h"
#include "cmbcodecompletedmessage.h"
#include "cmbcompletecodemessage.h"
@@ -47,73 +47,73 @@
namespace ClangBackEnd {
void EchoIpcServer::dispatch(const MessageEnvelop &message)
void EchoClangCodeModelServer::dispatch(const MessageEnvelop &message)
{
IpcServerInterface::dispatch(message);
ClangCodeModelServerInterface::dispatch(message);
}
void EchoIpcServer::end()
void EchoClangCodeModelServer::end()
{
ConnectionServer::removeServer();
QCoreApplication::quit();
}
void EchoIpcServer::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
void EchoClangCodeModelServer::registerTranslationUnitsForEditor(const RegisterTranslationUnitForEditorMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message)
void EchoClangCodeModelServer::updateTranslationUnitsForEditor(const UpdateTranslationUnitsForEditorMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
void EchoClangCodeModelServer::unregisterTranslationUnitsForEditor(const UnregisterTranslationUnitsForEditorMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
void EchoClangCodeModelServer::registerProjectPartsForEditor(const RegisterProjectPartsForEditorMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
void EchoClangCodeModelServer::unregisterProjectPartsForEditor(const UnregisterProjectPartsForEditorMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message)
void EchoClangCodeModelServer::registerUnsavedFilesForEditor(const RegisterUnsavedFilesForEditorMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
void EchoClangCodeModelServer::unregisterUnsavedFilesForEditor(const UnregisterUnsavedFilesForEditorMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::completeCode(const CompleteCodeMessage &message)
void EchoClangCodeModelServer::completeCode(const CompleteCodeMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::requestDiagnostics(const RequestDiagnosticsMessage &message)
void EchoClangCodeModelServer::requestDiagnostics(const RequestDiagnosticsMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::requestHighlighting(const RequestHighlightingMessage &message)
void EchoClangCodeModelServer::requestHighlighting(const RequestHighlightingMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
void EchoClangCodeModelServer::updateVisibleTranslationUnits(const UpdateVisibleTranslationUnitsMessage &message)
{
echoMessage(message);
}
void EchoIpcServer::echoMessage(const MessageEnvelop &message)
void EchoClangCodeModelServer::echoMessage(const MessageEnvelop &message)
{
client()->echo(EchoMessage(message));
}

View File

@@ -25,11 +25,11 @@
#pragma once
#include <ipcserverinterface.h>
#include <clangcodemodelserverinterface.h>
namespace ClangBackEnd {
class EchoIpcServer : public IpcServerInterface
class EchoClangCodeModelServer : public ClangCodeModelServerInterface
{
public:
void dispatch(const MessageEnvelop &message) override;

View File

@@ -18,11 +18,11 @@ include(../../../src/libs/sqlite/sqlite-lib.pri)
INCLUDEPATH += ../../../src/libs
SOURCES += \
echoipcserver.cpp \
echoclangcodemodelserver.cpp \
echoserverprocessmain.cpp
HEADERS += \
echoipcserver.h
echoclangcodemodelserver.h
DEFINES += CLANGBACKENDIPC_TESTS
DEFINES += DONT_CHECK_MESSAGE_COUNTER

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "echoipcserver.h"
#include "echoclangcodemodelserver.h"
#include <connectionserver.h>
@@ -43,10 +43,10 @@ int main(int argc, char *argv[])
return 1;
}
ClangBackEnd::EchoIpcServer echoIpcServer;
ClangBackEnd::EchoClangCodeModelServer echoClangCodeModelServer;
ClangBackEnd::ConnectionServer connectionServer(application.arguments()[1]);
connectionServer.start();
connectionServer.setIpcServer(&echoIpcServer);
connectionServer.setClangCodeModelServer(&echoClangCodeModelServer);
return application.exec();
}

View File

@@ -23,13 +23,13 @@
**
****************************************************************************/
#include "mockipclient.h"
#include "mockclangcodemodelclient.h"
#include <clangipcserver.h>
#include <clangcodemodelserver.h>
#include <highlightingchangedmessage.h>
#include <highlightingmarkcontainer.h>
#include <ipcclientproxy.h>
#include <ipcserverproxy.h>
#include <clangcodemodelclientproxy.h>
#include <clangcodemodelserverproxy.h>
#include <requesthighlightingmessage.h>
#include <translationunitdoesnotexistexception.h>
#include <translationunitparseerrorexception.h>
@@ -132,7 +132,7 @@ MATCHER_P5(HasDirtyTranslationUnit,
}
class ClangIpcServer : public ::testing::Test
class ClangClangCodeModelServer : public ::testing::Test
{
protected:
void SetUp() override;
@@ -145,8 +145,8 @@ protected:
static const Utf8String unsavedContent(const QString &unsavedFilePath);
protected:
MockIpcClient mockIpcClient;
ClangBackEnd::ClangIpcServer clangServer;
MockClangCodeModelClient mockClangCodeModelClient;
ClangBackEnd::ClangCodeModelServer clangServer;
const ClangBackEnd::TranslationUnits &translationUnits = clangServer.translationUnitsForTestOnly();
const Utf8String projectPartId = Utf8StringLiteral("pathToProjectPart.pro");
const Utf8String functionTestFilePath = Utf8StringLiteral(TESTDATA_DIR"/complete_extractor_function.cpp");
@@ -156,7 +156,7 @@ protected:
const Utf8String parseErrorTestFilePath = Utf8StringLiteral(TESTDATA_DIR"/complete_translationunit_parse_error.cpp");
};
TEST_F(ClangIpcServer, GetCodeCompletion)
TEST_F(ClangClangCodeModelServer, GetCodeCompletion)
{
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
@@ -166,13 +166,13 @@ TEST_F(ClangIpcServer, GetCodeCompletion)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockClangCodeModelClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, RequestHighlighting)
TEST_F(ClangClangCodeModelServer, RequestHighlighting)
{
RequestHighlightingMessage requestHighlightingMessage({variableTestFilePath, projectPartId});
HighlightingTypes types;
@@ -180,13 +180,13 @@ TEST_F(ClangIpcServer, RequestHighlighting)
types.mixinHighlightingTypes.push_back(ClangBackEnd::HighlightingType::Declaration);
HighlightingMarkContainer highlightingMarkContainer(1, 6, 8, types);
EXPECT_CALL(mockIpcClient, highlightingChanged(Property(&HighlightingChangedMessage::highlightingMarks, Contains(highlightingMarkContainer))))
EXPECT_CALL(mockClangCodeModelClient, highlightingChanged(Property(&HighlightingChangedMessage::highlightingMarks, Contains(highlightingMarkContainer))))
.Times(1);
clangServer.requestHighlighting(requestHighlightingMessage);
}
TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets)
TEST_F(ClangClangCodeModelServer, GetCodeCompletionDependingOnArgumets)
{
CompleteCodeMessage completeCodeMessage(variableTestFilePath,
35,
@@ -196,14 +196,14 @@ TEST_F(ClangIpcServer, GetCodeCompletionDependingOnArgumets)
34,
CodeCompletion::VariableCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockClangCodeModelClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
changeProjectPartArguments();
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForEditorOnNonExistingTranslationUnit)
TEST_F(ClangClangCodeModelServer, GetTranslationUnitDoesNotExistForEditorOnNonExistingTranslationUnit)
{
CompleteCodeMessage completeCodeMessage(Utf8StringLiteral("dontexists.cpp"),
34,
@@ -211,13 +211,13 @@ TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForEditorOnNonExistingTrans
projectPartId);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(Utf8StringLiteral("dontexists.cpp"), projectPartId);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForCompletingUnregisteredFile)
TEST_F(ClangClangCodeModelServer, GetTranslationUnitDoesNotExistForCompletingUnregisteredFile)
{
CompleteCodeMessage completeCodeMessage(parseErrorTestFilePath,
20,
@@ -225,13 +225,13 @@ TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForCompletingUnregisteredFi
projectPartId);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(parseErrorTestFilePath, projectPartId);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile)
TEST_F(ClangClangCodeModelServer, GetCodeCompletionForUnsavedFile)
{
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
@@ -241,13 +241,13 @@ TEST_F(ClangIpcServer, GetCodeCompletionForUnsavedFile)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockClangCodeModelClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile)
TEST_F(ClangClangCodeModelServer, GetNoCodeCompletionAfterRemovingUnsavedFile)
{
clangServer.updateTranslationUnitsForEditor(UpdateTranslationUnitsForEditorMessage(
{FileContainer(functionTestFilePath, projectPartId, Utf8StringVector(), 74)}));
@@ -259,13 +259,13 @@ TEST_F(ClangIpcServer, GetNoCodeCompletionAfterRemovingUnsavedFile)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Not(Contains(codeCompletion)))))
EXPECT_CALL(mockClangCodeModelClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Not(Contains(codeCompletion)))))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile)
TEST_F(ClangClangCodeModelServer, GetNewCodeCompletionAfterUpdatingUnsavedFile)
{
clangServer.updateTranslationUnitsForEditor(UpdateTranslationUnitsForEditorMessage({{functionTestFilePath,
projectPartId,
@@ -280,25 +280,25 @@ TEST_F(ClangIpcServer, GetNewCodeCompletionAfterUpdatingUnsavedFile)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
EXPECT_CALL(mockClangCodeModelClient, codeCompleted(Property(&CodeCompletedMessage::codeCompletions, Contains(codeCompletion))))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetTranslationUnitDoesNotExistForUnregisterTranslationUnitWithWrongFilePath)
TEST_F(ClangClangCodeModelServer, GetTranslationUnitDoesNotExistForUnregisterTranslationUnitWithWrongFilePath)
{
FileContainer fileContainer(Utf8StringLiteral("foo.cpp"), projectPartId);
UnregisterTranslationUnitsForEditorMessage message({fileContainer});
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(fileContainer);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.unregisterTranslationUnitsForEditor(message);
}
TEST_F(ClangIpcServer, UnregisterTranslationUnitAndTestFailingCompletion)
TEST_F(ClangClangCodeModelServer, UnregisterTranslationUnitAndTestFailingCompletion)
{
FileContainer fileContainer(functionTestFilePath, projectPartId);
UnregisterTranslationUnitsForEditorMessage message({fileContainer});
@@ -309,25 +309,25 @@ TEST_F(ClangIpcServer, UnregisterTranslationUnitAndTestFailingCompletion)
projectPartId);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(fileContainer);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistUnregisterProjectPartInexistingProjectPart)
TEST_F(ClangClangCodeModelServer, GetProjectPartDoesNotExistUnregisterProjectPartInexistingProjectPart)
{
Utf8StringVector inexistingProjectPartFilePath = {Utf8StringLiteral("projectpartsdoesnotexist.pro"), Utf8StringLiteral("project2doesnotexists.pro")};
UnregisterProjectPartsForEditorMessage unregisterProjectPartsForEditorMessage(inexistingProjectPartFilePath);
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage(inexistingProjectPartFilePath);
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.unregisterProjectPartsForEditor(unregisterProjectPartsForEditorMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistRegisterTranslationUnitWithInexistingProjectPart)
TEST_F(ClangClangCodeModelServer, GetProjectPartDoesNotExistRegisterTranslationUnitWithInexistingProjectPart)
{
Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro");
RegisterTranslationUnitForEditorMessage registerFileForEditorMessage({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)},
@@ -335,25 +335,25 @@ TEST_F(ClangIpcServer, GetProjectPartDoesNotExistRegisterTranslationUnitWithInex
{variableTestFilePath});
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage({inexistingProjectPartFilePath});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.registerTranslationUnitsForEditor(registerFileForEditorMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistUnregisterTranslationUnitWithInexistingProjectPart)
TEST_F(ClangClangCodeModelServer, GetProjectPartDoesNotExistUnregisterTranslationUnitWithInexistingProjectPart)
{
Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro");
UnregisterTranslationUnitsForEditorMessage unregisterFileForEditorMessage({FileContainer(variableTestFilePath, inexistingProjectPartFilePath)});
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage({inexistingProjectPartFilePath});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.unregisterTranslationUnitsForEditor(unregisterFileForEditorMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingProjectPartFile)
TEST_F(ClangClangCodeModelServer, GetProjectPartDoesNotExistForCompletingProjectPartFile)
{
Utf8String inexistingProjectPartFilePath = Utf8StringLiteral("projectpartsdoesnotexist.pro");
CompleteCodeMessage completeCodeMessage(variableTestFilePath,
@@ -362,13 +362,13 @@ TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingProjectPartFile)
inexistingProjectPartFilePath);
ProjectPartsDoNotExistMessage projectPartsDoNotExistMessage({inexistingProjectPartFilePath});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, projectPartsDoNotExist(projectPartsDoNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingUnregisteredFile)
TEST_F(ClangClangCodeModelServer, GetProjectPartDoesNotExistForCompletingUnregisteredFile)
{
CompleteCodeMessage completeCodeMessage(parseErrorTestFilePath,
20,
@@ -376,13 +376,13 @@ TEST_F(ClangIpcServer, GetProjectPartDoesNotExistForCompletingUnregisteredFile)
projectPartId);
TranslationUnitDoesNotExistMessage translationUnitDoesNotExistMessage(parseErrorTestFilePath, projectPartId);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
EXPECT_CALL(mockClangCodeModelClient, translationUnitDoesNotExist(translationUnitDoesNotExistMessage))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, TicketNumberIsForwarded)
TEST_F(ClangClangCodeModelServer, TicketNumberIsForwarded)
{
CompleteCodeMessage completeCodeMessage(functionTestFilePath,
20,
@@ -392,18 +392,18 @@ TEST_F(ClangIpcServer, TicketNumberIsForwarded)
34,
CodeCompletion::FunctionCompletionKind);
EXPECT_CALL(mockIpcClient, codeCompleted(Property(&CodeCompletedMessage::ticketNumber, Eq(completeCodeMessage.ticketNumber()))))
EXPECT_CALL(mockClangCodeModelClient, codeCompleted(Property(&CodeCompletedMessage::ticketNumber, Eq(completeCodeMessage.ticketNumber()))))
.Times(1);
clangServer.completeCode(completeCodeMessage);
}
TEST_F(ClangIpcServer, TranslationUnitAfterCreationNeedsNoReparseAndHasNoNewDiagnostics)
TEST_F(ClangClangCodeModelServer, TranslationUnitAfterCreationNeedsNoReparseAndHasNoNewDiagnostics)
{
ASSERT_THAT(clangServer, HasDirtyTranslationUnit(functionTestFilePath, projectPartId, 0U, false, false));
}
TEST_F(ClangIpcServer, SetCurrentAndVisibleEditor)
TEST_F(ClangClangCodeModelServer, SetCurrentAndVisibleEditor)
{
auto functionTranslationUnit = translationUnits.translationUnit(functionTestFilePath, projectPartId);
auto variableTranslationUnit = translationUnits.translationUnit(variableTestFilePath, projectPartId);
@@ -415,7 +415,7 @@ TEST_F(ClangIpcServer, SetCurrentAndVisibleEditor)
ASSERT_TRUE(variableTranslationUnit.isVisibleInEditor());
}
TEST_F(ClangIpcServer, IsNotCurrentCurrentAndVisibleEditorAnymore)
TEST_F(ClangClangCodeModelServer, IsNotCurrentCurrentAndVisibleEditorAnymore)
{
auto functionTranslationUnit = translationUnits.translationUnit(functionTestFilePath, projectPartId);
auto variableTranslationUnit = translationUnits.translationUnit(variableTestFilePath, projectPartId);
@@ -429,48 +429,48 @@ TEST_F(ClangIpcServer, IsNotCurrentCurrentAndVisibleEditorAnymore)
ASSERT_TRUE(variableTranslationUnit.isVisibleInEditor());
}
void ClangIpcServer::SetUp()
void ClangClangCodeModelServer::SetUp()
{
clangServer.addClient(&mockIpcClient);
clangServer.addClient(&mockClangCodeModelClient);
registerProjectPart();
registerFiles();
}
void ClangIpcServer::registerFiles()
void ClangClangCodeModelServer::registerFiles()
{
RegisterTranslationUnitForEditorMessage message({FileContainer(functionTestFilePath, projectPartId, unsavedContent(unsavedTestFilePath), true),
FileContainer(variableTestFilePath, projectPartId)},
functionTestFilePath,
{functionTestFilePath, variableTestFilePath});
EXPECT_CALL(mockIpcClient, diagnosticsChanged(_)).Times(2);
EXPECT_CALL(mockIpcClient, highlightingChanged(_)).Times(2);
EXPECT_CALL(mockClangCodeModelClient, diagnosticsChanged(_)).Times(2);
EXPECT_CALL(mockClangCodeModelClient, highlightingChanged(_)).Times(2);
clangServer.registerTranslationUnitsForEditor(message);
}
void ClangIpcServer::registerProjectPart()
void ClangClangCodeModelServer::registerProjectPart()
{
RegisterProjectPartsForEditorMessage message({ProjectPartContainer(projectPartId)});
clangServer.registerProjectPartsForEditor(message);
}
void ClangIpcServer::changeProjectPartArguments()
void ClangClangCodeModelServer::changeProjectPartArguments()
{
RegisterProjectPartsForEditorMessage message({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-DArgumentDefinition")})});
clangServer.registerProjectPartsForEditor(message);
}
void ClangIpcServer::changeProjectPartArgumentsToWrongValues()
void ClangClangCodeModelServer::changeProjectPartArgumentsToWrongValues()
{
RegisterProjectPartsForEditorMessage message({ProjectPartContainer(projectPartId, {Utf8StringLiteral("-blah")})});
clangServer.registerProjectPartsForEditor(message);
}
void ClangIpcServer::updateVisibilty(const Utf8String &currentEditor, const Utf8String &additionalVisibleEditor)
void ClangClangCodeModelServer::updateVisibilty(const Utf8String &currentEditor, const Utf8String &additionalVisibleEditor)
{
UpdateVisibleTranslationUnitsMessage message(currentEditor,
{currentEditor, additionalVisibleEditor});
@@ -478,7 +478,7 @@ void ClangIpcServer::updateVisibilty(const Utf8String &currentEditor, const Utf8
clangServer.updateVisibleTranslationUnits(message);
}
const Utf8String ClangIpcServer::unsavedContent(const QString &unsavedFilePath)
const Utf8String ClangClangCodeModelServer::unsavedContent(const QString &unsavedFilePath)
{
QFile unsavedFileContentFile(unsavedFilePath);
bool isOpen = unsavedFileContentFile.open(QIODevice::ReadOnly | QIODevice::Text);
@@ -488,7 +488,7 @@ const Utf8String ClangIpcServer::unsavedContent(const QString &unsavedFilePath)
return Utf8String::fromByteArray(unsavedFileContentFile.readAll());
}
TEST_F(ClangIpcServer, TranslationUnitAfterUpdateNeedsReparseAndHasNewDiagnostics)
TEST_F(ClangClangCodeModelServer, TranslationUnitAfterUpdateNeedsReparseAndHasNewDiagnostics)
{
const auto fileContainer = FileContainer(functionTestFilePath, projectPartId,unsavedContent(unsavedTestFilePath), true, 1);

View File

@@ -23,11 +23,11 @@
**
****************************************************************************/
#include "mockipclient.h"
#include "mockipcserver.h"
#include "mockclangcodemodelclient.h"
#include "mockclangcodemodelserver.h"
#include <ipcclientproxy.h>
#include <ipcserverproxy.h>
#include <clangcodemodelclientproxy.h>
#include <clangcodemodelserverproxy.h>
#include <projectpartsdonotexistmessage.h>
#include <cmbalivemessage.h>
@@ -90,16 +90,16 @@ protected:
true,
1};
QBuffer buffer;
MockIpcClient mockIpcClient;
MockIpcServer mockIpcServer;
MockClangCodeModelClient mockClangCodeModelClient;
MockClangCodeModelServer mockClangCodeModelServer;
ClangBackEnd::IpcServerProxy serverProxy;
ClangBackEnd::IpcClientProxy clientProxy;
ClangBackEnd::ClangCodeModelServerProxy serverProxy;
ClangBackEnd::ClangCodeModelClientProxy clientProxy;
};
TEST_F(ClientServerInProcess, SendEndMessage)
{
EXPECT_CALL(mockIpcServer, end())
EXPECT_CALL(mockClangCodeModelServer, end())
.Times(1);
serverProxy.end();
@@ -108,7 +108,7 @@ TEST_F(ClientServerInProcess, SendEndMessage)
TEST_F(ClientServerInProcess, SendAliveMessage)
{
EXPECT_CALL(mockIpcClient, alive())
EXPECT_CALL(mockClangCodeModelClient, alive())
.Times(1);
clientProxy.alive();
@@ -121,7 +121,7 @@ TEST_F(ClientServerInProcess, SendRegisterTranslationUnitForEditorMessage)
filePath,
{filePath});
EXPECT_CALL(mockIpcServer, registerTranslationUnitsForEditor(message))
EXPECT_CALL(mockClangCodeModelServer, registerTranslationUnitsForEditor(message))
.Times(1);
serverProxy.registerTranslationUnitsForEditor(message);
@@ -132,7 +132,7 @@ TEST_F(ClientServerInProcess, SendUpdateTranslationUnitsForEditorMessage)
{
ClangBackEnd::UpdateTranslationUnitsForEditorMessage message({fileContainer});
EXPECT_CALL(mockIpcServer, updateTranslationUnitsForEditor(message))
EXPECT_CALL(mockClangCodeModelServer, updateTranslationUnitsForEditor(message))
.Times(1);
serverProxy.updateTranslationUnitsForEditor(message);
@@ -143,7 +143,7 @@ TEST_F(ClientServerInProcess, SendUnregisterTranslationUnitsForEditorMessage)
{
ClangBackEnd::UnregisterTranslationUnitsForEditorMessage message({fileContainer});
EXPECT_CALL(mockIpcServer, unregisterTranslationUnitsForEditor(message))
EXPECT_CALL(mockClangCodeModelServer, unregisterTranslationUnitsForEditor(message))
.Times(1);
serverProxy.unregisterTranslationUnitsForEditor(message);
@@ -154,7 +154,7 @@ TEST_F(ClientServerInProcess, SendRegisterUnsavedFilesForEditorMessage)
{
ClangBackEnd::RegisterUnsavedFilesForEditorMessage message({fileContainer});
EXPECT_CALL(mockIpcServer, registerUnsavedFilesForEditor(message))
EXPECT_CALL(mockClangCodeModelServer, registerUnsavedFilesForEditor(message))
.Times(1);
serverProxy.registerUnsavedFilesForEditor(message);
@@ -165,7 +165,7 @@ TEST_F(ClientServerInProcess, SendUnregisterUnsavedFilesForEditorMessage)
{
ClangBackEnd::UnregisterUnsavedFilesForEditorMessage message({fileContainer});
EXPECT_CALL(mockIpcServer, unregisterUnsavedFilesForEditor(message))
EXPECT_CALL(mockClangCodeModelServer, unregisterUnsavedFilesForEditor(message))
.Times(1);
serverProxy.unregisterUnsavedFilesForEditor(message);
@@ -176,7 +176,7 @@ TEST_F(ClientServerInProcess, SendCompleteCodeMessage)
{
ClangBackEnd::CompleteCodeMessage message(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want"));
EXPECT_CALL(mockIpcServer, completeCode(message))
EXPECT_CALL(mockClangCodeModelServer, completeCode(message))
.Times(1);
serverProxy.completeCode(message);
@@ -188,7 +188,7 @@ TEST_F(ClientServerInProcess, SendRequestDiagnosticsMessage)
ClangBackEnd::RequestDiagnosticsMessage message({Utf8StringLiteral("foo.cpp"),
Utf8StringLiteral("projectId")});
EXPECT_CALL(mockIpcServer, requestDiagnostics(message))
EXPECT_CALL(mockClangCodeModelServer, requestDiagnostics(message))
.Times(1);
serverProxy.requestDiagnostics(message);
@@ -200,7 +200,7 @@ TEST_F(ClientServerInProcess, SendRequestHighlightingMessage)
ClangBackEnd::RequestHighlightingMessage message({Utf8StringLiteral("foo.cpp"),
Utf8StringLiteral("projectId")});
EXPECT_CALL(mockIpcServer, requestHighlighting(message))
EXPECT_CALL(mockClangCodeModelServer, requestHighlighting(message))
.Times(1);
serverProxy.requestHighlighting(message);
@@ -214,7 +214,7 @@ TEST_F(ClientServerInProcess, SendCodeCompletedMessage)
ClangBackEnd::CompletionCorrection::NoCorrection,
1);
EXPECT_CALL(mockIpcClient, codeCompleted(message))
EXPECT_CALL(mockClangCodeModelClient, codeCompleted(message))
.Times(1);
clientProxy.codeCompleted(message);
@@ -226,7 +226,7 @@ TEST_F(ClientServerInProcess, SendRegisterProjectPartsForEditorMessage)
ClangBackEnd::ProjectPartContainer projectContainer(Utf8StringLiteral(TESTDATA_DIR"/complete.pro"));
ClangBackEnd::RegisterProjectPartsForEditorMessage message({projectContainer});
EXPECT_CALL(mockIpcServer, registerProjectPartsForEditor(message))
EXPECT_CALL(mockClangCodeModelServer, registerProjectPartsForEditor(message))
.Times(1);
serverProxy.registerProjectPartsForEditor(message);
@@ -237,7 +237,7 @@ TEST_F(ClientServerInProcess, SendUnregisterProjectPartsForEditorMessage)
{
ClangBackEnd::UnregisterProjectPartsForEditorMessage message({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")});
EXPECT_CALL(mockIpcServer, unregisterProjectPartsForEditor(message))
EXPECT_CALL(mockClangCodeModelServer, unregisterProjectPartsForEditor(message))
.Times(1);
serverProxy.unregisterProjectPartsForEditor(message);
@@ -250,7 +250,7 @@ TEST_F(ClientServerInProcess, UpdateVisibleTranslationUnitsMessage)
{Utf8StringLiteral(TESTDATA_DIR"/fileone.cpp"),
Utf8StringLiteral(TESTDATA_DIR"/filetwo.cpp")});
EXPECT_CALL(mockIpcServer, updateVisibleTranslationUnits(message))
EXPECT_CALL(mockClangCodeModelServer, updateVisibleTranslationUnits(message))
.Times(1);
serverProxy.updateVisibleTranslationUnits(message);
@@ -261,7 +261,7 @@ TEST_F(ClientServerInProcess, SendTranslationUnitDoesNotExistMessage)
{
ClangBackEnd::TranslationUnitDoesNotExistMessage message(fileContainer);
EXPECT_CALL(mockIpcClient, translationUnitDoesNotExist(message))
EXPECT_CALL(mockClangCodeModelClient, translationUnitDoesNotExist(message))
.Times(1);
clientProxy.translationUnitDoesNotExist(message);
@@ -273,7 +273,7 @@ TEST_F(ClientServerInProcess, SendProjectPartDoesNotExistMessage)
{
ClangBackEnd::ProjectPartsDoNotExistMessage message({Utf8StringLiteral("projectId")});
EXPECT_CALL(mockIpcClient, projectPartsDoNotExist(message))
EXPECT_CALL(mockClangCodeModelClient, projectPartsDoNotExist(message))
.Times(1);
clientProxy.projectPartsDoNotExist(message);
@@ -293,7 +293,7 @@ TEST_F(ClientServerInProcess, SendDiagnosticsChangedMessage)
ClangBackEnd::DiagnosticsChangedMessage message(fileContainer,
{container});
EXPECT_CALL(mockIpcClient, diagnosticsChanged(message))
EXPECT_CALL(mockClangCodeModelClient, diagnosticsChanged(message))
.Times(1);
clientProxy.diagnosticsChanged(message);
@@ -308,7 +308,7 @@ TEST_F(ClientServerInProcess, SendHighlightingChangedMessage)
{container},
QVector<SourceRangeContainer>());
EXPECT_CALL(mockIpcClient, highlightingChanged(message))
EXPECT_CALL(mockClangCodeModelClient, highlightingChanged(message))
.Times(1);
clientProxy.highlightingChanged(message);
@@ -316,8 +316,8 @@ TEST_F(ClientServerInProcess, SendHighlightingChangedMessage)
}
ClientServerInProcess::ClientServerInProcess()
: serverProxy(&mockIpcClient, &buffer),
clientProxy(&mockIpcServer, &buffer)
: serverProxy(&mockClangCodeModelClient, &buffer),
clientProxy(&mockClangCodeModelServer, &buffer)
{
}

View File

@@ -23,7 +23,7 @@
**
****************************************************************************/
#include "mockipclient.h"
#include "mockclangcodemodelclient.h"
#include <cmbalivemessage.h>
#include <cmbcodecompletedmessage.h>
@@ -70,12 +70,12 @@ protected:
static void SetUpTestCase();
static void TearDownTestCase();
static MockIpcClient mockIpcClient;
static MockClangCodeModelClient mockClangCodeModelClient;
static ClangBackEnd::ConnectionClient client;
};
MockIpcClient ClientServerOutsideProcess::mockIpcClient;
ClangBackEnd::ConnectionClient ClientServerOutsideProcess::client(&ClientServerOutsideProcess::mockIpcClient);
MockClangCodeModelClient ClientServerOutsideProcess::mockClangCodeModelClient;
ClangBackEnd::ConnectionClient ClientServerOutsideProcess::client(&ClientServerOutsideProcess::mockClangCodeModelClient);
TEST_F(ClientServerOutsideProcess, RestartProcess)
{
@@ -112,7 +112,7 @@ TEST_F(ClientServerOutsideProcess, SendRegisterTranslationUnitForEditorMessage)
{filePath});
EchoMessage echoMessage(registerTranslationUnitForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage))
EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage))
.Times(1);
client.serverProxy().registerTranslationUnitsForEditor(registerTranslationUnitForEditorMessage);
@@ -125,7 +125,7 @@ TEST_F(ClientServerOutsideProcess, SendUnregisterTranslationUnitsForEditorMessag
ClangBackEnd::UnregisterTranslationUnitsForEditorMessage unregisterTranslationUnitsForEditorMessage ({fileContainer});
EchoMessage echoMessage(unregisterTranslationUnitsForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage))
EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage))
.Times(1);
client.serverProxy().unregisterTranslationUnitsForEditor(unregisterTranslationUnitsForEditorMessage);
@@ -137,7 +137,7 @@ TEST_F(ClientServerOutsideProcess, SendCompleteCodeMessage)
CompleteCodeMessage codeCompleteMessage(Utf8StringLiteral("foo.cpp"), 24, 33, Utf8StringLiteral("do what I want"));
EchoMessage echoMessage(codeCompleteMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage))
EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage))
.Times(1);
client.serverProxy().completeCode(codeCompleteMessage);
@@ -150,7 +150,7 @@ TEST_F(ClientServerOutsideProcess, SendRegisterProjectPartsForEditorMessage)
ClangBackEnd::RegisterProjectPartsForEditorMessage registerProjectPartsForEditorMessage({projectContainer});
EchoMessage echoMessage(registerProjectPartsForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage))
EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage))
.Times(1);
client.serverProxy().registerProjectPartsForEditor(registerProjectPartsForEditorMessage);
@@ -162,7 +162,7 @@ TEST_F(ClientServerOutsideProcess, SendUnregisterProjectPartsForEditorMessage)
ClangBackEnd::UnregisterProjectPartsForEditorMessage unregisterProjectPartsForEditorMessage({Utf8StringLiteral(TESTDATA_DIR"/complete.pro")});
EchoMessage echoMessage(unregisterProjectPartsForEditorMessage);
EXPECT_CALL(mockIpcClient, echo(echoMessage))
EXPECT_CALL(mockClangCodeModelClient, echo(echoMessage))
.Times(1);
client.serverProxy().unregisterProjectPartsForEditor(unregisterProjectPartsForEditorMessage);

View File

@@ -25,14 +25,14 @@
#pragma once
#include <ipcclientinterface.h>
#include <clangcodemodelclientinterface.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
class MockIpcClient : public ClangBackEnd::IpcClientInterface {
class MockClangCodeModelClient : public ClangBackEnd::ClangCodeModelClientInterface {
public:
MOCK_METHOD0(alive,
void());

View File

@@ -25,14 +25,14 @@
#pragma once
#include <ipcserverinterface.h>
#include <clangcodemodelserverinterface.h>
#include <gmock/gmock.h>
#include <gmock/gmock-matchers.h>
#include <gtest/gtest.h>
#include "gtest-qt-printing.h"
class MockIpcServer : public ClangBackEnd::IpcServerInterface {
class MockClangCodeModelServer : public ClangBackEnd::ClangCodeModelServerInterface {
public:
MOCK_METHOD0(end,
void());

View File

@@ -78,8 +78,8 @@ SOURCES += \
HEADERS += \
gtest-qt-printing.h \
mockipclient.h \
mockipcserver.h \
mockclangcodemodelclient.h \
mockclangcodemodelserver.h \
spydummy.h \
matcher-diagnosticcontainer.h \
chunksreportedmonitor.h \