forked from qt-creator/qt-creator
Remove clangsupport library
Change-Id: I18455fc451b6e1b73c7183f6c75820379e26951a Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -15,7 +15,6 @@ add_subdirectory(glsl)
|
|||||||
add_subdirectory(languageserverprotocol)
|
add_subdirectory(languageserverprotocol)
|
||||||
add_subdirectory(ssh)
|
add_subdirectory(ssh)
|
||||||
add_subdirectory(sqlite)
|
add_subdirectory(sqlite)
|
||||||
add_subdirectory(clangsupport)
|
|
||||||
add_subdirectory(tracing)
|
add_subdirectory(tracing)
|
||||||
|
|
||||||
add_subdirectory(qtcreatorcdbext)
|
add_subdirectory(qtcreatorcdbext)
|
||||||
|
@@ -1,72 +0,0 @@
|
|||||||
set(CLANG_VERSION ${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}.${LLVM_VERSION_PATCH})
|
|
||||||
|
|
||||||
add_qtc_library(ClangSupport
|
|
||||||
DEPENDS Threads::Threads
|
|
||||||
PUBLIC_DEPENDS Utils Qt5::Core Qt5::Network
|
|
||||||
PUBLIC_DEFINES
|
|
||||||
CLANG_VERSION="${CLANG_VERSION}"
|
|
||||||
CLANG_INCLUDE_DIR="${LLVM_LIBRARY_DIR}/clang/${CLANG_VERSION}/include"
|
|
||||||
CLANG_BINDIR="${LLVM_TOOLS_BINARY_DIR}"
|
|
||||||
PUBLIC_INCLUDES
|
|
||||||
"${CMAKE_CURRENT_LIST_DIR}"
|
|
||||||
SOURCES
|
|
||||||
alivemessage.cpp alivemessage.h
|
|
||||||
annotationsmessage.cpp annotationsmessage.h
|
|
||||||
baseserverproxy.cpp baseserverproxy.h
|
|
||||||
clangcodemodelclientinterface.cpp clangcodemodelclientinterface.h
|
|
||||||
clangcodemodelclientmessages.h
|
|
||||||
clangcodemodelclientproxy.cpp clangcodemodelclientproxy.h
|
|
||||||
clangcodemodelconnectionclient.cpp clangcodemodelconnectionclient.h
|
|
||||||
clangcodemodelserverinterface.cpp clangcodemodelserverinterface.h
|
|
||||||
clangcodemodelservermessages.h
|
|
||||||
clangcodemodelserverproxy.cpp clangcodemodelserverproxy.h
|
|
||||||
clangsupport_global.h
|
|
||||||
clangsupportdebugutils.cpp clangsupportdebugutils.h
|
|
||||||
codecompletion.cpp codecompletion.h
|
|
||||||
codecompletionchunk.cpp codecompletionchunk.h
|
|
||||||
completionsmessage.cpp completionsmessage.h
|
|
||||||
connectionclient.cpp connectionclient.h
|
|
||||||
connectionserver.cpp connectionserver.h
|
|
||||||
diagnosticcontainer.cpp diagnosticcontainer.h
|
|
||||||
documentschangedmessage.cpp documentschangedmessage.h
|
|
||||||
documentsclosedmessage.cpp documentsclosedmessage.h
|
|
||||||
documentsopenedmessage.cpp documentsopenedmessage.h
|
|
||||||
documentvisibilitychangedmessage.cpp documentvisibilitychangedmessage.h
|
|
||||||
echomessage.cpp echomessage.h
|
|
||||||
endmessage.cpp endmessage.h
|
|
||||||
filecontainer.cpp filecontainer.h
|
|
||||||
fixitcontainer.cpp fixitcontainer.h
|
|
||||||
followsymbolmessage.cpp followsymbolmessage.h
|
|
||||||
ipcclientinterface.h
|
|
||||||
ipcclientprovider.h
|
|
||||||
ipcinterface.h
|
|
||||||
ipcserverinterface.h
|
|
||||||
lineprefixer.cpp lineprefixer.h
|
|
||||||
messageenvelop.cpp messageenvelop.h
|
|
||||||
processcreator.cpp processcreator.h
|
|
||||||
processexception.cpp processexception.h
|
|
||||||
processhandle.h
|
|
||||||
processstartedevent.cpp processstartedevent.h
|
|
||||||
readmessageblock.cpp readmessageblock.h
|
|
||||||
referencesmessage.cpp referencesmessage.h
|
|
||||||
requestannotationsmessage.cpp requestannotationsmessage.h
|
|
||||||
requestcompletionsmessage.cpp requestcompletionsmessage.h
|
|
||||||
requestfollowsymbolmessage.cpp requestfollowsymbolmessage.h
|
|
||||||
requestreferencesmessage.cpp requestreferencesmessage.h
|
|
||||||
requesttooltipmessage.cpp requesttooltipmessage.h
|
|
||||||
sourcelocationcontainer.cpp sourcelocationcontainer.h
|
|
||||||
sourcelocationscontainer.cpp sourcelocationscontainer.h
|
|
||||||
sourcerangecontainer.cpp sourcerangecontainer.h
|
|
||||||
tokeninfocontainer.cpp tokeninfocontainer.h
|
|
||||||
tooltipinfo.cpp tooltipinfo.h
|
|
||||||
tooltipmessage.cpp tooltipmessage.h
|
|
||||||
unsavedfilesremovedmessage.cpp unsavedfilesremovedmessage.h
|
|
||||||
unsavedfilesupdatedmessage.cpp unsavedfilesupdatedmessage.h
|
|
||||||
utf8string.cpp utf8string.h
|
|
||||||
utf8stringvector.cpp utf8stringvector.h
|
|
||||||
writemessageblock.cpp writemessageblock.h
|
|
||||||
)
|
|
||||||
|
|
||||||
if (NOT TARGET libclang)
|
|
||||||
return()
|
|
||||||
endif()
|
|
@@ -1,37 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "alivemessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const AliveMessage &/*message*/)
|
|
||||||
{
|
|
||||||
return debug.nospace() << "AliveMessage()";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,56 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class AliveMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const AliveMessage &/*message*/)
|
|
||||||
{
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, AliveMessage &/*message*/)
|
|
||||||
{
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const AliveMessage &/*first*/, const AliveMessage &/*second*/)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const AliveMessage &message);
|
|
||||||
};
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(AliveMessage)
|
|
||||||
}
|
|
@@ -1,46 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "annotationsmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const AnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "AnnotationsMessage("
|
|
||||||
<< message.fileContainer
|
|
||||||
<< ", " << message.diagnostics.size()
|
|
||||||
<< ", " << !message.firstHeaderErrorDiagnostic.text.isEmpty()
|
|
||||||
<< ", " << message.tokenInfos.size()
|
|
||||||
<< ", " << message.skippedPreprocessorRanges.size()
|
|
||||||
<< ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,112 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
#include "diagnosticcontainer.h"
|
|
||||||
#include "filecontainer.h"
|
|
||||||
#include "tokeninfocontainer.h"
|
|
||||||
#include "sourcerangecontainer.h"
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT AnnotationsMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
AnnotationsMessage() = default;
|
|
||||||
// For pure token infos update
|
|
||||||
AnnotationsMessage(const FileContainer &fileContainer,
|
|
||||||
const QVector<TokenInfoContainer> &tokenInfos)
|
|
||||||
: fileContainer(fileContainer),
|
|
||||||
tokenInfos(tokenInfos),
|
|
||||||
onlyTokenInfos(true)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
AnnotationsMessage(const FileContainer &fileContainer,
|
|
||||||
const QVector<DiagnosticContainer> &diagnostics,
|
|
||||||
const DiagnosticContainer &firstHeaderErrorDiagnostic,
|
|
||||||
const QVector<TokenInfoContainer> &tokenInfos,
|
|
||||||
const QVector<SourceRangeContainer> &skippedPreprocessorRanges)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
, tokenInfos(tokenInfos)
|
|
||||||
, diagnostics(diagnostics)
|
|
||||||
, firstHeaderErrorDiagnostic(firstHeaderErrorDiagnostic)
|
|
||||||
, skippedPreprocessorRanges(skippedPreprocessorRanges)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const AnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
out << message.onlyTokenInfos;
|
|
||||||
out << message.fileContainer;
|
|
||||||
out << message.tokenInfos;
|
|
||||||
if (message.onlyTokenInfos)
|
|
||||||
return out;
|
|
||||||
out << message.diagnostics;
|
|
||||||
out << message.firstHeaderErrorDiagnostic;
|
|
||||||
out << message.skippedPreprocessorRanges;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, AnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.onlyTokenInfos;
|
|
||||||
in >> message.fileContainer;
|
|
||||||
in >> message.tokenInfos;
|
|
||||||
if (message.onlyTokenInfos)
|
|
||||||
return in;
|
|
||||||
in >> message.diagnostics;
|
|
||||||
in >> message.firstHeaderErrorDiagnostic;
|
|
||||||
in >> message.skippedPreprocessorRanges;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const AnnotationsMessage &first, const AnnotationsMessage &second)
|
|
||||||
{
|
|
||||||
return first.fileContainer == second.fileContainer
|
|
||||||
&& first.diagnostics == second.diagnostics
|
|
||||||
&& first.firstHeaderErrorDiagnostic == second.firstHeaderErrorDiagnostic
|
|
||||||
&& first.tokenInfos == second.tokenInfos
|
|
||||||
&& first.skippedPreprocessorRanges == second.skippedPreprocessorRanges;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const AnnotationsMessage &message);
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
QVector<TokenInfoContainer> tokenInfos;
|
|
||||||
QVector<DiagnosticContainer> diagnostics;
|
|
||||||
DiagnosticContainer firstHeaderErrorDiagnostic;
|
|
||||||
QVector<SourceRangeContainer> skippedPreprocessorRanges;
|
|
||||||
bool onlyTokenInfos = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(AnnotationsMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,74 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "baseserverproxy.h"
|
|
||||||
#include "messageenvelop.h"
|
|
||||||
|
|
||||||
#include <QLocalSocket>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
BaseServerProxy::BaseServerProxy(IpcClientInterface *client, QLocalSocket *localSocket)
|
|
||||||
: m_writeMessageBlock(localSocket)
|
|
||||||
, m_readMessageBlock(localSocket)
|
|
||||||
, m_client(client)
|
|
||||||
{
|
|
||||||
if (localSocket)
|
|
||||||
QObject::connect(localSocket, &QIODevice::readyRead, [this]() {
|
|
||||||
BaseServerProxy::readMessages();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
BaseServerProxy::BaseServerProxy(IpcClientInterface *client, QIODevice *ioDevice)
|
|
||||||
: m_writeMessageBlock(ioDevice)
|
|
||||||
, m_readMessageBlock(ioDevice)
|
|
||||||
, m_client(client)
|
|
||||||
{
|
|
||||||
if (ioDevice)
|
|
||||||
QObject::connect(ioDevice, &QIODevice::readyRead, [this] () { BaseServerProxy::readMessages(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseServerProxy::readMessages()
|
|
||||||
{
|
|
||||||
for (const auto &message : m_readMessageBlock.readAll())
|
|
||||||
m_client->dispatch(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseServerProxy::resetState()
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.resetState();
|
|
||||||
m_readMessageBlock.resetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
void BaseServerProxy::setLocalSocket(QLocalSocket *localSocket)
|
|
||||||
{
|
|
||||||
QObject::connect(localSocket, &QIODevice::readyRead, [this]() {
|
|
||||||
BaseServerProxy::readMessages();
|
|
||||||
});
|
|
||||||
m_writeMessageBlock.setLocalSocket(localSocket);
|
|
||||||
m_readMessageBlock.setIoDevice(localSocket);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,58 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ipcclientinterface.h"
|
|
||||||
#include "readmessageblock.h"
|
|
||||||
#include "writemessageblock.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT BaseServerProxy
|
|
||||||
{
|
|
||||||
BaseServerProxy(const BaseServerProxy&) = delete;
|
|
||||||
BaseServerProxy &operator=(const BaseServerProxy&) = delete;
|
|
||||||
|
|
||||||
public:
|
|
||||||
BaseServerProxy(IpcClientInterface *client, QLocalSocket *localSocket);
|
|
||||||
BaseServerProxy(IpcClientInterface *client, QIODevice *ioDevice);
|
|
||||||
|
|
||||||
void readMessages();
|
|
||||||
|
|
||||||
void resetState();
|
|
||||||
|
|
||||||
void setLocalSocket(QLocalSocket *localSocket);
|
|
||||||
|
|
||||||
protected:
|
|
||||||
~BaseServerProxy() = default;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ClangBackEnd::WriteMessageBlock m_writeMessageBlock;
|
|
||||||
ClangBackEnd::ReadMessageBlock m_readMessageBlock;
|
|
||||||
IpcClientInterface *m_client;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,65 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "clangcodemodelclientinterface.h"
|
|
||||||
#include "clangcodemodelclientmessages.h"
|
|
||||||
#include "messageenvelop.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
void ClangCodeModelClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
|
||||||
{
|
|
||||||
switch (messageEnvelop.messageType()) {
|
|
||||||
case MessageType::AliveMessage:
|
|
||||||
alive();
|
|
||||||
break;
|
|
||||||
case MessageType::EchoMessage:
|
|
||||||
echo(messageEnvelop.message<EchoMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::CompletionsMessage:
|
|
||||||
completions(messageEnvelop.message<CompletionsMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::AnnotationsMessage:
|
|
||||||
annotations(messageEnvelop.message<AnnotationsMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::ReferencesMessage:
|
|
||||||
references(messageEnvelop.message<ReferencesMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::FollowSymbolMessage:
|
|
||||||
followSymbol(messageEnvelop.message<FollowSymbolMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::ToolTipMessage:
|
|
||||||
tooltip(messageEnvelop.message<ToolTipMessage>());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qWarning() << "Unknown ClangCodeModelClientMessage";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,66 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ipcclientinterface.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class ClangCodeModelServerInterface;
|
|
||||||
|
|
||||||
class AnnotationsMessage;
|
|
||||||
class CompletionsMessage;
|
|
||||||
class DocumentVisibilityChangedMessage;
|
|
||||||
class DocumentsChangedMessage;
|
|
||||||
class DocumentsClosedMessage;
|
|
||||||
class DocumentsOpenedMessage;
|
|
||||||
class EchoMessage;
|
|
||||||
class FollowSymbolMessage;
|
|
||||||
class ReferencesMessage;
|
|
||||||
class RequestAnnotationsMessage;
|
|
||||||
class RequestCompletionsMessage;
|
|
||||||
class RequestFollowSymbolMessage;
|
|
||||||
class RequestReferencesMessage;
|
|
||||||
class RequestToolTipMessage;
|
|
||||||
class ToolTipMessage;
|
|
||||||
class UnsavedFilesRemovedMessage;
|
|
||||||
class UnsavedFilesUpdatedMessage;
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ClangCodeModelClientInterface : public IpcClientInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
|
||||||
|
|
||||||
virtual void alive() = 0;
|
|
||||||
virtual void echo(const EchoMessage &message) = 0;
|
|
||||||
virtual void completions(const CompletionsMessage &message) = 0;
|
|
||||||
virtual void annotations(const AnnotationsMessage &message) = 0;
|
|
||||||
virtual void references(const ReferencesMessage &message) = 0;
|
|
||||||
virtual void followSymbol(const FollowSymbolMessage &message) = 0;
|
|
||||||
virtual void tooltip(const ToolTipMessage &message) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,34 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "alivemessage.h"
|
|
||||||
#include "completionsmessage.h"
|
|
||||||
#include "echomessage.h"
|
|
||||||
#include "annotationsmessage.h"
|
|
||||||
#include "referencesmessage.h"
|
|
||||||
#include "followsymbolmessage.h"
|
|
||||||
#include "tooltipmessage.h"
|
|
@@ -1,130 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "clangcodemodelclientproxy.h"
|
|
||||||
|
|
||||||
#include "clangcodemodelclientmessages.h"
|
|
||||||
#include "clangcodemodelserverinterface.h"
|
|
||||||
#include "ipcserverinterface.h"
|
|
||||||
#include "messageenvelop.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QLocalSocket>
|
|
||||||
#include <QVariant>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server,
|
|
||||||
QLocalSocket *localSocket)
|
|
||||||
: m_writeMessageBlock(localSocket)
|
|
||||||
, m_readMessageBlock(localSocket)
|
|
||||||
, m_server(server)
|
|
||||||
, m_ioDevice(localSocket)
|
|
||||||
{
|
|
||||||
QObject::connect(m_ioDevice, &QIODevice::readyRead, [this]() {
|
|
||||||
ClangCodeModelClientProxy::readMessages();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelServerInterface *server,
|
|
||||||
QIODevice *ioDevice)
|
|
||||||
: m_writeMessageBlock(ioDevice)
|
|
||||||
, m_readMessageBlock(ioDevice)
|
|
||||||
, m_server(server)
|
|
||||||
, m_ioDevice(ioDevice)
|
|
||||||
{
|
|
||||||
QObject::connect(m_ioDevice, &QIODevice::readyRead, [this]() {
|
|
||||||
ClangCodeModelClientProxy::readMessages();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangCodeModelClientProxy::ClangCodeModelClientProxy(ClangCodeModelClientProxy &&other)
|
|
||||||
: m_writeMessageBlock(std::move(other.m_writeMessageBlock)),
|
|
||||||
m_readMessageBlock(std::move(other.m_readMessageBlock)),
|
|
||||||
m_server(std::move(other.m_server)),
|
|
||||||
m_ioDevice(std::move(other.m_ioDevice))
|
|
||||||
{
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangCodeModelClientProxy &ClangCodeModelClientProxy::operator=(ClangCodeModelClientProxy &&other)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock = std::move(other.m_writeMessageBlock);
|
|
||||||
m_readMessageBlock = std::move(other.m_readMessageBlock);
|
|
||||||
m_server = std::move(other.m_server);
|
|
||||||
m_ioDevice = std::move(other.m_ioDevice);
|
|
||||||
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::alive()
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(AliveMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::echo(const EchoMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::completions(const CompletionsMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::annotations(const AnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::references(const ReferencesMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::followSymbol(const FollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::tooltip(const ToolTipMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelClientProxy::readMessages()
|
|
||||||
{
|
|
||||||
for (const MessageEnvelop &message : m_readMessageBlock.readAll())
|
|
||||||
m_server->dispatch(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ClangCodeModelClientProxy::isUsingThatIoDevice(QIODevice *ioDevice) const
|
|
||||||
{
|
|
||||||
return m_ioDevice == ioDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,76 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
#include "clangcodemodelclientinterface.h"
|
|
||||||
#include "readmessageblock.h"
|
|
||||||
#include "writemessageblock.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QLocalServer;
|
|
||||||
class QLocalSocket;
|
|
||||||
class QIODevice;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ClangCodeModelClientProxy : public ClangCodeModelClientInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server,
|
|
||||||
QLocalSocket *localSocket);
|
|
||||||
explicit ClangCodeModelClientProxy(ClangCodeModelServerInterface *server, QIODevice *ioDevice);
|
|
||||||
ClangCodeModelClientProxy(const ClangCodeModelClientProxy&) = delete;
|
|
||||||
const ClangCodeModelClientProxy &operator=(const ClangCodeModelClientProxy&) = delete;
|
|
||||||
|
|
||||||
ClangCodeModelClientProxy(ClangCodeModelClientProxy&&other);
|
|
||||||
ClangCodeModelClientProxy &operator=(ClangCodeModelClientProxy&&other);
|
|
||||||
|
|
||||||
void alive() override;
|
|
||||||
void echo(const EchoMessage &message) override;
|
|
||||||
void completions(const CompletionsMessage &message) override;
|
|
||||||
void annotations(const AnnotationsMessage &message) override;
|
|
||||||
void references(const ReferencesMessage &message) override;
|
|
||||||
void followSymbol(const FollowSymbolMessage &message) override;
|
|
||||||
void tooltip(const ToolTipMessage &message) override;
|
|
||||||
|
|
||||||
void readMessages();
|
|
||||||
|
|
||||||
bool isUsingThatIoDevice(QIODevice *ioDevice) const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ClangBackEnd::WriteMessageBlock m_writeMessageBlock;
|
|
||||||
ClangBackEnd::ReadMessageBlock m_readMessageBlock;
|
|
||||||
ClangCodeModelServerInterface *m_server = nullptr;
|
|
||||||
QIODevice *m_ioDevice = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,91 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "clangcodemodelconnectionclient.h"
|
|
||||||
|
|
||||||
#include <utils/environment.h>
|
|
||||||
#include <utils/temporarydirectory.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
QString currentProcessId()
|
|
||||||
{
|
|
||||||
return QString::number(QCoreApplication::applicationPid());
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangCodeModelConnectionClient::ClangCodeModelConnectionClient(ClangCodeModelClientInterface *client)
|
|
||||||
: ConnectionClient(Utils::TemporaryDirectory::masterDirectoryPath()
|
|
||||||
+ QStringLiteral("/ClangBackEnd-") + currentProcessId())
|
|
||||||
, m_serverProxy(client)
|
|
||||||
{
|
|
||||||
m_processCreator.setTemporaryDirectoryPattern("clangbackend-XXXXXX");
|
|
||||||
m_processCreator.setArguments({connectionName()});
|
|
||||||
|
|
||||||
Utils::Environment environment;
|
|
||||||
environment.set(QStringLiteral("LIBCLANG_NOTHREADS"), QString());
|
|
||||||
environment.set(QStringLiteral("LIBCLANG_DISABLE_CRASH_RECOVERY"), QString());
|
|
||||||
m_processCreator.setEnvironment(environment);
|
|
||||||
|
|
||||||
stdErrPrefixer().setPrefix("clangbackend.stderr: ");
|
|
||||||
stdOutPrefixer().setPrefix("clangbackend.stdout: ");
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangCodeModelConnectionClient::~ClangCodeModelConnectionClient()
|
|
||||||
{
|
|
||||||
finishProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
ClangCodeModelServerProxy &ClangCodeModelConnectionClient::serverProxy()
|
|
||||||
{
|
|
||||||
return m_serverProxy;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelConnectionClient::sendEndCommand()
|
|
||||||
{
|
|
||||||
m_serverProxy.end();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelConnectionClient::resetState()
|
|
||||||
{
|
|
||||||
m_serverProxy.resetState();
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ClangCodeModelConnectionClient::outputName() const
|
|
||||||
{
|
|
||||||
return QStringLiteral("ClangCodeModelConnectionClient");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelConnectionClient::newConnectedServer(QLocalSocket *localSocket)
|
|
||||||
{
|
|
||||||
m_serverProxy.setLocalSocket(localSocket);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,50 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "connectionclient.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ClangCodeModelConnectionClient : public ConnectionClient
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ClangCodeModelConnectionClient(ClangCodeModelClientInterface *client);
|
|
||||||
~ClangCodeModelConnectionClient();
|
|
||||||
|
|
||||||
ClangCodeModelServerProxy &serverProxy();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
void sendEndCommand() override;
|
|
||||||
void resetState() override;
|
|
||||||
QString outputName() const override;
|
|
||||||
void newConnectedServer(QLocalSocket *localSocket) override;
|
|
||||||
|
|
||||||
private:
|
|
||||||
ClangCodeModelServerProxy m_serverProxy;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,80 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "clangcodemodelserverinterface.h"
|
|
||||||
#include "clangcodemodelservermessages.h"
|
|
||||||
#include "messageenvelop.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
void ClangCodeModelServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
|
|
||||||
{
|
|
||||||
switch (messageEnvelop.messageType()) {
|
|
||||||
case MessageType::EndMessage:
|
|
||||||
end();
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentsOpenedMessage:
|
|
||||||
documentsOpened(messageEnvelop.message<DocumentsOpenedMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentsChangedMessage:
|
|
||||||
documentsChanged(messageEnvelop.message<DocumentsChangedMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentsClosedMessage:
|
|
||||||
documentsClosed(messageEnvelop.message<DocumentsClosedMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentVisibilityChangedMessage:
|
|
||||||
documentVisibilityChanged(messageEnvelop.message<DocumentVisibilityChangedMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::UnsavedFilesUpdatedMessage:
|
|
||||||
unsavedFilesUpdated(messageEnvelop.message<UnsavedFilesUpdatedMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::UnsavedFilesRemovedMessage:
|
|
||||||
unsavedFilesRemoved(messageEnvelop.message<UnsavedFilesRemovedMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::RequestCompletionsMessage:
|
|
||||||
requestCompletions(messageEnvelop.message<RequestCompletionsMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::RequestAnnotationsMessage:
|
|
||||||
requestAnnotations(messageEnvelop.message<RequestAnnotationsMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::RequestReferencesMessage:
|
|
||||||
requestReferences(messageEnvelop.message<RequestReferencesMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::RequestFollowSymbolMessage:
|
|
||||||
requestFollowSymbol(messageEnvelop.message<RequestFollowSymbolMessage>());
|
|
||||||
break;
|
|
||||||
case MessageType::RequestToolTipMessage:
|
|
||||||
requestToolTip(messageEnvelop.message<RequestToolTipMessage>());
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qWarning() << "Unknown ClangCodeModelServerMessage";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,60 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ipcserverinterface.h"
|
|
||||||
|
|
||||||
#include "clangcodemodelclientinterface.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class ClangCodeModelClientInterface;
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ClangCodeModelServerInterface : public IpcServerInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
~ClangCodeModelServerInterface() override = default;
|
|
||||||
|
|
||||||
void dispatch(const MessageEnvelop &messageEnvelop) override;
|
|
||||||
|
|
||||||
virtual void end() = 0;
|
|
||||||
|
|
||||||
virtual void documentsOpened(const DocumentsOpenedMessage &message) = 0;
|
|
||||||
virtual void documentsChanged(const DocumentsChangedMessage &message) = 0;
|
|
||||||
virtual void documentsClosed(const DocumentsClosedMessage &message) = 0;
|
|
||||||
virtual void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) = 0;
|
|
||||||
|
|
||||||
virtual void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) = 0;
|
|
||||||
virtual void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) = 0;
|
|
||||||
|
|
||||||
virtual void requestCompletions(const RequestCompletionsMessage &message) = 0;
|
|
||||||
virtual void requestAnnotations(const RequestAnnotationsMessage &message) = 0;
|
|
||||||
virtual void requestReferences(const RequestReferencesMessage &message) = 0;
|
|
||||||
virtual void requestFollowSymbol(const RequestFollowSymbolMessage &message) = 0;
|
|
||||||
virtual void requestToolTip(const RequestToolTipMessage &message) = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,43 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "echomessage.h"
|
|
||||||
#include "endmessage.h"
|
|
||||||
|
|
||||||
#include "documentsopenedmessage.h"
|
|
||||||
#include "documentsclosedmessage.h"
|
|
||||||
#include "documentschangedmessage.h"
|
|
||||||
#include "documentvisibilitychangedmessage.h"
|
|
||||||
|
|
||||||
#include "unsavedfilesupdatedmessage.h"
|
|
||||||
#include "unsavedfilesremovedmessage.h"
|
|
||||||
|
|
||||||
#include "requestannotationsmessage.h"
|
|
||||||
#include "requestcompletionsmessage.h"
|
|
||||||
#include "requestfollowsymbolmessage.h"
|
|
||||||
#include "requestreferencesmessage.h"
|
|
||||||
#include "requesttooltipmessage.h"
|
|
@@ -1,107 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "clangcodemodelserverproxy.h"
|
|
||||||
|
|
||||||
#include <clangcodemodelclientinterface.h>
|
|
||||||
#include <clangcodemodelservermessages.h>
|
|
||||||
#include <messageenvelop.h>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client,
|
|
||||||
QLocalSocket *localSocket)
|
|
||||||
: BaseServerProxy(client, localSocket)
|
|
||||||
{}
|
|
||||||
|
|
||||||
ClangCodeModelServerProxy::ClangCodeModelServerProxy(ClangCodeModelClientInterface *client,
|
|
||||||
QIODevice *ioDevice)
|
|
||||||
: BaseServerProxy(client, ioDevice)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::end()
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(EndMessage());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::documentsOpened(const DocumentsOpenedMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::documentsChanged(const DocumentsChangedMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::documentsClosed(const DocumentsClosedMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::requestCompletions(const RequestCompletionsMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::requestAnnotations(const RequestAnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::requestReferences(const RequestReferencesMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::requestFollowSymbol(const RequestFollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::requestToolTip(const RequestToolTipMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ClangCodeModelServerProxy::documentVisibilityChanged(
|
|
||||||
const DocumentVisibilityChangedMessage &message)
|
|
||||||
{
|
|
||||||
m_writeMessageBlock.write(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,68 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "baseserverproxy.h"
|
|
||||||
#include "clangcodemodelserverinterface.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
#include <QTimer>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QVariant;
|
|
||||||
class QLocalServer;
|
|
||||||
class QLocalSocket;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ClangCodeModelServerProxy : public BaseServerProxy,
|
|
||||||
public ClangCodeModelServerInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QLocalSocket *localSocket = {});
|
|
||||||
ClangCodeModelServerProxy(ClangCodeModelClientInterface *client, QIODevice *ioDevice);
|
|
||||||
|
|
||||||
void end() override;
|
|
||||||
|
|
||||||
void documentsOpened(const DocumentsOpenedMessage &message) override;
|
|
||||||
void documentsChanged(const DocumentsChangedMessage &message) override;
|
|
||||||
void documentsClosed(const DocumentsClosedMessage &message) override;
|
|
||||||
void documentVisibilityChanged(const DocumentVisibilityChangedMessage &message) override;
|
|
||||||
|
|
||||||
void unsavedFilesUpdated(const UnsavedFilesUpdatedMessage &message) override;
|
|
||||||
void unsavedFilesRemoved(const UnsavedFilesRemovedMessage &message) override;
|
|
||||||
|
|
||||||
void requestCompletions(const RequestCompletionsMessage &message) override;
|
|
||||||
void requestAnnotations(const RequestAnnotationsMessage &message) override;
|
|
||||||
void requestReferences(const RequestReferencesMessage &message) override;
|
|
||||||
void requestFollowSymbol(const RequestFollowSymbolMessage &message) override;
|
|
||||||
void requestToolTip(const RequestToolTipMessage &message) override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,27 +0,0 @@
|
|||||||
import qbs 1.0
|
|
||||||
|
|
||||||
QtcLibrary {
|
|
||||||
name: "ClangSupport"
|
|
||||||
targetName: "Clangbackendipc"
|
|
||||||
|
|
||||||
Depends { name: "Qt.network" }
|
|
||||||
Depends { name: "Utils" }
|
|
||||||
|
|
||||||
cpp.defines: base.concat("CLANGSUPPORT_LIBRARY")
|
|
||||||
cpp.includePaths: base.concat(".")
|
|
||||||
|
|
||||||
Group {
|
|
||||||
files: [
|
|
||||||
"*.h",
|
|
||||||
"*.cpp"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
|
|
||||||
Export {
|
|
||||||
Depends { name: "Utils" }
|
|
||||||
Depends { name: "Qt.network" }
|
|
||||||
cpp.includePaths: [
|
|
||||||
"."
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,228 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <utils/sizedarray.h>
|
|
||||||
|
|
||||||
#include <QtCore/qglobal.h>
|
|
||||||
|
|
||||||
#include <utils/smallstringfwd.h>
|
|
||||||
|
|
||||||
#if defined(CLANGSUPPORT_LIBRARY)
|
|
||||||
# define CLANGSUPPORT_EXPORT Q_DECL_EXPORT
|
|
||||||
#elif defined(CLANGSUPPORT_STATIC_LIBRARY)
|
|
||||||
# define CLANGSUPPORT_EXPORT
|
|
||||||
#else
|
|
||||||
# define CLANGSUPPORT_EXPORT Q_DECL_IMPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef Q_CC_GNU
|
|
||||||
# define CLANGSUPPORT_GCCEXPORT __attribute__((visibility("default")))
|
|
||||||
#else
|
|
||||||
# define CLANGSUPPORT_GCCEXPORT
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef CLANGBACKENDPROCESSPATH
|
|
||||||
# define CLANGBACKENDPROCESSPATH ""
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef UNIT_TESTS
|
|
||||||
#define unittest_public public
|
|
||||||
#else
|
|
||||||
#define unittest_public private
|
|
||||||
#endif
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
enum class DiagnosticSeverity : quint32 // one to one mapping of the clang enum numbers
|
|
||||||
{
|
|
||||||
Ignored = 0,
|
|
||||||
Note = 1,
|
|
||||||
Warning = 2,
|
|
||||||
Error = 3,
|
|
||||||
Fatal = 4
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class HighlightingType : quint8
|
|
||||||
{
|
|
||||||
Invalid,
|
|
||||||
Keyword,
|
|
||||||
StringLiteral,
|
|
||||||
NumberLiteral,
|
|
||||||
Comment,
|
|
||||||
Function,
|
|
||||||
VirtualFunction,
|
|
||||||
Type,
|
|
||||||
PrimitiveType,
|
|
||||||
LocalVariable,
|
|
||||||
Parameter,
|
|
||||||
Field,
|
|
||||||
GlobalVariable,
|
|
||||||
Enumeration,
|
|
||||||
Operator,
|
|
||||||
OverloadedOperator,
|
|
||||||
Preprocessor,
|
|
||||||
PreprocessorDefinition,
|
|
||||||
PreprocessorExpansion,
|
|
||||||
Punctuation,
|
|
||||||
Label,
|
|
||||||
Declaration,
|
|
||||||
FunctionDefinition,
|
|
||||||
OutputArgument,
|
|
||||||
Namespace,
|
|
||||||
Class,
|
|
||||||
Struct,
|
|
||||||
Enum,
|
|
||||||
Union,
|
|
||||||
TypeAlias,
|
|
||||||
Typedef,
|
|
||||||
QtProperty,
|
|
||||||
ObjectiveCClass,
|
|
||||||
ObjectiveCCategory,
|
|
||||||
ObjectiveCProtocol,
|
|
||||||
ObjectiveCInterface,
|
|
||||||
ObjectiveCImplementation,
|
|
||||||
ObjectiveCProperty,
|
|
||||||
ObjectiveCMethod,
|
|
||||||
TemplateTypeParameter,
|
|
||||||
TemplateTemplateParameter,
|
|
||||||
AngleBracketOpen,
|
|
||||||
AngleBracketClose,
|
|
||||||
DoubleAngleBracketClose, // clang parses ">>" as one token, even if it's closing a nested template
|
|
||||||
TernaryIf,
|
|
||||||
TernaryElse,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class StorageClass : quint8
|
|
||||||
{
|
|
||||||
Invalid,
|
|
||||||
None,
|
|
||||||
Extern,
|
|
||||||
Static,
|
|
||||||
PrivateExtern,
|
|
||||||
Auto,
|
|
||||||
Register
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class AccessSpecifier : quint8
|
|
||||||
{
|
|
||||||
Invalid,
|
|
||||||
Public,
|
|
||||||
Protected,
|
|
||||||
Private
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class CompletionCorrection : quint32
|
|
||||||
{
|
|
||||||
NoCorrection,
|
|
||||||
DotToArrowCorrection
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class MessageType : quint8 {
|
|
||||||
InvalidMessage,
|
|
||||||
AliveMessage,
|
|
||||||
EchoMessage,
|
|
||||||
EndMessage,
|
|
||||||
|
|
||||||
DocumentsOpenedMessage,
|
|
||||||
DocumentsChangedMessage,
|
|
||||||
DocumentsClosedMessage,
|
|
||||||
DocumentVisibilityChangedMessage,
|
|
||||||
|
|
||||||
UnsavedFilesUpdatedMessage,
|
|
||||||
UnsavedFilesRemovedMessage,
|
|
||||||
|
|
||||||
RequestAnnotationsMessage,
|
|
||||||
AnnotationsMessage,
|
|
||||||
|
|
||||||
RequestReferencesMessage,
|
|
||||||
ReferencesMessage,
|
|
||||||
|
|
||||||
RequestFollowSymbolMessage,
|
|
||||||
FollowSymbolMessage,
|
|
||||||
|
|
||||||
RequestToolTipMessage,
|
|
||||||
ToolTipMessage,
|
|
||||||
|
|
||||||
RequestCompletionsMessage,
|
|
||||||
CompletionsMessage,
|
|
||||||
};
|
|
||||||
|
|
||||||
template<MessageType messageEnumeration>
|
|
||||||
struct MessageTypeTrait;
|
|
||||||
|
|
||||||
template<class Message>
|
|
||||||
struct MessageTrait;
|
|
||||||
|
|
||||||
#define DECLARE_MESSAGE(Message) \
|
|
||||||
template<> \
|
|
||||||
struct MessageTrait<Message> \
|
|
||||||
{ \
|
|
||||||
static const MessageType enumeration = MessageType::Message; \
|
|
||||||
};
|
|
||||||
|
|
||||||
using MixinHighlightingTypes = Utils::SizedArray<HighlightingType, 6>;
|
|
||||||
|
|
||||||
struct HighlightingTypes {
|
|
||||||
HighlightingType mainHighlightingType = HighlightingType::Invalid;
|
|
||||||
MixinHighlightingTypes mixinHighlightingTypes;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class SourceLocationKind : uchar {
|
|
||||||
Definition = 1,
|
|
||||||
Declaration,
|
|
||||||
DeclarationReference,
|
|
||||||
MacroDefinition = 128,
|
|
||||||
MacroUndefinition,
|
|
||||||
MacroUsage,
|
|
||||||
None = 255,
|
|
||||||
};
|
|
||||||
|
|
||||||
enum class SymbolKind : uchar
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Enumeration,
|
|
||||||
Record,
|
|
||||||
Function,
|
|
||||||
Variable,
|
|
||||||
Macro
|
|
||||||
};
|
|
||||||
|
|
||||||
using SymbolKinds = Utils::SizedArray<SymbolKind, 8>;
|
|
||||||
|
|
||||||
enum class SymbolTag : uchar
|
|
||||||
{
|
|
||||||
None = 0,
|
|
||||||
Class,
|
|
||||||
Struct,
|
|
||||||
Union,
|
|
||||||
MsvcInterface
|
|
||||||
};
|
|
||||||
|
|
||||||
using SymbolTags = Utils::SizedArray<SymbolTag, 7>;
|
|
||||||
|
|
||||||
enum class ProgressType { Invalid, PrecompiledHeader, Indexing, DependencyCreation };
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,108 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "clangsupportdebugutils.h"
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
|
|
||||||
#include <QDir>
|
|
||||||
#include <QLoggingCategory>
|
|
||||||
#include <QString>
|
|
||||||
#include <QTemporaryDir>
|
|
||||||
#include <QTemporaryFile>
|
|
||||||
|
|
||||||
namespace {
|
|
||||||
|
|
||||||
static Q_LOGGING_CATEGORY(timersLog, "qtc.clangbackend.timers", QtWarningMsg);
|
|
||||||
|
|
||||||
class DebugInspectionDir : public QTemporaryDir
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DebugInspectionDir()
|
|
||||||
: QTemporaryDir(QDir::tempPath() + QLatin1String("/qtc-clangsupport-XXXXXX"))
|
|
||||||
{
|
|
||||||
setAutoRemove(false); // Keep around for later inspection.
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
class DebugInspectionFile : public QTemporaryFile
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DebugInspectionFile(const QString &directoryPath,
|
|
||||||
const Utf8String &id,
|
|
||||||
const Utf8String &fileContent)
|
|
||||||
: QTemporaryFile(directoryPath + QString::fromUtf8("/%1-XXXXXX").arg(id.toString()))
|
|
||||||
{
|
|
||||||
setAutoRemove(false); // Keep around for later inspection.
|
|
||||||
m_isValid = open() && write(fileContent.constData(), fileContent.byteSize());
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isValid() const
|
|
||||||
{
|
|
||||||
return m_isValid;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool m_isValid = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
Utf8String debugWriteFileForInspection(const Utf8String &fileContent, const Utf8String &id)
|
|
||||||
{
|
|
||||||
static DebugInspectionDir debugInspectionDir;
|
|
||||||
if (!debugInspectionDir.isValid())
|
|
||||||
return Utf8String();
|
|
||||||
|
|
||||||
DebugInspectionFile file(debugInspectionDir.path(), id, fileContent);
|
|
||||||
if (file.isValid())
|
|
||||||
return Utf8String::fromString(file.fileName());
|
|
||||||
return Utf8String();
|
|
||||||
}
|
|
||||||
|
|
||||||
Utf8String debugId(const FileContainer &fileContainer)
|
|
||||||
{
|
|
||||||
Utf8String id(Utf8StringLiteral("unsavedfilecontent-"));
|
|
||||||
id.append(QFileInfo(fileContainer.filePath).fileName());
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
VerboseScopeDurationTimer::VerboseScopeDurationTimer(const char *id)
|
|
||||||
: m_id(id)
|
|
||||||
{
|
|
||||||
if (timersLog().isDebugEnabled())
|
|
||||||
m_timer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
VerboseScopeDurationTimer::~VerboseScopeDurationTimer()
|
|
||||||
{
|
|
||||||
qCDebug(timersLog) << m_id << "needed" << m_timer.elapsed() << "ms";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,53 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include <QElapsedTimer>
|
|
||||||
|
|
||||||
class FileContainer;
|
|
||||||
class Utf8String;
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
Utf8String debugWriteFileForInspection(const Utf8String &fileContent, const Utf8String &id);
|
|
||||||
Utf8String debugId(const FileContainer &fileContainer);
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT VerboseScopeDurationTimer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
VerboseScopeDurationTimer(const char *id = nullptr);
|
|
||||||
~VerboseScopeDurationTimer();
|
|
||||||
|
|
||||||
private:
|
|
||||||
const char * const m_id;
|
|
||||||
QElapsedTimer m_timer;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
||||||
#define TIME_SCOPE_DURATION(id) ClangBackEnd::VerboseScopeDurationTimer scopeDurationTimer(id)
|
|
@@ -1,101 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "codecompletion.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
static const char *completionKindToString(CodeCompletion::Kind kind)
|
|
||||||
{
|
|
||||||
switch (kind) {
|
|
||||||
case CodeCompletion::Other: return "Other";
|
|
||||||
case CodeCompletion::FunctionCompletionKind: return "Function";
|
|
||||||
case CodeCompletion::FunctionDefinitionCompletionKind: return "FunctionDefinitionCompletion";
|
|
||||||
case CodeCompletion::TemplateFunctionCompletionKind: return "TemplateFunction";
|
|
||||||
case CodeCompletion::FunctionOverloadCompletionKind: return "FunctionOverload";
|
|
||||||
case CodeCompletion::ConstructorCompletionKind: return "Constructor";
|
|
||||||
case CodeCompletion::DestructorCompletionKind: return "Destructor";
|
|
||||||
case CodeCompletion::VariableCompletionKind: return "Variable";
|
|
||||||
case CodeCompletion::ClassCompletionKind: return "Class";
|
|
||||||
case CodeCompletion::TypeAliasCompletionKind: return "TypeAlias";
|
|
||||||
case CodeCompletion::TemplateClassCompletionKind: return "TemplateClass";
|
|
||||||
case CodeCompletion::EnumerationCompletionKind: return "Enumeration";
|
|
||||||
case CodeCompletion::EnumeratorCompletionKind: return "Enumerator";
|
|
||||||
case CodeCompletion::NamespaceCompletionKind: return "Namespace";
|
|
||||||
case CodeCompletion::PreProcessorCompletionKind: return "PreProcessor";
|
|
||||||
case CodeCompletion::SignalCompletionKind: return "Signal";
|
|
||||||
case CodeCompletion::SlotCompletionKind: return "Slot";
|
|
||||||
case CodeCompletion::ObjCMessageCompletionKind: return "ObjCMessage";
|
|
||||||
case CodeCompletion::KeywordCompletionKind: return "Keyword";
|
|
||||||
case CodeCompletion::ClangSnippetKind: return "ClangSnippet";
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
static const char *availabilityToString(CodeCompletion::Availability availability)
|
|
||||||
{
|
|
||||||
switch (availability) {
|
|
||||||
case CodeCompletion::Available: return "Available";
|
|
||||||
case CodeCompletion::Deprecated: return "Deprecated";
|
|
||||||
case CodeCompletion::NotAvailable: return "NotAvailable";
|
|
||||||
case CodeCompletion::NotAccessible: return "NotAccessible";
|
|
||||||
}
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const CodeCompletion &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "CodeCompletion(";
|
|
||||||
|
|
||||||
debug.nospace() << message.text << ", ";
|
|
||||||
debug.nospace() << message.priority << ", ";
|
|
||||||
debug.nospace() << completionKindToString(message.completionKind) << ", ";
|
|
||||||
debug.nospace() << availabilityToString(message.availability) << ", ";
|
|
||||||
if (!message.requiredFixIts.isEmpty())
|
|
||||||
debug.nospace() << message.requiredFixIts << ", ";
|
|
||||||
debug.nospace() << message.hasParameters;
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &os, const CodeCompletion::Kind kind)
|
|
||||||
{
|
|
||||||
return os << completionKindToString(kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &os, const CodeCompletion::Availability availability)
|
|
||||||
{
|
|
||||||
return os << availabilityToString(availability);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,147 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
#include "codecompletionchunk.h"
|
|
||||||
#include "fixitcontainer.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CodeCompletion;
|
|
||||||
using CodeCompletions = QVector<CodeCompletion>;
|
|
||||||
|
|
||||||
class CodeCompletion
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Kind : uint8_t {
|
|
||||||
Other = 0,
|
|
||||||
FunctionCompletionKind,
|
|
||||||
FunctionDefinitionCompletionKind,
|
|
||||||
FunctionOverloadCompletionKind,
|
|
||||||
TemplateFunctionCompletionKind,
|
|
||||||
ClassCompletionKind,
|
|
||||||
ConstructorCompletionKind,
|
|
||||||
DestructorCompletionKind,
|
|
||||||
VariableCompletionKind,
|
|
||||||
TypeAliasCompletionKind,
|
|
||||||
TemplateClassCompletionKind,
|
|
||||||
EnumerationCompletionKind,
|
|
||||||
EnumeratorCompletionKind,
|
|
||||||
NamespaceCompletionKind,
|
|
||||||
PreProcessorCompletionKind,
|
|
||||||
SignalCompletionKind,
|
|
||||||
SlotCompletionKind,
|
|
||||||
ObjCMessageCompletionKind,
|
|
||||||
KeywordCompletionKind,
|
|
||||||
ClangSnippetKind
|
|
||||||
};
|
|
||||||
|
|
||||||
enum Availability : quint32 {
|
|
||||||
Available,
|
|
||||||
Deprecated,
|
|
||||||
NotAvailable,
|
|
||||||
NotAccessible
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
CodeCompletion() = default;
|
|
||||||
CodeCompletion(const Utf8String &text,
|
|
||||||
quint32 priority = 0,
|
|
||||||
Kind completionKind = Other,
|
|
||||||
Availability availability = Available,
|
|
||||||
bool hasParameters = false)
|
|
||||||
: text(text),
|
|
||||||
priority(priority),
|
|
||||||
completionKind(completionKind),
|
|
||||||
availability(availability),
|
|
||||||
hasParameters(hasParameters)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const CodeCompletion &message)
|
|
||||||
{
|
|
||||||
out << message.text;
|
|
||||||
out << message.briefComment;
|
|
||||||
out << message.chunks;
|
|
||||||
out << message.requiredFixIts;
|
|
||||||
out << message.priority;
|
|
||||||
out << static_cast<quint32>(message.completionKind);
|
|
||||||
out << static_cast<quint32>(message.availability);
|
|
||||||
out << message.hasParameters;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, CodeCompletion &message)
|
|
||||||
{
|
|
||||||
quint32 completionKind;
|
|
||||||
quint32 availability;
|
|
||||||
|
|
||||||
in >> message.text;
|
|
||||||
in >> message.briefComment;
|
|
||||||
in >> message.chunks;
|
|
||||||
in >> message.requiredFixIts;
|
|
||||||
in >> message.priority;
|
|
||||||
in >> completionKind;
|
|
||||||
in >> availability;
|
|
||||||
in >> message.hasParameters;
|
|
||||||
|
|
||||||
message.completionKind = static_cast<CodeCompletion::Kind>(completionKind);
|
|
||||||
message.availability = static_cast<CodeCompletion::Availability>(availability);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const CodeCompletion &first, const CodeCompletion &second)
|
|
||||||
{
|
|
||||||
return first.text == second.text
|
|
||||||
&& first.completionKind == second.completionKind
|
|
||||||
&& first.requiredFixIts == second.requiredFixIts;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utf8String text;
|
|
||||||
Utf8String briefComment;
|
|
||||||
CodeCompletionChunks chunks;
|
|
||||||
QVector<FixItContainer> requiredFixIts;
|
|
||||||
quint32 priority = 0;
|
|
||||||
Kind completionKind = Other;
|
|
||||||
Availability availability = NotAvailable;
|
|
||||||
bool hasParameters = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CodeCompletion &message);
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, CodeCompletion::Kind kind);
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT std::ostream &operator<<(std::ostream &os, const CodeCompletion::Kind kind);
|
|
||||||
CLANGSUPPORT_EXPORT std::ostream &operator<<(std::ostream &os, const CodeCompletion::Availability availability);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,84 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "codecompletionchunk.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
static const char *completionChunkKindToString(CodeCompletionChunk::Kind kind)
|
|
||||||
{
|
|
||||||
switch (kind) {
|
|
||||||
case CodeCompletionChunk::Optional: return "Optional";
|
|
||||||
case CodeCompletionChunk::TypedText: return "TypedText";
|
|
||||||
case CodeCompletionChunk::Text: return "Text";
|
|
||||||
case CodeCompletionChunk::Placeholder: return "Placeholder";
|
|
||||||
case CodeCompletionChunk::Informative: return "Informative";
|
|
||||||
case CodeCompletionChunk::CurrentParameter: return "CurrentParameter";
|
|
||||||
case CodeCompletionChunk::LeftParen: return "LeftParen";
|
|
||||||
case CodeCompletionChunk::RightParen: return "RightParen";
|
|
||||||
case CodeCompletionChunk::LeftBracket: return "LeftBracket";
|
|
||||||
case CodeCompletionChunk::RightBracket: return "RightBracket";
|
|
||||||
case CodeCompletionChunk::LeftBrace: return "LeftBrace";
|
|
||||||
case CodeCompletionChunk::RightBrace: return "RightBrace";
|
|
||||||
case CodeCompletionChunk::LeftAngle: return "LeftAngle";
|
|
||||||
case CodeCompletionChunk::RightAngle: return "RightAngle";
|
|
||||||
case CodeCompletionChunk::Comma: return "Comma";
|
|
||||||
case CodeCompletionChunk::ResultType: return "ResultType";
|
|
||||||
case CodeCompletionChunk::Colon: return "Colon";
|
|
||||||
case CodeCompletionChunk::SemiColon: return "SemiColon";
|
|
||||||
case CodeCompletionChunk::Equal: return "Equal";
|
|
||||||
case CodeCompletionChunk::HorizontalSpace: return "HorizontalSpace";
|
|
||||||
case CodeCompletionChunk::VerticalSpace: return "VerticalSpace";
|
|
||||||
case CodeCompletionChunk::Invalid: return "Invalid";
|
|
||||||
}
|
|
||||||
|
|
||||||
return nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const CodeCompletionChunk &chunk)
|
|
||||||
{
|
|
||||||
debug.nospace() << "CodeCompletionChunk(";
|
|
||||||
debug.nospace() << completionChunkKindToString(chunk.kind) << ", ";
|
|
||||||
debug.nospace() << chunk.text;
|
|
||||||
|
|
||||||
if (chunk.isOptional)
|
|
||||||
debug.nospace() << ", optional";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream &operator<<(std::ostream &os, const CodeCompletionChunk::Kind &kind)
|
|
||||||
{
|
|
||||||
return os << completionChunkKindToString(kind);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,117 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CodeCompletionChunk;
|
|
||||||
using CodeCompletionChunks = QVector<CodeCompletionChunk>;
|
|
||||||
|
|
||||||
class CodeCompletionChunk
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Kind : quint8 {
|
|
||||||
Optional,
|
|
||||||
TypedText,
|
|
||||||
Text,
|
|
||||||
Placeholder,
|
|
||||||
Informative,
|
|
||||||
CurrentParameter,
|
|
||||||
LeftParen,
|
|
||||||
RightParen,
|
|
||||||
LeftBracket,
|
|
||||||
RightBracket,
|
|
||||||
LeftBrace,
|
|
||||||
RightBrace,
|
|
||||||
LeftAngle,
|
|
||||||
RightAngle,
|
|
||||||
Comma,
|
|
||||||
ResultType,
|
|
||||||
Colon,
|
|
||||||
SemiColon,
|
|
||||||
Equal,
|
|
||||||
HorizontalSpace,
|
|
||||||
VerticalSpace,
|
|
||||||
Invalid = 255
|
|
||||||
};
|
|
||||||
|
|
||||||
CodeCompletionChunk() = default;
|
|
||||||
CodeCompletionChunk(Kind kind,
|
|
||||||
const Utf8String &text,
|
|
||||||
bool isOptional = false)
|
|
||||||
: text(text),
|
|
||||||
kind(kind),
|
|
||||||
isOptional(isOptional)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const CodeCompletionChunk &chunk)
|
|
||||||
{
|
|
||||||
out << static_cast<quint8>(chunk.kind);
|
|
||||||
out << chunk.text;
|
|
||||||
out << chunk.isOptional;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, CodeCompletionChunk &chunk)
|
|
||||||
{
|
|
||||||
quint8 kind;
|
|
||||||
|
|
||||||
in >> kind;
|
|
||||||
in >> chunk.text;
|
|
||||||
in >> chunk.isOptional;
|
|
||||||
|
|
||||||
chunk.kind = static_cast<CodeCompletionChunk::Kind>(kind);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const CodeCompletionChunk &first, const CodeCompletionChunk &second)
|
|
||||||
{
|
|
||||||
return first.kind == second.kind
|
|
||||||
&& first.text == second.text
|
|
||||||
&& first.isOptional == second.isOptional;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utf8String text;
|
|
||||||
Kind kind = Invalid;
|
|
||||||
bool isOptional = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CodeCompletionChunk &chunk);
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT std::ostream &operator<<(std::ostream &os, const CodeCompletionChunk::Kind &kind);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,45 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "completionsmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const CompletionsMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "CompletionsMessage(";
|
|
||||||
|
|
||||||
debug.nospace() << message.codeCompletions << ", "
|
|
||||||
<< message.ticketNumber;
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,77 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "codecompletion.h"
|
|
||||||
|
|
||||||
#include <utf8stringvector.h>
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CompletionsMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
CompletionsMessage() = default;
|
|
||||||
CompletionsMessage(const CodeCompletions &codeCompletions,
|
|
||||||
quint64 ticketNumber)
|
|
||||||
: codeCompletions(codeCompletions)
|
|
||||||
, ticketNumber(ticketNumber)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const CompletionsMessage &message)
|
|
||||||
{
|
|
||||||
out << message.codeCompletions;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, CompletionsMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.codeCompletions;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const CompletionsMessage &first, const CompletionsMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.codeCompletions == second.codeCompletions;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
CodeCompletions codeCompletions;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const CompletionsMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(CompletionsMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,393 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "connectionclient.h"
|
|
||||||
|
|
||||||
#include "clangsupportdebugutils.h"
|
|
||||||
#include "processstartedevent.h"
|
|
||||||
#include "processexception.h"
|
|
||||||
|
|
||||||
#include <utils/hostosinfo.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QMetaMethod>
|
|
||||||
#include <QProcess>
|
|
||||||
#include <QThread>
|
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
ConnectionClient::ConnectionClient(const QString &connectionName)
|
|
||||||
: m_connectionName(connectionName)
|
|
||||||
{
|
|
||||||
m_processCreator.setObserver(this);
|
|
||||||
|
|
||||||
listenForConnections();
|
|
||||||
|
|
||||||
m_processAliveTimer.setInterval(10000);
|
|
||||||
resetTemporaryDirectory();
|
|
||||||
|
|
||||||
static const bool startAliveTimer = !qEnvironmentVariableIntValue("QTC_CLANG_NO_ALIVE_TIMER");
|
|
||||||
|
|
||||||
if (startAliveTimer)
|
|
||||||
connectAliveTimer();
|
|
||||||
|
|
||||||
connectNewConnection();
|
|
||||||
}
|
|
||||||
|
|
||||||
ConnectionClient::~ConnectionClient()
|
|
||||||
{
|
|
||||||
QLocalServer::removeServer(connectionName());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::startProcessAndConnectToServerAsynchronously()
|
|
||||||
{
|
|
||||||
m_processIsStarting = true;
|
|
||||||
|
|
||||||
m_processFuture = m_processCreator.createProcess();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::disconnectFromServer()
|
|
||||||
{
|
|
||||||
if (m_localSocket)
|
|
||||||
m_localSocket->disconnectFromServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectionClient::isConnected() const
|
|
||||||
{
|
|
||||||
return m_localSocket && m_localSocket->state() == QLocalSocket::ConnectedState;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::ensureMessageIsWritten()
|
|
||||||
{
|
|
||||||
while (isConnected() && m_localSocket->bytesToWrite() > 0)
|
|
||||||
m_localSocket->waitForBytesWritten(50);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::sendEndMessage()
|
|
||||||
{
|
|
||||||
sendEndCommand();
|
|
||||||
m_localSocket->flush();
|
|
||||||
ensureMessageIsWritten();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::resetProcessAliveTimer()
|
|
||||||
{
|
|
||||||
m_isAliveTimerResetted = true;
|
|
||||||
m_processAliveTimer.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::setProcessAliveTimerInterval(int processTimerInterval)
|
|
||||||
{
|
|
||||||
m_processAliveTimer.setInterval(processTimerInterval);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QTemporaryDir &ConnectionClient::temporaryDirectory() const
|
|
||||||
{
|
|
||||||
return m_processCreator.temporaryDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
LinePrefixer &ConnectionClient::stdErrPrefixer()
|
|
||||||
{
|
|
||||||
return m_stdErrPrefixer;
|
|
||||||
}
|
|
||||||
|
|
||||||
LinePrefixer &ConnectionClient::stdOutPrefixer()
|
|
||||||
{
|
|
||||||
return m_stdOutPrefixer;
|
|
||||||
}
|
|
||||||
|
|
||||||
QString ConnectionClient::connectionName() const
|
|
||||||
{
|
|
||||||
return m_connectionName;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectionClient::event(QEvent *event)
|
|
||||||
{
|
|
||||||
if (event->type() == int(ProcessStartedEvent::ProcessStarted)) {
|
|
||||||
getProcessFromFuture();
|
|
||||||
|
|
||||||
return true;
|
|
||||||
};
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::restartProcessAsynchronously()
|
|
||||||
{
|
|
||||||
getProcessFromFuture();
|
|
||||||
|
|
||||||
finishProcess(std::move(m_process));
|
|
||||||
resetTemporaryDirectory(); // clear left-over preambles
|
|
||||||
|
|
||||||
startProcessAndConnectToServerAsynchronously();
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::restartProcessIfTimerIsNotResettedAndSocketIsEmpty()
|
|
||||||
{
|
|
||||||
if (m_isAliveTimerResetted) {
|
|
||||||
m_isAliveTimerResetted = false;
|
|
||||||
return; // Already reset, but we were scheduled after.
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!m_localSocket || m_localSocket->bytesAvailable() > 0)
|
|
||||||
return; // We come first, the incoming data was not yet processed.
|
|
||||||
|
|
||||||
disconnectLocalSocketDisconnected();
|
|
||||||
disconnectFromServer();
|
|
||||||
restartProcessAsynchronously();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::endProcess(QtcProcess *process)
|
|
||||||
{
|
|
||||||
if (isProcessRunning(process) && isConnected()) {
|
|
||||||
sendEndMessage();
|
|
||||||
process->waitForFinished();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::terminateProcess(QtcProcess *process)
|
|
||||||
{
|
|
||||||
if (!HostOsInfo::isWindowsHost() && isProcessRunning()) {
|
|
||||||
process->terminate();
|
|
||||||
process->waitForFinished(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::killProcess(QtcProcess *process)
|
|
||||||
{
|
|
||||||
if (isProcessRunning(process)) {
|
|
||||||
process->kill();
|
|
||||||
process->waitForFinished(1000);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::finishConnection()
|
|
||||||
{
|
|
||||||
if (m_localSocket) {
|
|
||||||
if (m_localSocket->state() != QLocalSocket::UnconnectedState)
|
|
||||||
m_localSocket->disconnectFromServer();
|
|
||||||
m_localSocket = nullptr;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::printLocalSocketError(QLocalSocket::LocalSocketError socketError)
|
|
||||||
{
|
|
||||||
if (m_localSocket && socketError != QLocalSocket::ServerNotFoundError)
|
|
||||||
qWarning() << outputName() << "LocalSocket Error:" << m_localSocket->errorString();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::printStandardOutput()
|
|
||||||
{
|
|
||||||
qDebug("%s", m_stdOutPrefixer.prefix(m_process->readAllStandardOutput()).constData());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::printStandardError()
|
|
||||||
{
|
|
||||||
qDebug("%s", m_stdErrPrefixer.prefix(m_process->readAllStandardError()).constData());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::resetTemporaryDirectory()
|
|
||||||
{
|
|
||||||
m_processCreator.resetTemporaryDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::initializeProcess(QtcProcess *process)
|
|
||||||
{
|
|
||||||
connectStandardOutputAndError(process);
|
|
||||||
|
|
||||||
resetProcessAliveTimer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::connectLocalSocketDisconnected()
|
|
||||||
{
|
|
||||||
connect(m_localSocket,
|
|
||||||
&QLocalSocket::disconnected,
|
|
||||||
this,
|
|
||||||
&ConnectionClient::disconnectedFromLocalSocket);
|
|
||||||
connect(m_localSocket,
|
|
||||||
&QLocalSocket::disconnected,
|
|
||||||
this,
|
|
||||||
&ConnectionClient::restartProcessAsynchronously);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::disconnectLocalSocketDisconnected()
|
|
||||||
{
|
|
||||||
if (m_localSocket) {
|
|
||||||
disconnect(m_localSocket,
|
|
||||||
&QLocalSocket::disconnected,
|
|
||||||
this,
|
|
||||||
&ConnectionClient::restartProcessAsynchronously);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::finishProcess()
|
|
||||||
{
|
|
||||||
finishProcess(std::move(m_process));
|
|
||||||
emit processFinished();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectionClient::isProcessRunning()
|
|
||||||
{
|
|
||||||
getProcessFromFuture();
|
|
||||||
|
|
||||||
return isProcessRunning(m_process.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::finishProcess(QProcessUniquePointer &&process)
|
|
||||||
{
|
|
||||||
disconnectLocalSocketDisconnected();
|
|
||||||
|
|
||||||
if (process) {
|
|
||||||
m_processAliveTimer.stop();
|
|
||||||
|
|
||||||
endProcess(process.get());
|
|
||||||
finishConnection();
|
|
||||||
terminateProcess(process.get());
|
|
||||||
killProcess(process.get());
|
|
||||||
|
|
||||||
resetState();
|
|
||||||
} else {
|
|
||||||
finishConnection();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectionClient::waitForEcho()
|
|
||||||
{
|
|
||||||
return m_localSocket->waitForReadyRead();
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectionClient::waitForConnected()
|
|
||||||
{
|
|
||||||
bool isConnected = false;
|
|
||||||
|
|
||||||
for (int counter = 0; counter < 100; counter++) {
|
|
||||||
isConnected = m_localSocket && m_localSocket->waitForConnected(20);
|
|
||||||
if (isConnected)
|
|
||||||
return isConnected;
|
|
||||||
else {
|
|
||||||
QThread::msleep(30);
|
|
||||||
QCoreApplication::processEvents();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (m_localSocket)
|
|
||||||
qWarning() << outputName() << "cannot connect:" << m_localSocket->errorString();
|
|
||||||
|
|
||||||
return isConnected;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
QtcProcess *ConnectionClient::processForTestOnly()
|
|
||||||
{
|
|
||||||
getProcessFromFuture();
|
|
||||||
|
|
||||||
return m_process.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
QIODevice *ConnectionClient::ioDevice()
|
|
||||||
{
|
|
||||||
return m_localSocket;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ConnectionClient::isProcessRunning(QtcProcess *process)
|
|
||||||
{
|
|
||||||
return process && process->state() == QProcess::Running;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::connectStandardOutputAndError(QtcProcess *process) const
|
|
||||||
{
|
|
||||||
connect(process, &QtcProcess::readyReadStandardOutput, this, &ConnectionClient::printStandardOutput);
|
|
||||||
connect(process, &QtcProcess::readyReadStandardError, this, &ConnectionClient::printStandardError);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::connectLocalSocketError() const
|
|
||||||
{
|
|
||||||
connect(m_localSocket,
|
|
||||||
&QLocalSocket::errorOccurred,
|
|
||||||
this,
|
|
||||||
&ConnectionClient::printLocalSocketError);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::connectAliveTimer()
|
|
||||||
{
|
|
||||||
connect(&m_processAliveTimer,
|
|
||||||
&QTimer::timeout,
|
|
||||||
this,
|
|
||||||
&ConnectionClient::restartProcessIfTimerIsNotResettedAndSocketIsEmpty);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::connectNewConnection()
|
|
||||||
{
|
|
||||||
QObject::connect(&m_localServer,
|
|
||||||
&QLocalServer::newConnection,
|
|
||||||
this,
|
|
||||||
&ConnectionClient::handleNewConnection);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::handleNewConnection()
|
|
||||||
{
|
|
||||||
m_localSocket = m_localServer.nextPendingConnection();
|
|
||||||
|
|
||||||
connectLocalSocketError();
|
|
||||||
connectLocalSocketDisconnected();
|
|
||||||
|
|
||||||
newConnectedServer(m_localSocket);
|
|
||||||
|
|
||||||
emit connectedToLocalSocket();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::getProcessFromFuture()
|
|
||||||
{
|
|
||||||
try {
|
|
||||||
if (m_processFuture.valid()) {
|
|
||||||
m_process = m_processFuture.get();
|
|
||||||
m_processIsStarting = false;
|
|
||||||
|
|
||||||
initializeProcess(m_process.get());
|
|
||||||
}
|
|
||||||
} catch (const ProcessException &processExeption) {
|
|
||||||
qWarning() << "Clang backend process is not working."
|
|
||||||
<< QLatin1String(processExeption.what());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::listenForConnections()
|
|
||||||
{
|
|
||||||
bool isListing = m_localServer.listen(connectionName());
|
|
||||||
|
|
||||||
if (!isListing)
|
|
||||||
qWarning() << "ConnectionClient: QLocalServer is not listing for connections!";
|
|
||||||
}
|
|
||||||
|
|
||||||
void ConnectionClient::setProcessPath(const QString &processPath)
|
|
||||||
{
|
|
||||||
m_processCreator.setProcessPath(processPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,146 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangcodemodelserverproxy.h"
|
|
||||||
#include "lineprefixer.h"
|
|
||||||
#include "processcreator.h"
|
|
||||||
#include "processhandle.h"
|
|
||||||
|
|
||||||
#include <QLocalServer>
|
|
||||||
#include <QLocalSocket>
|
|
||||||
#include <QScopedPointer>
|
|
||||||
#include <QTemporaryDir>
|
|
||||||
|
|
||||||
#include <future>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace Utils { class QtcProcess; }
|
|
||||||
|
|
||||||
class Utf8String;
|
|
||||||
class Utf8StringVector;
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class FileContainer;
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ConnectionClient : public QObject
|
|
||||||
{
|
|
||||||
Q_OBJECT
|
|
||||||
|
|
||||||
public:
|
|
||||||
ConnectionClient(const QString &connectionName);
|
|
||||||
|
|
||||||
ConnectionClient(const ConnectionClient &) = delete;
|
|
||||||
ConnectionClient &operator=(const ConnectionClient &) = delete;
|
|
||||||
|
|
||||||
void startProcessAndConnectToServerAsynchronously();
|
|
||||||
void disconnectFromServer();
|
|
||||||
bool isConnected() const;
|
|
||||||
|
|
||||||
void sendEndMessage();
|
|
||||||
|
|
||||||
void resetProcessAliveTimer();
|
|
||||||
void setProcessAliveTimerInterval(int processTimerInterval);
|
|
||||||
|
|
||||||
void setProcessPath(const QString &processPath);
|
|
||||||
|
|
||||||
void restartProcessAsynchronously();
|
|
||||||
void restartProcessIfTimerIsNotResettedAndSocketIsEmpty();
|
|
||||||
void finishProcess();
|
|
||||||
bool isProcessRunning();
|
|
||||||
|
|
||||||
bool waitForEcho();
|
|
||||||
bool waitForConnected();
|
|
||||||
|
|
||||||
Utils::QtcProcess *processForTestOnly();
|
|
||||||
|
|
||||||
signals:
|
|
||||||
void connectedToLocalSocket();
|
|
||||||
void disconnectedFromLocalSocket();
|
|
||||||
void processFinished();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
~ConnectionClient();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
QIODevice *ioDevice();
|
|
||||||
const QTemporaryDir &temporaryDirectory() const;
|
|
||||||
LinePrefixer &stdErrPrefixer();
|
|
||||||
LinePrefixer &stdOutPrefixer();
|
|
||||||
|
|
||||||
virtual void sendEndCommand() = 0;
|
|
||||||
virtual void resetState() = 0;
|
|
||||||
virtual QString outputName() const = 0;
|
|
||||||
|
|
||||||
QString connectionName() const;
|
|
||||||
bool event(QEvent* event) override;
|
|
||||||
|
|
||||||
virtual void newConnectedServer(QLocalSocket *localSocket) = 0;
|
|
||||||
|
|
||||||
private:
|
|
||||||
static bool isProcessRunning(Utils::QtcProcess *process);
|
|
||||||
void finishProcess(QProcessUniquePointer &&process);
|
|
||||||
void endProcess(Utils::QtcProcess *process);
|
|
||||||
void terminateProcess(Utils::QtcProcess *process);
|
|
||||||
void killProcess(Utils::QtcProcess *process);
|
|
||||||
void finishConnection();
|
|
||||||
void printLocalSocketError(QLocalSocket::LocalSocketError socketError);
|
|
||||||
void printStandardOutput();
|
|
||||||
void printStandardError();
|
|
||||||
void initializeProcess(Utils::QtcProcess *process);
|
|
||||||
|
|
||||||
void resetTemporaryDirectory();
|
|
||||||
|
|
||||||
void connectLocalSocketDisconnected();
|
|
||||||
void disconnectLocalSocketDisconnected();
|
|
||||||
void connectStandardOutputAndError(Utils::QtcProcess *process) const;
|
|
||||||
void connectLocalSocketError() const;
|
|
||||||
void connectAliveTimer();
|
|
||||||
void connectNewConnection();
|
|
||||||
void handleNewConnection();
|
|
||||||
void getProcessFromFuture();
|
|
||||||
void listenForConnections();
|
|
||||||
|
|
||||||
void ensureMessageIsWritten();
|
|
||||||
|
|
||||||
protected:
|
|
||||||
ProcessCreator m_processCreator;
|
|
||||||
|
|
||||||
private:
|
|
||||||
LinePrefixer m_stdErrPrefixer;
|
|
||||||
LinePrefixer m_stdOutPrefixer;
|
|
||||||
QLocalServer m_localServer;
|
|
||||||
std::future<QProcessUniquePointer> m_processFuture;
|
|
||||||
mutable QProcessUniquePointer m_process;
|
|
||||||
QLocalSocket *m_localSocket = nullptr;
|
|
||||||
QTimer m_processAliveTimer;
|
|
||||||
QString m_connectionName;
|
|
||||||
bool m_isAliveTimerResetted = false;
|
|
||||||
bool m_processIsStarting = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,31 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "connectionserver.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,142 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QLocalServer>
|
|
||||||
#include <QLocalSocket>
|
|
||||||
#include <QTimer>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <cstdlib>
|
|
||||||
#include <memory>
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class ClangCodeModelServerInterface;
|
|
||||||
class ClangCodeModelClientProxy;
|
|
||||||
|
|
||||||
template <typename ServerInterface,
|
|
||||||
typename ClientProxy>
|
|
||||||
class ConnectionServer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ConnectionServer()
|
|
||||||
{
|
|
||||||
m_aliveTimer.start(5000);
|
|
||||||
|
|
||||||
connectAliveTimer();
|
|
||||||
connectLocalSocketDisconnet();
|
|
||||||
}
|
|
||||||
|
|
||||||
~ConnectionServer()
|
|
||||||
{
|
|
||||||
if (m_localSocket.state() != QLocalSocket::UnconnectedState)
|
|
||||||
m_localSocket.disconnectFromServer();
|
|
||||||
}
|
|
||||||
|
|
||||||
void start(const QString &connectionName)
|
|
||||||
{
|
|
||||||
connectToLocalServer(connectionName);
|
|
||||||
}
|
|
||||||
|
|
||||||
void setServer(ServerInterface *ipcServer)
|
|
||||||
{
|
|
||||||
this->m_ipcServer = ipcServer;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
void ensureAliveMessageIsSent()
|
|
||||||
{
|
|
||||||
if (m_aliveTimer.remainingTime() == 0)
|
|
||||||
sendAliveMessage();
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
void connectToLocalServer(const QString &connectionName)
|
|
||||||
{
|
|
||||||
QObject::connect(&m_localSocket,
|
|
||||||
&QLocalSocket::errorOccurred,
|
|
||||||
[&] (QLocalSocket::LocalSocketError) {
|
|
||||||
qWarning() << "ConnectionServer error:" << m_localSocket.errorString() << connectionName;
|
|
||||||
});
|
|
||||||
|
|
||||||
m_localSocket.connectToServer(connectionName);
|
|
||||||
m_ipcClientProxy = std::make_unique<ClientProxy>(m_ipcServer, &m_localSocket);
|
|
||||||
|
|
||||||
m_ipcServer->setClient(m_ipcClientProxy.get());
|
|
||||||
}
|
|
||||||
|
|
||||||
void sendAliveMessage()
|
|
||||||
{
|
|
||||||
if (m_ipcClientProxy)
|
|
||||||
m_ipcClientProxy->alive();
|
|
||||||
}
|
|
||||||
|
|
||||||
void handleSocketDisconnect()
|
|
||||||
{
|
|
||||||
m_ipcClientProxy.reset();
|
|
||||||
|
|
||||||
delayedExitApplicationIfNoSockedIsConnected();
|
|
||||||
}
|
|
||||||
|
|
||||||
void delayedExitApplicationIfNoSockedIsConnected()
|
|
||||||
{
|
|
||||||
QTimer::singleShot(60000, [&] { exitApplicationIfNoSockedIsConnected(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void exitApplicationIfNoSockedIsConnected()
|
|
||||||
{
|
|
||||||
if (m_localSocket.state() != QLocalSocket::UnconnectedState)
|
|
||||||
m_localSocket.disconnectFromServer();
|
|
||||||
QCoreApplication::exit();
|
|
||||||
}
|
|
||||||
|
|
||||||
void connectAliveTimer()
|
|
||||||
{
|
|
||||||
QObject::connect(&m_aliveTimer,
|
|
||||||
&QTimer::timeout,
|
|
||||||
[&] { sendAliveMessage(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
void connectLocalSocketDisconnet()
|
|
||||||
{
|
|
||||||
QObject::connect(&m_localSocket,
|
|
||||||
&QLocalSocket::disconnected,
|
|
||||||
[&] { handleSocketDisconnect(); });
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
QLocalSocket m_localSocket;
|
|
||||||
QTimer m_aliveTimer;
|
|
||||||
std::unique_ptr<ClientProxy> m_ipcClientProxy;
|
|
||||||
ServerInterface *m_ipcServer = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,63 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "diagnosticcontainer.h"
|
|
||||||
|
|
||||||
#include <utf8stringvector.h>
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const DiagnosticContainer &container)
|
|
||||||
{
|
|
||||||
debug.nospace() << "DiagnosticContainer("
|
|
||||||
<< container.text << ", "
|
|
||||||
<< container.category << ", "
|
|
||||||
<< container.enableOption << ", "
|
|
||||||
<< container.disableOption << ", "
|
|
||||||
<< container.location << ", "
|
|
||||||
<< container.ranges << ", "
|
|
||||||
<< container.fixIts << ", "
|
|
||||||
<< container.children
|
|
||||||
<< ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const QVector<DiagnosticContainer> &containers)
|
|
||||||
{
|
|
||||||
debug.nospace() << "{";
|
|
||||||
for (int i = 0; i < containers.size(); i++) {
|
|
||||||
debug.nospace() << containers[i];
|
|
||||||
if (i < containers.size() - 1)
|
|
||||||
debug.nospace() << ", ";
|
|
||||||
}
|
|
||||||
debug.nospace() << "}";
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,130 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "sourcerangecontainer.h"
|
|
||||||
#include "fixitcontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
#include <utility>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class DiagnosticContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DiagnosticContainer() = default;
|
|
||||||
DiagnosticContainer(const Utf8String &text,
|
|
||||||
const Utf8String &category,
|
|
||||||
const std::pair<Utf8String,Utf8String> &options,
|
|
||||||
DiagnosticSeverity severity,
|
|
||||||
const SourceLocationContainer &location,
|
|
||||||
const QVector<SourceRangeContainer> &ranges,
|
|
||||||
const QVector<FixItContainer> &fixIts,
|
|
||||||
const QVector<DiagnosticContainer> &children)
|
|
||||||
: location(location),
|
|
||||||
ranges(ranges),
|
|
||||||
text(text),
|
|
||||||
category(category),
|
|
||||||
enableOption(options.first),
|
|
||||||
disableOption(options.second),
|
|
||||||
children(children),
|
|
||||||
fixIts(fixIts),
|
|
||||||
severity(severity)
|
|
||||||
{
|
|
||||||
for (auto it = this->children.begin(); it != this->children.end(); ++it) {
|
|
||||||
if (it->text == "note: remove constant to silence this warning") {
|
|
||||||
this->children.erase(it);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DiagnosticContainer &container)
|
|
||||||
{
|
|
||||||
out << container.text;
|
|
||||||
out << container.category;
|
|
||||||
out << container.enableOption;
|
|
||||||
out << container.disableOption;
|
|
||||||
out << container.location;
|
|
||||||
out << static_cast<quint32>(container.severity);
|
|
||||||
out << container.ranges;
|
|
||||||
out << container.fixIts;
|
|
||||||
out << container.children;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DiagnosticContainer &container)
|
|
||||||
{
|
|
||||||
quint32 severity;
|
|
||||||
|
|
||||||
in >> container.text;
|
|
||||||
in >> container.category;
|
|
||||||
in >> container.enableOption;
|
|
||||||
in >> container.disableOption;
|
|
||||||
in >> container.location;
|
|
||||||
in >> severity;
|
|
||||||
in >> container.ranges;
|
|
||||||
in >> container.fixIts;
|
|
||||||
in >> container.children;
|
|
||||||
|
|
||||||
container.severity = static_cast<DiagnosticSeverity>(severity);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const DiagnosticContainer &first, const DiagnosticContainer &second)
|
|
||||||
{
|
|
||||||
return first.text == second.text
|
|
||||||
&& first.location == second.location;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator!=(const DiagnosticContainer &first, const DiagnosticContainer &second)
|
|
||||||
{
|
|
||||||
return !(first == second);
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
SourceLocationContainer location;
|
|
||||||
QVector<SourceRangeContainer> ranges;
|
|
||||||
Utf8String text;
|
|
||||||
Utf8String category;
|
|
||||||
Utf8String enableOption;
|
|
||||||
Utf8String disableOption;
|
|
||||||
QVector<DiagnosticContainer> children;
|
|
||||||
QVector<FixItContainer> fixIts;
|
|
||||||
DiagnosticSeverity severity = DiagnosticSeverity::Ignored;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DiagnosticContainer &container);
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QVector<DiagnosticContainer> &container);
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,45 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "documentschangedmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const DocumentsChangedMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "DocumentsChangedMessage(";
|
|
||||||
|
|
||||||
for (const FileContainer &fileContainer : message.fileContainers)
|
|
||||||
debug.nospace() << fileContainer<< ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,70 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class DocumentsChangedMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DocumentsChangedMessage() = default;
|
|
||||||
DocumentsChangedMessage(const QVector<FileContainer> &fileContainers)
|
|
||||||
: fileContainers(fileContainers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DocumentsChangedMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainers;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DocumentsChangedMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainers;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const DocumentsChangedMessage &first,
|
|
||||||
const DocumentsChangedMessage &second)
|
|
||||||
{
|
|
||||||
return first.fileContainers == second.fileContainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
QVector<FileContainer> fileContainers;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsChangedMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(DocumentsChangedMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,45 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "documentsclosedmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const DocumentsClosedMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "DocumentsClosedMessage(";
|
|
||||||
|
|
||||||
for (const FileContainer &fileContainer : message.fileContainers)
|
|
||||||
debug.nospace() << fileContainer << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,71 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class DocumentsClosedMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DocumentsClosedMessage() = default;
|
|
||||||
DocumentsClosedMessage(const QVector<FileContainer> &fileContainers)
|
|
||||||
: fileContainers(fileContainers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DocumentsClosedMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainers;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DocumentsClosedMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainers;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const DocumentsClosedMessage &first, const DocumentsClosedMessage &second)
|
|
||||||
{
|
|
||||||
return first.fileContainers == second.fileContainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
QVector<FileContainer> fileContainers;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsClosedMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(DocumentsClosedMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,50 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "documentsopenedmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const DocumentsOpenedMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "DocumentsOpenedMessage(";
|
|
||||||
|
|
||||||
for (const FileContainer &fileContainer : message.fileContainers)
|
|
||||||
debug.nospace() << fileContainer<< ", ";
|
|
||||||
|
|
||||||
debug.nospace() << message.currentEditorFilePath << ", ";
|
|
||||||
|
|
||||||
for (const Utf8String &visibleEditorFilePath : message.visibleEditorFilePaths)
|
|
||||||
debug.nospace() << visibleEditorFilePath << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,81 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class DocumentsOpenedMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DocumentsOpenedMessage() = default;
|
|
||||||
DocumentsOpenedMessage(const QVector<FileContainer> &fileContainers,
|
|
||||||
const Utf8String ¤tEditorFilePath,
|
|
||||||
const Utf8StringVector &visibleEditorFilePaths)
|
|
||||||
: fileContainers(fileContainers)
|
|
||||||
, currentEditorFilePath(currentEditorFilePath)
|
|
||||||
, visibleEditorFilePaths(visibleEditorFilePaths)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DocumentsOpenedMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainers;
|
|
||||||
out << message.currentEditorFilePath;
|
|
||||||
out << message.visibleEditorFilePaths;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DocumentsOpenedMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainers;
|
|
||||||
in >> message.currentEditorFilePath;
|
|
||||||
in >> message.visibleEditorFilePaths;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const DocumentsOpenedMessage &first, const DocumentsOpenedMessage &second)
|
|
||||||
{
|
|
||||||
return first.fileContainers == second.fileContainers
|
|
||||||
&& first.currentEditorFilePath == second.currentEditorFilePath
|
|
||||||
&& first.visibleEditorFilePaths == second.visibleEditorFilePaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
QVector<FileContainer> fileContainers;
|
|
||||||
Utf8String currentEditorFilePath;
|
|
||||||
Utf8StringVector visibleEditorFilePaths;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentsOpenedMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(DocumentsOpenedMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,46 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "documentvisibilitychangedmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const DocumentVisibilityChangedMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "DocumentVisibilityChangedMessage(";
|
|
||||||
|
|
||||||
debug.nospace() << message.currentEditorFilePath << ", ";
|
|
||||||
|
|
||||||
for (const Utf8String &visibleEditorFilePath : message.visibleEditorFilePaths)
|
|
||||||
debug.nospace() << visibleEditorFilePath << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,78 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include <utf8stringvector.h>
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class DocumentVisibilityChangedMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
DocumentVisibilityChangedMessage() = default;
|
|
||||||
DocumentVisibilityChangedMessage(const Utf8String ¤tEditorFilePath,
|
|
||||||
const Utf8StringVector &visibleEditorFilePaths)
|
|
||||||
: currentEditorFilePath(currentEditorFilePath)
|
|
||||||
, visibleEditorFilePaths(visibleEditorFilePaths)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const DocumentVisibilityChangedMessage &message)
|
|
||||||
{
|
|
||||||
out << message.currentEditorFilePath;
|
|
||||||
out << message.visibleEditorFilePaths;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, DocumentVisibilityChangedMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.currentEditorFilePath;
|
|
||||||
in >> message.visibleEditorFilePaths;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const DocumentVisibilityChangedMessage &first,
|
|
||||||
const DocumentVisibilityChangedMessage &second)
|
|
||||||
{
|
|
||||||
return first.currentEditorFilePath == second.currentEditorFilePath
|
|
||||||
&& first.visibleEditorFilePaths == second.visibleEditorFilePaths;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utf8String currentEditorFilePath;
|
|
||||||
Utf8StringVector visibleEditorFilePaths;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const DocumentVisibilityChangedMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(DocumentVisibilityChangedMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,38 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "echomessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const EchoMessage &)
|
|
||||||
{
|
|
||||||
return debug.nospace() << "EchoMessage()";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,69 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "messageenvelop.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class EchoMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
EchoMessage() = default;
|
|
||||||
explicit EchoMessage(const MessageEnvelop &message)
|
|
||||||
: message(message)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const EchoMessage &message)
|
|
||||||
{
|
|
||||||
out << message.message;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, EchoMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.message;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const EchoMessage &first, const EchoMessage &second)
|
|
||||||
{
|
|
||||||
return first.message == second.message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
MessageEnvelop message;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const EchoMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(EchoMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,37 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "endmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const EndMessage &/*message*/)
|
|
||||||
{
|
|
||||||
return debug.nospace() << "EndMessage()";
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,56 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class EndMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const EndMessage &/*message*/)
|
|
||||||
{
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, EndMessage &/*message*/)
|
|
||||||
{
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const EndMessage &/*first*/, const EndMessage &/*second*/)
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const EndMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(EndMessage)
|
|
||||||
}
|
|
@@ -1,57 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include "clangsupportdebugutils.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const FileContainer &container)
|
|
||||||
{
|
|
||||||
debug.nospace() << "FileContainer("
|
|
||||||
<< container.filePath << ", "
|
|
||||||
<< container.compilationArguments << ", "
|
|
||||||
<< container.headerPaths << ", "
|
|
||||||
<< container.documentRevision << ", "
|
|
||||||
<< container.textCodecName;
|
|
||||||
|
|
||||||
if (container.hasUnsavedFileContent) {
|
|
||||||
const Utf8String fileWithContent = debugWriteFileForInspection(
|
|
||||||
container.unsavedFileContent,
|
|
||||||
debugId(container));
|
|
||||||
debug.nospace() << ", "
|
|
||||||
<< "<" << fileWithContent << ">";
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,124 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
#include <utf8stringvector.h>
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class FileContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FileContainer() = default;
|
|
||||||
FileContainer(const Utf8String &filePath,
|
|
||||||
const Utf8String &unsavedFileContent = Utf8String(),
|
|
||||||
bool hasUnsavedFileContent = false,
|
|
||||||
quint32 documentRevision = 0,
|
|
||||||
const Utf8String &textCodecName = Utf8String())
|
|
||||||
: filePath(filePath),
|
|
||||||
unsavedFileContent(unsavedFileContent),
|
|
||||||
textCodecName(textCodecName),
|
|
||||||
documentRevision(documentRevision),
|
|
||||||
hasUnsavedFileContent(hasUnsavedFileContent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
FileContainer(const Utf8String &filePath,
|
|
||||||
const Utf8StringVector &compilationArguments,
|
|
||||||
const Utf8StringVector &headerPaths,
|
|
||||||
const Utf8String &unsavedFileContent = Utf8String(),
|
|
||||||
bool hasUnsavedFileContent = false,
|
|
||||||
quint32 documentRevision = 0)
|
|
||||||
: filePath(filePath),
|
|
||||||
compilationArguments(compilationArguments),
|
|
||||||
headerPaths(headerPaths),
|
|
||||||
unsavedFileContent(unsavedFileContent),
|
|
||||||
documentRevision(documentRevision),
|
|
||||||
hasUnsavedFileContent(hasUnsavedFileContent)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
FileContainer(const Utf8String &filePath,
|
|
||||||
const Utf8StringVector &compilationArguments,
|
|
||||||
const Utf8StringVector &headerPaths,
|
|
||||||
quint32 documentRevision)
|
|
||||||
: filePath(filePath),
|
|
||||||
compilationArguments(compilationArguments),
|
|
||||||
headerPaths(headerPaths),
|
|
||||||
documentRevision(documentRevision),
|
|
||||||
hasUnsavedFileContent(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const FileContainer &container)
|
|
||||||
{
|
|
||||||
out << container.filePath;
|
|
||||||
out << container.compilationArguments;
|
|
||||||
out << container.headerPaths;
|
|
||||||
out << container.unsavedFileContent;
|
|
||||||
out << container.textCodecName;
|
|
||||||
out << container.documentRevision;
|
|
||||||
out << container.hasUnsavedFileContent;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, FileContainer &container)
|
|
||||||
{
|
|
||||||
in >> container.filePath;
|
|
||||||
in >> container.compilationArguments;
|
|
||||||
in >> container.headerPaths;
|
|
||||||
in >> container.unsavedFileContent;
|
|
||||||
in >> container.textCodecName;
|
|
||||||
in >> container.documentRevision;
|
|
||||||
in >> container.hasUnsavedFileContent;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const FileContainer &first, const FileContainer &second)
|
|
||||||
{
|
|
||||||
return first.filePath == second.filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FileContainer &container);
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utf8String filePath;
|
|
||||||
Utf8StringVector compilationArguments;
|
|
||||||
Utf8StringVector headerPaths;
|
|
||||||
Utf8String unsavedFileContent;
|
|
||||||
Utf8String textCodecName;
|
|
||||||
quint32 documentRevision = 0;
|
|
||||||
bool hasUnsavedFileContent = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,55 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "fixitcontainer.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const FixItContainer &container)
|
|
||||||
{
|
|
||||||
debug.nospace() << "FixItContainer("
|
|
||||||
<< container.text << ", "
|
|
||||||
<< container.range
|
|
||||||
<< ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const QVector<FixItContainer> &containers)
|
|
||||||
{
|
|
||||||
debug.nospace() << "{";
|
|
||||||
for (int i = 0; i < containers.size(); i++) {
|
|
||||||
debug.nospace() << containers[i];
|
|
||||||
if (i < containers.size() - 1)
|
|
||||||
debug.nospace() << ", ";
|
|
||||||
}
|
|
||||||
debug.nospace() << "}";
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,74 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "sourcerangecontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class FixItContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FixItContainer() = default;
|
|
||||||
FixItContainer(const Utf8String &text,
|
|
||||||
const SourceRangeContainer &range)
|
|
||||||
: range(range),
|
|
||||||
text(text)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const FixItContainer &container)
|
|
||||||
{
|
|
||||||
out << container.text;
|
|
||||||
out << container.range;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, FixItContainer &container)
|
|
||||||
{
|
|
||||||
in >> container.text;
|
|
||||||
in >> container.range;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const FixItContainer &first, const FixItContainer &second)
|
|
||||||
{
|
|
||||||
return first.text == second.text && first.range == second.range;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
SourceRangeContainer range;
|
|
||||||
Utf8String text;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FixItContainer &container);
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QVector<FixItContainer> &container);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,55 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "followsymbolmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const FollowSymbolResult &result)
|
|
||||||
{
|
|
||||||
debug.nospace() << "FollowSymbolResult("
|
|
||||||
<< result.range
|
|
||||||
<< ", " << result.isResultOnlyForFallBack;
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const FollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "FollowSymbolMessage("
|
|
||||||
<< message.fileContainer
|
|
||||||
<< ", " << message.ticketNumber
|
|
||||||
<< ", " << message.result;
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,121 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
#include "sourcerangecontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class FollowSymbolResult
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FollowSymbolResult() = default;
|
|
||||||
FollowSymbolResult(SourceRangeContainer range)
|
|
||||||
: range(std::move(range))
|
|
||||||
{}
|
|
||||||
FollowSymbolResult(SourceRangeContainer range, bool isResultOnlyForFallBack)
|
|
||||||
: range(std::move(range))
|
|
||||||
, isResultOnlyForFallBack(isResultOnlyForFallBack)
|
|
||||||
{}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const FollowSymbolResult &container)
|
|
||||||
{
|
|
||||||
out << container.range;
|
|
||||||
out << container.isResultOnlyForFallBack;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, FollowSymbolResult &container)
|
|
||||||
{
|
|
||||||
in >> container.range;
|
|
||||||
in >> container.isResultOnlyForFallBack;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const FollowSymbolResult &first, const FollowSymbolResult &second)
|
|
||||||
{
|
|
||||||
return first.range == second.range
|
|
||||||
&& first.isResultOnlyForFallBack == second.isResultOnlyForFallBack;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceRangeContainer range;
|
|
||||||
bool isResultOnlyForFallBack = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
class FollowSymbolMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
FollowSymbolMessage() = default;
|
|
||||||
FollowSymbolMessage(const FileContainer &fileContainer,
|
|
||||||
const FollowSymbolResult &result,
|
|
||||||
quint64 ticketNumber)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
, result(result)
|
|
||||||
, ticketNumber(ticketNumber)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const FollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainer;
|
|
||||||
out << message.result;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, FollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainer;
|
|
||||||
in >> message.result;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const FollowSymbolMessage &first, const FollowSymbolMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.fileContainer == second.fileContainer
|
|
||||||
&& first.result == second.result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
FollowSymbolResult result;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FollowSymbolResult &result);
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const FollowSymbolMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(FollowSymbolMessage);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,35 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ipcinterface.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class IpcClientInterface : public IpcInterface
|
|
||||||
{};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,53 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
template <typename ClientType>
|
|
||||||
class IpcClientProvider
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void setClient(ClientType *client)
|
|
||||||
{
|
|
||||||
client_ = client;
|
|
||||||
}
|
|
||||||
|
|
||||||
void resetClient()
|
|
||||||
{
|
|
||||||
client_ = nullptr;
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientType *client()
|
|
||||||
{
|
|
||||||
return client_;
|
|
||||||
}
|
|
||||||
|
|
||||||
private:
|
|
||||||
ClientType *client_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,49 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class MessageEnvelop;
|
|
||||||
|
|
||||||
class IpcInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
IpcInterface() = default;
|
|
||||||
IpcInterface(const IpcInterface &) = delete;
|
|
||||||
IpcInterface &operator=(const IpcInterface &) = delete;
|
|
||||||
|
|
||||||
virtual void dispatch(const MessageEnvelop &messageEnvelop) = 0;
|
|
||||||
|
|
||||||
protected:
|
|
||||||
virtual ~IpcInterface() = default;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,35 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "ipcinterface.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class IpcServerInterface : public IpcInterface
|
|
||||||
{};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,60 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "lineprefixer.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
LinePrefixer::LinePrefixer(const QByteArray &prefix)
|
|
||||||
: m_prefix(prefix)
|
|
||||||
{}
|
|
||||||
|
|
||||||
void LinePrefixer::setPrefix(const QByteArray &prefix)
|
|
||||||
{
|
|
||||||
m_prefix = prefix;
|
|
||||||
}
|
|
||||||
|
|
||||||
QByteArray LinePrefixer::prefix(const QByteArray &text)
|
|
||||||
{
|
|
||||||
QByteArray output = text;
|
|
||||||
|
|
||||||
if (m_previousIsEndingWithNewLine)
|
|
||||||
output.prepend(m_prefix);
|
|
||||||
|
|
||||||
if (output.endsWith('\n')) {
|
|
||||||
m_previousIsEndingWithNewLine = true;
|
|
||||||
output.chop(1);
|
|
||||||
} else {
|
|
||||||
m_previousIsEndingWithNewLine = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
output.replace("\n", QByteArray("\n" + m_prefix));
|
|
||||||
if (m_previousIsEndingWithNewLine)
|
|
||||||
output.append('\n');
|
|
||||||
|
|
||||||
return output;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,49 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
#include <QString>
|
|
||||||
#include <QTextStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT LinePrefixer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
LinePrefixer() = default;
|
|
||||||
LinePrefixer(const QByteArray &prefix);
|
|
||||||
void setPrefix(const QByteArray &prefix);
|
|
||||||
QByteArray prefix(const QByteArray &text);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QByteArray m_prefix;
|
|
||||||
bool m_previousIsEndingWithNewLine = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,98 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "messageenvelop.h"
|
|
||||||
|
|
||||||
#include "clangcodemodelclientmessages.h"
|
|
||||||
#include "clangcodemodelservermessages.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop)
|
|
||||||
{
|
|
||||||
debug.nospace() << "MessageEnvelop(";
|
|
||||||
|
|
||||||
switch (messageEnvelop.messageType()) {
|
|
||||||
case MessageType::EndMessage:
|
|
||||||
qDebug() << "EndMessage()";
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentsOpenedMessage:
|
|
||||||
qDebug() << messageEnvelop.message<DocumentsOpenedMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentsChangedMessage:
|
|
||||||
qDebug() << messageEnvelop.message<DocumentsChangedMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentsClosedMessage:
|
|
||||||
qDebug() << messageEnvelop.message<DocumentsClosedMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::DocumentVisibilityChangedMessage:
|
|
||||||
qDebug() << messageEnvelop.message<DocumentVisibilityChangedMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::UnsavedFilesUpdatedMessage:
|
|
||||||
qDebug() << messageEnvelop.message<UnsavedFilesUpdatedMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::UnsavedFilesRemovedMessage:
|
|
||||||
qDebug() << messageEnvelop.message<UnsavedFilesRemovedMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::RequestCompletionsMessage:
|
|
||||||
qDebug() << messageEnvelop.message<RequestCompletionsMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::RequestAnnotationsMessage:
|
|
||||||
qDebug() << messageEnvelop.message<RequestAnnotationsMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::RequestReferencesMessage:
|
|
||||||
qDebug() << messageEnvelop.message<RequestReferencesMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::RequestToolTipMessage:
|
|
||||||
qDebug() << messageEnvelop.message<RequestToolTipMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::AliveMessage:
|
|
||||||
qDebug() << "AliveMessage()";
|
|
||||||
break;
|
|
||||||
case MessageType::EchoMessage:
|
|
||||||
qDebug() << messageEnvelop.message<EchoMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::CompletionsMessage:
|
|
||||||
qDebug() << messageEnvelop.message<CompletionsMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::ReferencesMessage:
|
|
||||||
qDebug() << messageEnvelop.message<ReferencesMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::ToolTipMessage:
|
|
||||||
qDebug() << messageEnvelop.message<ToolTipMessage>();
|
|
||||||
break;
|
|
||||||
case MessageType::AnnotationsMessage:
|
|
||||||
qDebug() << messageEnvelop.message<AnnotationsMessage>();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
qWarning() << "Unknown Message";
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,118 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include <QByteArray>
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QIODevice>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class MessageEnvelop
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
MessageEnvelop() = default;
|
|
||||||
|
|
||||||
template <class Message, typename = std::enable_if_t<
|
|
||||||
std::is_enum_v<decltype(MessageTrait<Message>::enumeration)>>>
|
|
||||||
MessageEnvelop(const Message &message)
|
|
||||||
: messageType_(MessageTrait<Message>::enumeration)
|
|
||||||
{
|
|
||||||
QDataStream stream(&data, QIODevice::WriteOnly);
|
|
||||||
stream << message;
|
|
||||||
}
|
|
||||||
|
|
||||||
template <class Message>
|
|
||||||
Message message() const
|
|
||||||
{
|
|
||||||
Message message;
|
|
||||||
|
|
||||||
QDataStream stream(&data, QIODevice::ReadOnly);
|
|
||||||
stream >> message;
|
|
||||||
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageType messageType() const
|
|
||||||
{
|
|
||||||
return messageType_;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isValid() const
|
|
||||||
{
|
|
||||||
return messageType_ != MessageType::InvalidMessage;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
QDataStream &operator >>(QDataStream& in, MessageType& messageType)
|
|
||||||
{
|
|
||||||
quint32 messageTypeAsInt;
|
|
||||||
in >> messageTypeAsInt;
|
|
||||||
messageType = MessageType(messageTypeAsInt);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
QDataStream &operator<<(QDataStream &out, const MessageEnvelop &messageEnvelop)
|
|
||||||
{
|
|
||||||
out << static_cast<quint8>(messageEnvelop.messageType_);
|
|
||||||
out << messageEnvelop.data;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
QDataStream &operator>>(QDataStream &in, MessageEnvelop &messageEnvelop)
|
|
||||||
{
|
|
||||||
quint8 messageType;
|
|
||||||
|
|
||||||
in >> messageType;
|
|
||||||
in >> messageEnvelop.data;
|
|
||||||
|
|
||||||
messageEnvelop.messageType_ = static_cast<MessageType>(messageType);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend
|
|
||||||
bool operator==(const MessageEnvelop &first, const MessageEnvelop &second)
|
|
||||||
{
|
|
||||||
return first.messageType_ == second.messageType_
|
|
||||||
&& first.data == second.data;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDebug operator<<(QDebug debug, const MessageEnvelop &messageEnvelop);
|
|
||||||
|
|
||||||
private:
|
|
||||||
mutable QByteArray data;
|
|
||||||
MessageType messageType_ = MessageType::InvalidMessage;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,190 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "processcreator.h"
|
|
||||||
|
|
||||||
#include "processexception.h"
|
|
||||||
#include "processstartedevent.h"
|
|
||||||
|
|
||||||
#include <utils/commandline.h>
|
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
|
|
||||||
#include <QCoreApplication>
|
|
||||||
#include <QFileInfo>
|
|
||||||
#include <QTemporaryDir>
|
|
||||||
|
|
||||||
using namespace Utils;
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
using namespace std::chrono_literals;
|
|
||||||
|
|
||||||
ProcessCreator::ProcessCreator()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::setTemporaryDirectoryPattern(const QString &temporaryDirectoryPattern)
|
|
||||||
{
|
|
||||||
m_temporaryDirectoryPattern = temporaryDirectoryPattern;
|
|
||||||
resetTemporaryDirectory();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::setProcessPath(const QString &processPath)
|
|
||||||
{
|
|
||||||
m_processPath = processPath;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::setArguments(const QStringList &arguments)
|
|
||||||
{
|
|
||||||
m_arguments = arguments;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::setEnvironment(const Environment &environment)
|
|
||||||
{
|
|
||||||
m_environment = environment;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::future<QProcessUniquePointer> ProcessCreator::createProcess() const
|
|
||||||
{
|
|
||||||
return std::async(std::launch::async, [&] {
|
|
||||||
checkIfProcessPathExists();
|
|
||||||
auto process = QProcessUniquePointer(new QtcProcess);
|
|
||||||
process->setProcessChannelMode(QProcess::ForwardedChannels);
|
|
||||||
process->setEnvironment(processEnvironment());
|
|
||||||
process->setCommand(CommandLine(FilePath::fromString(m_processPath), m_arguments));
|
|
||||||
process->start();
|
|
||||||
process->waitForStarted(5000);
|
|
||||||
|
|
||||||
checkIfProcessWasStartingSuccessful(process.get());
|
|
||||||
|
|
||||||
postProcessStartedEvent();
|
|
||||||
|
|
||||||
process->moveToThread(QCoreApplication::instance()->thread());
|
|
||||||
|
|
||||||
return process;
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::setObserver(QObject *observer)
|
|
||||||
{
|
|
||||||
this->m_observer = observer;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::checkIfProcessPathExists() const
|
|
||||||
{
|
|
||||||
if (!QFileInfo::exists(m_processPath)) {
|
|
||||||
const QString messageTemplate = QCoreApplication::translate("ProcessCreator",
|
|
||||||
"Executable does not exist: %1");
|
|
||||||
throwProcessException(messageTemplate.arg(m_processPath));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::checkIfProcessWasStartingSuccessful(QtcProcess *process) const
|
|
||||||
{
|
|
||||||
if (process->exitStatus() == QProcess::CrashExit || process->exitCode() != 0)
|
|
||||||
dispatchProcessError(process);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::dispatchProcessError(QtcProcess *process) const
|
|
||||||
{
|
|
||||||
switch (process->error()) {
|
|
||||||
case QProcess::UnknownError: {
|
|
||||||
const QString message = QCoreApplication::translate("ProcessCreator",
|
|
||||||
"Unknown error occurred.");
|
|
||||||
throwProcessException(message);
|
|
||||||
};
|
|
||||||
case QProcess::Crashed: {
|
|
||||||
const QString message = QCoreApplication::translate("ProcessCreator",
|
|
||||||
"Process crashed.");
|
|
||||||
throwProcessException(message);
|
|
||||||
};
|
|
||||||
case QProcess::FailedToStart: {
|
|
||||||
const QString message = QCoreApplication::translate("ProcessCreator",
|
|
||||||
"Process failed at startup.");
|
|
||||||
throwProcessException(message);
|
|
||||||
};
|
|
||||||
case QProcess::Timedout: {
|
|
||||||
const QString message = QCoreApplication::translate("ProcessCreator",
|
|
||||||
"Process timed out.");
|
|
||||||
throwProcessException(message);
|
|
||||||
};
|
|
||||||
case QProcess::WriteError: {
|
|
||||||
const QString message = QCoreApplication::translate("ProcessCreator",
|
|
||||||
"Cannot write to process.");
|
|
||||||
throwProcessException(message);
|
|
||||||
};
|
|
||||||
case QProcess::ReadError: {
|
|
||||||
const QString message = QCoreApplication::translate("ProcessCreator",
|
|
||||||
"Cannot read from process.");
|
|
||||||
throwProcessException(message);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
throwProcessException("Internal impossible error!");
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::postProcessStartedEvent() const
|
|
||||||
{
|
|
||||||
if (m_observer)
|
|
||||||
QCoreApplication::postEvent(m_observer, new ProcessStartedEvent);
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::throwProcessException(const QString &message) const
|
|
||||||
{
|
|
||||||
postProcessStartedEvent();
|
|
||||||
throw ProcessException(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
const QTemporaryDir &ProcessCreator::temporaryDirectory() const
|
|
||||||
{
|
|
||||||
return *m_temporaryDirectory.get();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ProcessCreator::resetTemporaryDirectory()
|
|
||||||
{
|
|
||||||
m_temporaryDirectory = std::make_unique<TemporaryDirectory>(m_temporaryDirectoryPattern);
|
|
||||||
}
|
|
||||||
|
|
||||||
Environment ProcessCreator::processEnvironment() const
|
|
||||||
{
|
|
||||||
auto processEnvironment = Environment::systemEnvironment();
|
|
||||||
|
|
||||||
if (temporaryDirectory().isValid()) {
|
|
||||||
const QString temporaryDirectoryPath = temporaryDirectory().path();
|
|
||||||
processEnvironment.set("TMPDIR", temporaryDirectoryPath);
|
|
||||||
processEnvironment.set("TMP", temporaryDirectoryPath);
|
|
||||||
processEnvironment.set("TEMP", temporaryDirectoryPath);
|
|
||||||
}
|
|
||||||
|
|
||||||
const Environment &env = m_environment;
|
|
||||||
for (auto it = env.constBegin(); it != env.constEnd(); ++it) {
|
|
||||||
if (env.isEnabled(it))
|
|
||||||
processEnvironment.set(env.key(it), env.expandedValueForKey(env.key(it)));
|
|
||||||
}
|
|
||||||
|
|
||||||
return processEnvironment;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,85 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <clangsupport_global.h>
|
|
||||||
|
|
||||||
#include "processhandle.h"
|
|
||||||
|
|
||||||
#include <utils/environment.h>
|
|
||||||
#include <utils/temporarydirectory.h>
|
|
||||||
|
|
||||||
#include <QStringList>
|
|
||||||
|
|
||||||
#include <future>
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QTemporaryDir;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace Utils {
|
|
||||||
class Environment;
|
|
||||||
class QtcProcess;
|
|
||||||
}
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ProcessCreator
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProcessCreator();
|
|
||||||
|
|
||||||
void setTemporaryDirectoryPattern(const QString &temporaryDirectoryPattern);
|
|
||||||
void setProcessPath(const QString &m_processPath);
|
|
||||||
void setArguments(const QStringList &m_arguments);
|
|
||||||
void setEnvironment(const Utils::Environment &environment);
|
|
||||||
void setObserver(QObject *m_observer);
|
|
||||||
|
|
||||||
std::future<QProcessUniquePointer> createProcess() const;
|
|
||||||
|
|
||||||
const QTemporaryDir &temporaryDirectory() const;
|
|
||||||
void resetTemporaryDirectory();
|
|
||||||
|
|
||||||
private:
|
|
||||||
void checkIfProcessPathExists() const;
|
|
||||||
void checkIfProcessWasStartingSuccessful(Utils::QtcProcess *process) const;
|
|
||||||
[[noreturn]] void dispatchProcessError(Utils::QtcProcess *process) const;
|
|
||||||
void postProcessStartedEvent() const;
|
|
||||||
[[noreturn]] void throwProcessException(const QString &message) const;
|
|
||||||
|
|
||||||
Utils::Environment processEnvironment() const;
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::unique_ptr<Utils::TemporaryDirectory> m_temporaryDirectory;
|
|
||||||
QString m_processPath;
|
|
||||||
QString m_temporaryDirectoryPattern;
|
|
||||||
QStringList m_arguments;
|
|
||||||
Utils::Environment m_environment;
|
|
||||||
QObject *m_observer = nullptr;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,40 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "processexception.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
ProcessException::ProcessException(Utils::SmallString &&what)
|
|
||||||
: what_(std::move(what))
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
const char *ProcessException::what() const noexcept
|
|
||||||
{
|
|
||||||
return what_.data();
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,48 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <utils/smallstring.h>
|
|
||||||
|
|
||||||
#include <exception>
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ProcessException : public std::exception
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ProcessException() = default;
|
|
||||||
ProcessException(Utils::SmallString &&what);
|
|
||||||
|
|
||||||
const char *what() const noexcept final;
|
|
||||||
|
|
||||||
private:
|
|
||||||
Utils::SmallString what_;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,47 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <utils/qtcprocess.h>
|
|
||||||
|
|
||||||
#include <memory>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class QProcessUniquePointerDeleter
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
void operator()(Utils::QtcProcess* process)
|
|
||||||
{
|
|
||||||
process->kill();
|
|
||||||
process->waitForFinished();
|
|
||||||
delete process;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
using QProcessUniquePointer = std::unique_ptr<Utils::QtcProcess, QProcessUniquePointerDeleter>;
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,34 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "processstartedevent.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
ProcessStartedEvent::~ProcessStartedEvent()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,44 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include <QEvent>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class ProcessStartedEvent : public QEvent
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum Type {
|
|
||||||
ProcessStarted = QEvent::User + 3456
|
|
||||||
};
|
|
||||||
|
|
||||||
ProcessStartedEvent()
|
|
||||||
: QEvent(static_cast<QEvent::Type>(ProcessStarted))
|
|
||||||
{}
|
|
||||||
|
|
||||||
~ProcessStartedEvent() override;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,122 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "readmessageblock.h"
|
|
||||||
|
|
||||||
#include "messageenvelop.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QDebug>
|
|
||||||
#include <QIODevice>
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
ReadMessageBlock::ReadMessageBlock(QIODevice *ioDevice)
|
|
||||||
: m_ioDevice(ioDevice),
|
|
||||||
m_messageCounter(0),
|
|
||||||
m_blockSize(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ReadMessageBlock::checkIfMessageIsLost(QDataStream &in)
|
|
||||||
{
|
|
||||||
qint64 currentMessageCounter;
|
|
||||||
|
|
||||||
in >> currentMessageCounter;
|
|
||||||
|
|
||||||
bool messageIsLost = false;
|
|
||||||
#ifndef DONT_CHECK_MESSAGE_COUNTER
|
|
||||||
messageIsLost = !((currentMessageCounter == 0 && m_messageCounter == 0) || (m_messageCounter + 1 == currentMessageCounter));
|
|
||||||
if (messageIsLost)
|
|
||||||
qWarning() << "message lost: " << m_messageCounter << currentMessageCounter;
|
|
||||||
#endif
|
|
||||||
|
|
||||||
m_messageCounter = currentMessageCounter;
|
|
||||||
|
|
||||||
return messageIsLost;
|
|
||||||
}
|
|
||||||
|
|
||||||
MessageEnvelop ReadMessageBlock::read()
|
|
||||||
{
|
|
||||||
QDataStream in(m_ioDevice);
|
|
||||||
|
|
||||||
MessageEnvelop message;
|
|
||||||
|
|
||||||
if (isTheWholeMessageReadable(in)) {
|
|
||||||
bool messageIsLost = checkIfMessageIsLost(in);
|
|
||||||
|
|
||||||
in >> message;
|
|
||||||
|
|
||||||
if (messageIsLost)
|
|
||||||
qDebug() << message;
|
|
||||||
}
|
|
||||||
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<MessageEnvelop> ReadMessageBlock::readAll()
|
|
||||||
{
|
|
||||||
std::vector<MessageEnvelop> messages;
|
|
||||||
|
|
||||||
while (true) {
|
|
||||||
MessageEnvelop message = read();
|
|
||||||
if (message.isValid())
|
|
||||||
messages.push_back(std::move(message));
|
|
||||||
else
|
|
||||||
return messages;
|
|
||||||
}
|
|
||||||
|
|
||||||
Q_UNREACHABLE();
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReadMessageBlock::resetState()
|
|
||||||
{
|
|
||||||
m_messageCounter = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ReadMessageBlock::setIoDevice(QIODevice *ioDevice)
|
|
||||||
{
|
|
||||||
m_ioDevice = ioDevice;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool ReadMessageBlock::isTheWholeMessageReadable(QDataStream &in)
|
|
||||||
{
|
|
||||||
if (m_ioDevice->bytesAvailable() < qint64(sizeof(m_blockSize)))
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (m_blockSize == 0)
|
|
||||||
in >> m_blockSize;
|
|
||||||
|
|
||||||
if (m_ioDevice->bytesAvailable() < m_blockSize)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
m_blockSize = 0;
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,65 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include <QtGlobal>
|
|
||||||
|
|
||||||
#include <vector>
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
QT_BEGIN_NAMESPACE
|
|
||||||
class QDataStream;
|
|
||||||
class QIODevice;
|
|
||||||
QT_END_NAMESPACE
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class MessageEnvelop;
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT ReadMessageBlock
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ReadMessageBlock(QIODevice *ioDevice = nullptr);
|
|
||||||
|
|
||||||
MessageEnvelop read();
|
|
||||||
std::vector<MessageEnvelop> readAll();
|
|
||||||
|
|
||||||
void resetState();
|
|
||||||
|
|
||||||
void setIoDevice(QIODevice *ioDevice);
|
|
||||||
|
|
||||||
private:
|
|
||||||
bool isTheWholeMessageReadable(QDataStream &in);
|
|
||||||
bool checkIfMessageIsLost(QDataStream &in);
|
|
||||||
|
|
||||||
private:
|
|
||||||
QIODevice *m_ioDevice;
|
|
||||||
qint64 m_messageCounter;
|
|
||||||
qint32 m_blockSize;
|
|
||||||
};
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,45 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "referencesmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const ReferencesMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "ReferencesMessage("
|
|
||||||
<< message.fileContainer
|
|
||||||
<< ", " << message.ticketNumber
|
|
||||||
<< ", " << message.isLocalVariable
|
|
||||||
<< ", " << message.references;
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,89 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
#include "sourcerangecontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class ReferencesMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ReferencesMessage() = default;
|
|
||||||
ReferencesMessage(const FileContainer &fileContainer,
|
|
||||||
const QVector<SourceRangeContainer> &references,
|
|
||||||
bool isLocalVariable,
|
|
||||||
quint64 ticketNumber)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
, references(references)
|
|
||||||
, ticketNumber(ticketNumber)
|
|
||||||
, isLocalVariable(isLocalVariable)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const ReferencesMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainer;
|
|
||||||
out << message.isLocalVariable;
|
|
||||||
out << message.references;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, ReferencesMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainer;
|
|
||||||
in >> message.isLocalVariable;
|
|
||||||
in >> message.references;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const ReferencesMessage &first, const ReferencesMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.isLocalVariable == second.isLocalVariable
|
|
||||||
&& first.fileContainer == second.fileContainer
|
|
||||||
&& first.references == second.references;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
QVector<SourceRangeContainer> references;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
bool isLocalVariable = false;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ReferencesMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(ReferencesMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,41 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "requestannotationsmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const RequestAnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "RequestAnnotationsMessage("
|
|
||||||
<< message.fileContainer
|
|
||||||
<< ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,68 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class RequestAnnotationsMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RequestAnnotationsMessage() = default;
|
|
||||||
RequestAnnotationsMessage(const FileContainer &fileContainer)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const RequestAnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainer;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, RequestAnnotationsMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainer;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const RequestAnnotationsMessage &first,
|
|
||||||
const RequestAnnotationsMessage &second)
|
|
||||||
{
|
|
||||||
return first.fileContainer == second.fileContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestAnnotationsMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(RequestAnnotationsMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,51 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "requestcompletionsmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
quint64 RequestCompletionsMessage::ticketCounter = 0;
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const RequestCompletionsMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "RequestCompletionsMessage(";
|
|
||||||
|
|
||||||
debug.nospace() << message.filePath << ", ";
|
|
||||||
debug.nospace() << message.line << ", ";
|
|
||||||
debug.nospace() << message.column << ", ";
|
|
||||||
debug.nospace() << message.ticketNumber;
|
|
||||||
debug.nospace() << message.funcNameStartLine << ", ";
|
|
||||||
debug.nospace() << message.funcNameStartColumn << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,102 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class RequestCompletionsMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RequestCompletionsMessage() = default;
|
|
||||||
RequestCompletionsMessage(const Utf8String &filePath,
|
|
||||||
quint32 line,
|
|
||||||
quint32 column,
|
|
||||||
qint32 funcNameStartLine = -1,
|
|
||||||
qint32 funcNameStartColumn = -1)
|
|
||||||
: filePath(filePath)
|
|
||||||
, ticketNumber(++ticketCounter)
|
|
||||||
, line(line)
|
|
||||||
, column(column)
|
|
||||||
, funcNameStartLine(funcNameStartLine)
|
|
||||||
, funcNameStartColumn(funcNameStartColumn)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const RequestCompletionsMessage &message)
|
|
||||||
{
|
|
||||||
out << message.filePath;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
out << message.line;
|
|
||||||
out << message.column;
|
|
||||||
out << message.funcNameStartLine;
|
|
||||||
out << message.funcNameStartColumn;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, RequestCompletionsMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.filePath;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
in >> message.line;
|
|
||||||
in >> message.column;
|
|
||||||
in >> message.funcNameStartLine;
|
|
||||||
in >> message.funcNameStartColumn;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const RequestCompletionsMessage &first,
|
|
||||||
const RequestCompletionsMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.filePath == second.filePath
|
|
||||||
&& first.line == second.line
|
|
||||||
&& first.column == second.column
|
|
||||||
&& first.funcNameStartLine == second.funcNameStartLine
|
|
||||||
&& first.funcNameStartColumn == second.funcNameStartColumn;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utf8String filePath;
|
|
||||||
static CLANGSUPPORT_EXPORT quint64 ticketCounter;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
quint32 line = 0;
|
|
||||||
quint32 column = 0;
|
|
||||||
qint32 funcNameStartLine = -1;
|
|
||||||
qint32 funcNameStartColumn = -1;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestCompletionsMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(RequestCompletionsMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,48 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "requestfollowsymbolmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
quint64 RequestFollowSymbolMessage::ticketCounter = 0;
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const RequestFollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "RequestFollowSymbolMessage(";
|
|
||||||
|
|
||||||
debug.nospace() << message.fileContainer << ", ";
|
|
||||||
debug.nospace() << message.ticketNumber << ", ";
|
|
||||||
debug.nospace() << message.line << ", ";
|
|
||||||
debug.nospace() << message.column << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,90 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class RequestFollowSymbolMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RequestFollowSymbolMessage() = default;
|
|
||||||
RequestFollowSymbolMessage(const FileContainer &fileContainer,
|
|
||||||
quint32 line,
|
|
||||||
quint32 column)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
, ticketNumber(++ticketCounter)
|
|
||||||
, line(line)
|
|
||||||
, column(column)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const RequestFollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainer;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
out << message.line;
|
|
||||||
out << message.column;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, RequestFollowSymbolMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainer;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
in >> message.line;
|
|
||||||
in >> message.column;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const RequestFollowSymbolMessage &first,
|
|
||||||
const RequestFollowSymbolMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.line == second.line
|
|
||||||
&& first.column == second.column
|
|
||||||
&& first.fileContainer == second.fileContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
quint32 line = 0;
|
|
||||||
quint32 column = 0;
|
|
||||||
static CLANGSUPPORT_EXPORT quint64 ticketCounter;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestFollowSymbolMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(RequestFollowSymbolMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,49 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "requestreferencesmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
quint64 RequestReferencesMessage::ticketCounter = 0;
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const RequestReferencesMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "RequestReferencesMessage(";
|
|
||||||
|
|
||||||
debug.nospace() << message.fileContainer << ", ";
|
|
||||||
debug.nospace() << message.ticketNumber << ", ";
|
|
||||||
debug.nospace() << message.line << ", ";
|
|
||||||
debug.nospace() << message.column << ", ";
|
|
||||||
debug.nospace() << message.local << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,96 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2017 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class RequestReferencesMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RequestReferencesMessage() = default;
|
|
||||||
RequestReferencesMessage(const FileContainer &fileContainer,
|
|
||||||
quint32 line,
|
|
||||||
quint32 column,
|
|
||||||
bool local = false)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
, ticketNumber(++ticketCounter)
|
|
||||||
, line(line)
|
|
||||||
, column(column)
|
|
||||||
, local(local)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const RequestReferencesMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainer;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
out << message.line;
|
|
||||||
out << message.column;
|
|
||||||
out << message.local;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, RequestReferencesMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainer;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
in >> message.line;
|
|
||||||
in >> message.column;
|
|
||||||
in >> message.local;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const RequestReferencesMessage &first,
|
|
||||||
const RequestReferencesMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.line == second.line
|
|
||||||
&& first.column == second.column
|
|
||||||
&& first.fileContainer == second.fileContainer
|
|
||||||
&& first.local == second.local;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
quint32 line = 0;
|
|
||||||
quint32 column = 0;
|
|
||||||
bool local = false;
|
|
||||||
static CLANGSUPPORT_EXPORT quint64 ticketCounter;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestReferencesMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(RequestReferencesMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,48 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "requesttooltipmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
quint64 RequestToolTipMessage::ticketCounter = 0;
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const RequestToolTipMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "RequestToolTipMessage(";
|
|
||||||
|
|
||||||
debug.nospace() << message.fileContainer << ", ";
|
|
||||||
debug.nospace() << message.ticketNumber << ", ";
|
|
||||||
debug.nospace() << message.line << ", ";
|
|
||||||
debug.nospace() << message.column << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,89 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
// TODO: De-duplicate with RequestReferencesMessage?
|
|
||||||
class RequestToolTipMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
RequestToolTipMessage() = default;
|
|
||||||
RequestToolTipMessage(const FileContainer &fileContainer, quint32 line, quint32 column)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
, ticketNumber(++ticketCounter)
|
|
||||||
, line(line)
|
|
||||||
, column(column)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const RequestToolTipMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainer;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
out << message.line;
|
|
||||||
out << message.column;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, RequestToolTipMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainer;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
in >> message.line;
|
|
||||||
in >> message.column;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const RequestToolTipMessage &first,
|
|
||||||
const RequestToolTipMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.line == second.line
|
|
||||||
&& first.column == second.column
|
|
||||||
&& first.fileContainer == second.fileContainer;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
quint32 line = 0;
|
|
||||||
quint32 column = 0;
|
|
||||||
static CLANGSUPPORT_EXPORT quint64 ticketCounter;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestToolTipMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(RequestToolTipMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,74 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "sourcelocationcontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container)
|
|
||||||
{
|
|
||||||
out << container.filePath;
|
|
||||||
out << container.line;
|
|
||||||
out << container.column;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container)
|
|
||||||
{
|
|
||||||
in >> container.filePath;
|
|
||||||
in >> container.line;
|
|
||||||
in >> container.column;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second)
|
|
||||||
{
|
|
||||||
return !(first != second);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second)
|
|
||||||
{
|
|
||||||
return first.line != second.line
|
|
||||||
|| first.column != second.column
|
|
||||||
|| first.filePath != second.filePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const SourceLocationContainer &container)
|
|
||||||
{
|
|
||||||
debug.nospace() << "SourceLocationContainer("
|
|
||||||
<< container.filePath << ", "
|
|
||||||
<< container.line << ", "
|
|
||||||
<< container.column
|
|
||||||
<< ")";
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,60 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT SourceLocationContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SourceLocationContainer() = default;
|
|
||||||
SourceLocationContainer(const Utf8String &filePath,
|
|
||||||
int line,
|
|
||||||
int column)
|
|
||||||
: filePath(filePath),
|
|
||||||
line(line),
|
|
||||||
column(column)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utf8String filePath;
|
|
||||||
int line = 0;
|
|
||||||
int column = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDataStream &operator<<(QDataStream &out, const SourceLocationContainer &container);
|
|
||||||
CLANGSUPPORT_EXPORT QDataStream &operator>>(QDataStream &in, SourceLocationContainer &container);
|
|
||||||
CLANGSUPPORT_EXPORT bool operator==(const SourceLocationContainer &first, const SourceLocationContainer &second);
|
|
||||||
CLANGSUPPORT_EXPORT bool operator!=(const SourceLocationContainer &first, const SourceLocationContainer &second);
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationContainer &container);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,47 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "sourcelocationscontainer.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const SourceLocationsContainer &container)
|
|
||||||
{
|
|
||||||
debug.nospace() << "SourceLocationsContainer([";
|
|
||||||
for (const auto &sourceLocation: container.sourceLocationContainers()) {
|
|
||||||
debug.nospace() << "("
|
|
||||||
<< sourceLocation.filePath << ","
|
|
||||||
<< sourceLocation.line << ","
|
|
||||||
<< sourceLocation.column << "), ";
|
|
||||||
}
|
|
||||||
|
|
||||||
debug.nospace() << "])";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,92 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "sourcelocationcontainer.h"
|
|
||||||
|
|
||||||
#include <utils/smallstringio.h>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class CLANGSUPPORT_EXPORT SourceLocationsContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SourceLocationsContainer() = default;
|
|
||||||
SourceLocationsContainer(std::vector<SourceLocationContainer> &&sourceLocationContainers)
|
|
||||||
: m_sourceLocationContainers(std::move(sourceLocationContainers))
|
|
||||||
{}
|
|
||||||
|
|
||||||
const std::vector<SourceLocationContainer> &sourceLocationContainers() const
|
|
||||||
{
|
|
||||||
return m_sourceLocationContainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool hasContent() const
|
|
||||||
{
|
|
||||||
return !m_sourceLocationContainers.empty();
|
|
||||||
}
|
|
||||||
|
|
||||||
void insertSourceLocation(const Utf8String &filePath, int line, int column)
|
|
||||||
{
|
|
||||||
m_sourceLocationContainers.emplace_back(filePath, line, column);
|
|
||||||
}
|
|
||||||
|
|
||||||
void reserve(std::size_t size)
|
|
||||||
{
|
|
||||||
m_sourceLocationContainers.reserve(size);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const SourceLocationsContainer &container)
|
|
||||||
{
|
|
||||||
out << container.m_sourceLocationContainers;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, SourceLocationsContainer &container)
|
|
||||||
{
|
|
||||||
in >> container.m_sourceLocationContainers;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const SourceLocationsContainer &first, const SourceLocationsContainer &second)
|
|
||||||
{
|
|
||||||
return first.m_sourceLocationContainers == second.m_sourceLocationContainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
SourceLocationsContainer clone() const
|
|
||||||
{
|
|
||||||
return *this;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::vector<SourceLocationContainer> m_sourceLocationContainers;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationsContainer &container);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,54 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "sourcerangecontainer.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const SourceRangeContainer &container)
|
|
||||||
{
|
|
||||||
debug.nospace() << "SourceRangeContainer("
|
|
||||||
<< container.start << ", "
|
|
||||||
<< container.end
|
|
||||||
<< ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const QVector<SourceRangeContainer> &containers)
|
|
||||||
{
|
|
||||||
debug.nospace() << "{";
|
|
||||||
for (int i = 0; i < containers.size(); i++) {
|
|
||||||
debug.nospace() << containers[i];
|
|
||||||
if (i < containers.size() - 1)
|
|
||||||
debug.nospace() << ", ";
|
|
||||||
}
|
|
||||||
debug.nospace() << "}";
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,90 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "sourcelocationcontainer.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class SourceRangeContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
SourceRangeContainer() = default;
|
|
||||||
SourceRangeContainer(SourceLocationContainer start,
|
|
||||||
SourceLocationContainer end)
|
|
||||||
: start(start),
|
|
||||||
end(end)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool contains(int line, int column) const
|
|
||||||
{
|
|
||||||
if (line < start.line || line > end.line)
|
|
||||||
return false;
|
|
||||||
if (line == start.line && column < start.column)
|
|
||||||
return false;
|
|
||||||
if (line == end.line && column > end.column)
|
|
||||||
return false;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool contains(const SourceLocationContainer &sourceLocation) const
|
|
||||||
{
|
|
||||||
return contains(sourceLocation.line, sourceLocation.column);
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const SourceRangeContainer &container)
|
|
||||||
{
|
|
||||||
out << container.start;
|
|
||||||
out << container.end;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, SourceRangeContainer &container)
|
|
||||||
{
|
|
||||||
in >> container.start;
|
|
||||||
in >> container.end;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const SourceRangeContainer &first, const SourceRangeContainer &second)
|
|
||||||
{
|
|
||||||
return first.start == second.start && first.end == second.end;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
SourceLocationContainer start;
|
|
||||||
SourceLocationContainer end;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceRangeContainer &container);
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const QVector<SourceRangeContainer> &container);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,114 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "tokeninfocontainer.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
#define RETURN_TEXT_FOR_CASE(enumValue) case HighlightingType::enumValue: return #enumValue
|
|
||||||
static const char *highlightingTypeToCStringLiteral(HighlightingType type)
|
|
||||||
{
|
|
||||||
switch (type) {
|
|
||||||
RETURN_TEXT_FOR_CASE(Invalid);
|
|
||||||
RETURN_TEXT_FOR_CASE(Comment);
|
|
||||||
RETURN_TEXT_FOR_CASE(Keyword);
|
|
||||||
RETURN_TEXT_FOR_CASE(StringLiteral);
|
|
||||||
RETURN_TEXT_FOR_CASE(NumberLiteral);
|
|
||||||
RETURN_TEXT_FOR_CASE(Function);
|
|
||||||
RETURN_TEXT_FOR_CASE(VirtualFunction);
|
|
||||||
RETURN_TEXT_FOR_CASE(Type);
|
|
||||||
RETURN_TEXT_FOR_CASE(LocalVariable);
|
|
||||||
RETURN_TEXT_FOR_CASE(GlobalVariable);
|
|
||||||
RETURN_TEXT_FOR_CASE(Field);
|
|
||||||
RETURN_TEXT_FOR_CASE(Enumeration);
|
|
||||||
RETURN_TEXT_FOR_CASE(Operator);
|
|
||||||
RETURN_TEXT_FOR_CASE(OverloadedOperator);
|
|
||||||
RETURN_TEXT_FOR_CASE(Preprocessor);
|
|
||||||
RETURN_TEXT_FOR_CASE(Label);
|
|
||||||
RETURN_TEXT_FOR_CASE(FunctionDefinition);
|
|
||||||
RETURN_TEXT_FOR_CASE(OutputArgument);
|
|
||||||
RETURN_TEXT_FOR_CASE(PreprocessorDefinition);
|
|
||||||
RETURN_TEXT_FOR_CASE(PreprocessorExpansion);
|
|
||||||
RETURN_TEXT_FOR_CASE(Punctuation);
|
|
||||||
RETURN_TEXT_FOR_CASE(Namespace);
|
|
||||||
RETURN_TEXT_FOR_CASE(Class);
|
|
||||||
RETURN_TEXT_FOR_CASE(Struct);
|
|
||||||
RETURN_TEXT_FOR_CASE(Enum);
|
|
||||||
RETURN_TEXT_FOR_CASE(Union);
|
|
||||||
RETURN_TEXT_FOR_CASE(TypeAlias);
|
|
||||||
RETURN_TEXT_FOR_CASE(Typedef);
|
|
||||||
RETURN_TEXT_FOR_CASE(QtProperty);
|
|
||||||
RETURN_TEXT_FOR_CASE(ObjectiveCClass);
|
|
||||||
RETURN_TEXT_FOR_CASE(ObjectiveCCategory);
|
|
||||||
RETURN_TEXT_FOR_CASE(ObjectiveCProtocol);
|
|
||||||
RETURN_TEXT_FOR_CASE(ObjectiveCInterface);
|
|
||||||
RETURN_TEXT_FOR_CASE(ObjectiveCImplementation);
|
|
||||||
RETURN_TEXT_FOR_CASE(ObjectiveCProperty);
|
|
||||||
RETURN_TEXT_FOR_CASE(ObjectiveCMethod);
|
|
||||||
RETURN_TEXT_FOR_CASE(PrimitiveType);
|
|
||||||
RETURN_TEXT_FOR_CASE(Declaration);
|
|
||||||
RETURN_TEXT_FOR_CASE(TemplateTypeParameter);
|
|
||||||
RETURN_TEXT_FOR_CASE(TemplateTemplateParameter);
|
|
||||||
default: return "UnhandledHighlightingType";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#undef RETURN_TEXT_FOR_CASE
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const ExtraInfo &extraInfo)
|
|
||||||
{
|
|
||||||
debug.nospace() << "ExtraInfo("
|
|
||||||
<< extraInfo.token << ", "
|
|
||||||
<< extraInfo.typeSpelling << ", "
|
|
||||||
<< extraInfo.semanticParentTypeSpelling << ", "
|
|
||||||
<< extraInfo.cursorRange << ", "
|
|
||||||
<< extraInfo.lexicalParentIndex << ", "
|
|
||||||
<< static_cast<uint>(extraInfo.accessSpecifier) << ", "
|
|
||||||
<< static_cast<uint>(extraInfo.storageClass) << ", "
|
|
||||||
<< extraInfo.identifier << ", "
|
|
||||||
<< extraInfo.includeDirectivePath << ", "
|
|
||||||
<< extraInfo.declaration << ", "
|
|
||||||
<< extraInfo.definition << ", "
|
|
||||||
<< extraInfo.signal << ", "
|
|
||||||
<< extraInfo.slot << ", "
|
|
||||||
<< ")";
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const TokenInfoContainer &container)
|
|
||||||
{
|
|
||||||
debug.nospace() << "TokenInfosContainer("
|
|
||||||
<< container.line << ", "
|
|
||||||
<< container.column << ", "
|
|
||||||
<< container.length << ", "
|
|
||||||
<< highlightingTypeToCStringLiteral(container.types.mainHighlightingType) << ", "
|
|
||||||
<< container.extraInfo
|
|
||||||
<< ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,344 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
#include "sourcerangecontainer.h"
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
#include <bitset>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, HighlightingType highlightingType);
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, HighlightingTypes highlightingTypes);
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, HighlightingType &highlightingType);
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, HighlightingTypes &highlightingTypes);
|
|
||||||
inline bool operator==(const MixinHighlightingTypes &first, const MixinHighlightingTypes &second);
|
|
||||||
inline bool operator==(const HighlightingTypes &first, const HighlightingTypes &second);
|
|
||||||
|
|
||||||
using ByteSizeBitset = std::bitset<8>;
|
|
||||||
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, ByteSizeBitset bits);
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, ByteSizeBitset &bits);
|
|
||||||
|
|
||||||
struct ExtraInfo
|
|
||||||
{
|
|
||||||
ExtraInfo()
|
|
||||||
: identifier(false)
|
|
||||||
, includeDirectivePath(false)
|
|
||||||
, declaration(false)
|
|
||||||
, definition(false)
|
|
||||||
, signal(false)
|
|
||||||
, slot(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
ExtraInfo(Utf8String token, Utf8String typeSpelling,
|
|
||||||
Utf8String semanticParentTypeSpelling, SourceRangeContainer cursorRange,
|
|
||||||
int lexicalParentIndex, AccessSpecifier accessSpecifier, StorageClass storageClass,
|
|
||||||
bool isIdentifier, bool isInclusion, bool isDeclaration, bool isDefinition,
|
|
||||||
bool isSignal, bool isSlot)
|
|
||||||
: token(token)
|
|
||||||
, typeSpelling(typeSpelling)
|
|
||||||
, semanticParentTypeSpelling(semanticParentTypeSpelling)
|
|
||||||
, cursorRange(cursorRange)
|
|
||||||
, lexicalParentIndex(lexicalParentIndex)
|
|
||||||
, accessSpecifier(accessSpecifier)
|
|
||||||
, storageClass(storageClass)
|
|
||||||
, identifier(isIdentifier)
|
|
||||||
, includeDirectivePath(isInclusion)
|
|
||||||
, declaration(isDeclaration)
|
|
||||||
, definition(isDefinition)
|
|
||||||
, signal(isSignal)
|
|
||||||
, slot(isSlot)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
Utf8String token;
|
|
||||||
Utf8String typeSpelling;
|
|
||||||
Utf8String semanticParentTypeSpelling;
|
|
||||||
SourceRangeContainer cursorRange;
|
|
||||||
int lexicalParentIndex = -1;
|
|
||||||
AccessSpecifier accessSpecifier = AccessSpecifier::Invalid;
|
|
||||||
StorageClass storageClass = StorageClass::Invalid;
|
|
||||||
bool identifier : 1;
|
|
||||||
bool includeDirectivePath : 1;
|
|
||||||
bool declaration : 1;
|
|
||||||
bool definition : 1;
|
|
||||||
bool signal : 1;
|
|
||||||
bool slot : 1;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, const ExtraInfo &extraInfo);
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, ExtraInfo &extraInfo);
|
|
||||||
inline bool operator==(const ExtraInfo &first, const ExtraInfo &second);
|
|
||||||
|
|
||||||
class TokenInfoContainer
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
TokenInfoContainer() = default;
|
|
||||||
TokenInfoContainer(int line, int column, int length, HighlightingTypes types)
|
|
||||||
: line(line)
|
|
||||||
, column(column)
|
|
||||||
, length(length)
|
|
||||||
, types(types)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
TokenInfoContainer(int line, int column, int length, HighlightingTypes types,
|
|
||||||
const ExtraInfo &extraInfo)
|
|
||||||
: line(line)
|
|
||||||
, column(column)
|
|
||||||
, length(length)
|
|
||||||
, types(types)
|
|
||||||
, extraInfo(extraInfo)
|
|
||||||
, noExtraInfo(false)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isInvalid() const
|
|
||||||
{
|
|
||||||
return line == 0 && column == 0 && length == 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool isGlobalDeclaration() const
|
|
||||||
{
|
|
||||||
if (types.mixinHighlightingTypes.contains(
|
|
||||||
ClangBackEnd::HighlightingType::TemplateTypeParameter)
|
|
||||||
|| types.mixinHighlightingTypes.contains(
|
|
||||||
ClangBackEnd::HighlightingType::TemplateTemplateParameter)) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return extraInfo.declaration
|
|
||||||
&& types.mainHighlightingType != HighlightingType::LocalVariable
|
|
||||||
&& types.mainHighlightingType != HighlightingType::Parameter
|
|
||||||
&& (types.mixinHighlightingTypes.contains(HighlightingType::Operator)
|
|
||||||
== extraInfo.token.startsWith("operator"));
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const TokenInfoContainer &container)
|
|
||||||
{
|
|
||||||
out << container.line;
|
|
||||||
out << container.column;
|
|
||||||
out << container.length;
|
|
||||||
out << container.types;
|
|
||||||
out << container.noExtraInfo;
|
|
||||||
|
|
||||||
if (container.noExtraInfo)
|
|
||||||
return out;
|
|
||||||
|
|
||||||
out << container.extraInfo;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, TokenInfoContainer &container)
|
|
||||||
{
|
|
||||||
in >> container.line;
|
|
||||||
in >> container.column;
|
|
||||||
in >> container.length;
|
|
||||||
in >> container.types;
|
|
||||||
in >> container.noExtraInfo;
|
|
||||||
|
|
||||||
if (container.noExtraInfo)
|
|
||||||
return in;
|
|
||||||
|
|
||||||
in >> container.extraInfo;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const TokenInfoContainer &first, const TokenInfoContainer &second)
|
|
||||||
{
|
|
||||||
return first.line == second.line
|
|
||||||
&& first.column == second.column
|
|
||||||
&& first.length == second.length
|
|
||||||
&& first.types == second.types
|
|
||||||
&& first.noExtraInfo == second.noExtraInfo
|
|
||||||
&& first.extraInfo == second.extraInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
int line = 0;
|
|
||||||
int column = 0;
|
|
||||||
int length = 0;
|
|
||||||
HighlightingTypes types;
|
|
||||||
ExtraInfo extraInfo;
|
|
||||||
bool noExtraInfo = true;
|
|
||||||
};
|
|
||||||
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, const ExtraInfo &extraInfo)
|
|
||||||
{
|
|
||||||
out << extraInfo.token;
|
|
||||||
out << extraInfo.typeSpelling;
|
|
||||||
out << extraInfo.semanticParentTypeSpelling;
|
|
||||||
out << extraInfo.cursorRange;
|
|
||||||
out << extraInfo.lexicalParentIndex;
|
|
||||||
out << static_cast<uint>(extraInfo.accessSpecifier);
|
|
||||||
out << static_cast<uint>(extraInfo.storageClass);
|
|
||||||
out << extraInfo.identifier;
|
|
||||||
out << extraInfo.includeDirectivePath;
|
|
||||||
out << extraInfo.declaration;
|
|
||||||
out << extraInfo.definition;
|
|
||||||
out << extraInfo.signal;
|
|
||||||
out << extraInfo.slot;
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, ExtraInfo &extraInfo)
|
|
||||||
{
|
|
||||||
in >> extraInfo.token;
|
|
||||||
in >> extraInfo.typeSpelling;
|
|
||||||
in >> extraInfo.semanticParentTypeSpelling;
|
|
||||||
in >> extraInfo.cursorRange;
|
|
||||||
in >> extraInfo.lexicalParentIndex;
|
|
||||||
|
|
||||||
uint accessSpecifier;
|
|
||||||
uint storageClass;
|
|
||||||
bool isIdentifier;
|
|
||||||
bool isInclusion;
|
|
||||||
bool isDeclaration;
|
|
||||||
bool isDefinition;
|
|
||||||
bool isSignal;
|
|
||||||
bool isSlot;
|
|
||||||
|
|
||||||
in >> accessSpecifier;
|
|
||||||
in >> storageClass;
|
|
||||||
in >> isIdentifier;
|
|
||||||
in >> isInclusion;
|
|
||||||
in >> isDeclaration;
|
|
||||||
in >> isDefinition;
|
|
||||||
in >> isSignal;
|
|
||||||
in >> isSlot;
|
|
||||||
|
|
||||||
extraInfo.accessSpecifier = static_cast<AccessSpecifier>(accessSpecifier);
|
|
||||||
extraInfo.storageClass = static_cast<StorageClass>(storageClass);
|
|
||||||
extraInfo.identifier = isIdentifier;
|
|
||||||
extraInfo.includeDirectivePath = isInclusion;
|
|
||||||
extraInfo.declaration = isDeclaration;
|
|
||||||
extraInfo.definition = isDefinition;
|
|
||||||
extraInfo.signal = isSignal;
|
|
||||||
extraInfo.slot = isSlot;
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator==(const ExtraInfo &first, const ExtraInfo &second)
|
|
||||||
{
|
|
||||||
return first.token == second.token
|
|
||||||
&& first.typeSpelling == second.typeSpelling
|
|
||||||
&& first.semanticParentTypeSpelling == second.semanticParentTypeSpelling
|
|
||||||
&& first.cursorRange == second.cursorRange
|
|
||||||
&& first.lexicalParentIndex == second.lexicalParentIndex
|
|
||||||
&& first.accessSpecifier == second.accessSpecifier
|
|
||||||
&& first.storageClass == second.storageClass
|
|
||||||
&& first.identifier == second.identifier
|
|
||||||
&& first.includeDirectivePath == second.includeDirectivePath
|
|
||||||
&& first.declaration == second.declaration
|
|
||||||
&& first.definition == second.definition
|
|
||||||
&& first.signal == second.signal
|
|
||||||
&& first.slot == second.slot;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, HighlightingType highlightingType)
|
|
||||||
{
|
|
||||||
out << static_cast<quint8>(highlightingType);
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, HighlightingTypes highlightingTypes)
|
|
||||||
{
|
|
||||||
out << highlightingTypes.mainHighlightingType;
|
|
||||||
|
|
||||||
out << highlightingTypes.mixinHighlightingTypes.size();
|
|
||||||
|
|
||||||
for (HighlightingType type : highlightingTypes.mixinHighlightingTypes)
|
|
||||||
out << type;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, HighlightingType &highlightingType)
|
|
||||||
{
|
|
||||||
quint8 highlightingTypeInt;
|
|
||||||
|
|
||||||
in >> highlightingTypeInt;
|
|
||||||
|
|
||||||
highlightingType = static_cast<HighlightingType>(highlightingTypeInt);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, HighlightingTypes &highlightingTypes)
|
|
||||||
{
|
|
||||||
in >> highlightingTypes.mainHighlightingType ;
|
|
||||||
|
|
||||||
quint8 size;
|
|
||||||
in >> size;
|
|
||||||
|
|
||||||
for (int counter = 0; counter < size; ++counter) {
|
|
||||||
HighlightingType type;
|
|
||||||
in >> type;
|
|
||||||
highlightingTypes.mixinHighlightingTypes.push_back(type);
|
|
||||||
}
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator==(const MixinHighlightingTypes &first, const MixinHighlightingTypes &second)
|
|
||||||
{
|
|
||||||
return first.size() == second.size()
|
|
||||||
&& std::equal(first.begin(), first.end(), second.begin());
|
|
||||||
}
|
|
||||||
|
|
||||||
inline bool operator==(const HighlightingTypes &first, const HighlightingTypes &second)
|
|
||||||
{
|
|
||||||
return first.mainHighlightingType == second.mainHighlightingType
|
|
||||||
&& first.mixinHighlightingTypes == second.mixinHighlightingTypes;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream &operator<<(QDataStream &out, ByteSizeBitset bits)
|
|
||||||
{
|
|
||||||
// Narrow unsigned long to uint8_t
|
|
||||||
out << static_cast<uint8_t>(bits.to_ulong());
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
inline QDataStream &operator>>(QDataStream &in, ByteSizeBitset &bits)
|
|
||||||
{
|
|
||||||
uint8_t byteValue;
|
|
||||||
in >> byteValue;
|
|
||||||
bits = ByteSizeBitset(byteValue);
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const TokenInfoContainer &container);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,65 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "tooltipinfo.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
#define RETURN_TEXT_FOR_CASE(enumValue) case ToolTipInfo::enumValue: return #enumValue
|
|
||||||
const char *qdocCategoryToString(ToolTipInfo::QdocCategory category)
|
|
||||||
{
|
|
||||||
switch (category) {
|
|
||||||
RETURN_TEXT_FOR_CASE(Unknown);
|
|
||||||
RETURN_TEXT_FOR_CASE(ClassOrNamespace);
|
|
||||||
RETURN_TEXT_FOR_CASE(Enum);
|
|
||||||
RETURN_TEXT_FOR_CASE(Typedef);
|
|
||||||
RETURN_TEXT_FOR_CASE(Macro);
|
|
||||||
RETURN_TEXT_FOR_CASE(Brief);
|
|
||||||
RETURN_TEXT_FOR_CASE(Function);
|
|
||||||
}
|
|
||||||
|
|
||||||
return "UnhandledQdocCategory";
|
|
||||||
}
|
|
||||||
#undef RETURN_TEXT_FOR_CASE
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const ToolTipInfo &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "ToolTipInfo(";
|
|
||||||
|
|
||||||
debug.nospace() << message.text << ", ";
|
|
||||||
debug.nospace() << message.briefComment << ", ";
|
|
||||||
debug.nospace() << message.qdocIdCandidates << ", ";
|
|
||||||
debug.nospace() << message.qdocMark << ", ";
|
|
||||||
debug.nospace() << qdocCategoryToString(message.qdocCategory) << ", ";
|
|
||||||
debug.nospace() << message.sizeInBytes << ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,113 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
#include <utf8stringvector.h>
|
|
||||||
|
|
||||||
#include <QVariant>
|
|
||||||
|
|
||||||
#include "clangsupport_global.h"
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class ToolTipInfo
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
enum QdocCategory : quint8 {
|
|
||||||
Unknown,
|
|
||||||
ClassOrNamespace,
|
|
||||||
Enum,
|
|
||||||
Typedef,
|
|
||||||
Macro,
|
|
||||||
Brief,
|
|
||||||
Function,
|
|
||||||
};
|
|
||||||
|
|
||||||
public:
|
|
||||||
ToolTipInfo() = default;
|
|
||||||
ToolTipInfo(const Utf8String &text) : text(text) {}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const ToolTipInfo &message)
|
|
||||||
{
|
|
||||||
out << message.text;
|
|
||||||
out << message.briefComment;
|
|
||||||
out << message.qdocIdCandidates;
|
|
||||||
out << message.qdocMark;
|
|
||||||
out << static_cast<quint8>(message.qdocCategory);
|
|
||||||
out << message.value;
|
|
||||||
out << message.sizeInBytes;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, ToolTipInfo &message)
|
|
||||||
{
|
|
||||||
quint8 qdocCategory;
|
|
||||||
|
|
||||||
in >> message.text;
|
|
||||||
in >> message.briefComment;
|
|
||||||
in >> message.qdocIdCandidates;
|
|
||||||
in >> message.qdocMark;
|
|
||||||
in >> qdocCategory;
|
|
||||||
in >> message.value;
|
|
||||||
in >> message.sizeInBytes;
|
|
||||||
|
|
||||||
message.qdocCategory = static_cast<QdocCategory>(qdocCategory);
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const ToolTipInfo &first, const ToolTipInfo &second)
|
|
||||||
{
|
|
||||||
return first.text == second.text
|
|
||||||
&& first.briefComment == second.briefComment
|
|
||||||
&& first.qdocIdCandidates == second.qdocIdCandidates
|
|
||||||
&& first.qdocMark == second.qdocMark
|
|
||||||
&& first.qdocCategory == second.qdocCategory
|
|
||||||
&& first.value == second.value
|
|
||||||
&& first.sizeInBytes == second.sizeInBytes;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
Utf8String text;
|
|
||||||
Utf8String briefComment;
|
|
||||||
|
|
||||||
Utf8StringVector qdocIdCandidates;
|
|
||||||
Utf8String qdocMark;
|
|
||||||
QdocCategory qdocCategory = Unknown;
|
|
||||||
QVariant value;
|
|
||||||
|
|
||||||
// For class definition and for class fields.
|
|
||||||
Utf8String sizeInBytes;
|
|
||||||
};
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const ToolTipInfo &message);
|
|
||||||
std::ostream &operator<<(std::ostream &os, const ToolTipInfo &message);
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT const char *qdocCategoryToString(ToolTipInfo::QdocCategory category);
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,44 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "tooltipmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const ToolTipMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "ToolTipMessage("
|
|
||||||
<< message.fileContainer
|
|
||||||
<< ", " << message.ticketNumber
|
|
||||||
<< ", " << message.toolTipInfo;
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,82 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2018 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
#include "tooltipinfo.h"
|
|
||||||
|
|
||||||
#include <QDataStream>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class ToolTipMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
ToolTipMessage() = default;
|
|
||||||
ToolTipMessage(const FileContainer &fileContainer,
|
|
||||||
const ToolTipInfo &toolTipInfo,
|
|
||||||
quint64 ticketNumber)
|
|
||||||
: fileContainer(fileContainer)
|
|
||||||
, toolTipInfo(toolTipInfo)
|
|
||||||
, ticketNumber(ticketNumber)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const ToolTipMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainer;
|
|
||||||
out << message.toolTipInfo;;
|
|
||||||
out << message.ticketNumber;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, ToolTipMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainer;
|
|
||||||
in >> message.toolTipInfo;
|
|
||||||
in >> message.ticketNumber;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const ToolTipMessage &first, const ToolTipMessage &second)
|
|
||||||
{
|
|
||||||
return first.ticketNumber == second.ticketNumber
|
|
||||||
&& first.fileContainer == second.fileContainer
|
|
||||||
&& first.toolTipInfo == second.toolTipInfo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
FileContainer fileContainer;
|
|
||||||
ToolTipInfo toolTipInfo;
|
|
||||||
quint64 ticketNumber = 0;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const ToolTipMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(ToolTipMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,45 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "unsavedfilesremovedmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const UnsavedFilesRemovedMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "UnsavedFilesRemovedMessage(";
|
|
||||||
|
|
||||||
for (const FileContainer &fileContainer : message.fileContainers)
|
|
||||||
debug.nospace() << fileContainer<< ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,70 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class UnsavedFilesRemovedMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
UnsavedFilesRemovedMessage() = default;
|
|
||||||
UnsavedFilesRemovedMessage(const QVector<FileContainer> &fileContainers)
|
|
||||||
: fileContainers(fileContainers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesRemovedMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainers;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, UnsavedFilesRemovedMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainers;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const UnsavedFilesRemovedMessage &first,
|
|
||||||
const UnsavedFilesRemovedMessage &second)
|
|
||||||
{
|
|
||||||
return first.fileContainers == second.fileContainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
QVector<FileContainer> fileContainers;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnsavedFilesRemovedMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(UnsavedFilesRemovedMessage)
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,45 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "unsavedfilesupdatedmessage.h"
|
|
||||||
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const UnsavedFilesUpdatedMessage &message)
|
|
||||||
{
|
|
||||||
debug.nospace() << "UnsavedFilesUpdatedMessage(";
|
|
||||||
|
|
||||||
for (const FileContainer &fileContainer : message.fileContainers)
|
|
||||||
debug.nospace() << fileContainer<< ", ";
|
|
||||||
|
|
||||||
debug.nospace() << ")";
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
} // namespace ClangBackEnd
|
|
||||||
|
|
@@ -1,70 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#pragma once
|
|
||||||
|
|
||||||
#include "filecontainer.h"
|
|
||||||
|
|
||||||
#include <QVector>
|
|
||||||
|
|
||||||
namespace ClangBackEnd {
|
|
||||||
|
|
||||||
class UnsavedFilesUpdatedMessage
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
UnsavedFilesUpdatedMessage() = default;
|
|
||||||
UnsavedFilesUpdatedMessage(const QVector<FileContainer> &fileContainers)
|
|
||||||
: fileContainers(fileContainers)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator<<(QDataStream &out, const UnsavedFilesUpdatedMessage &message)
|
|
||||||
{
|
|
||||||
out << message.fileContainers;
|
|
||||||
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend QDataStream &operator>>(QDataStream &in, UnsavedFilesUpdatedMessage &message)
|
|
||||||
{
|
|
||||||
in >> message.fileContainers;
|
|
||||||
|
|
||||||
return in;
|
|
||||||
}
|
|
||||||
|
|
||||||
friend bool operator==(const UnsavedFilesUpdatedMessage &first,
|
|
||||||
const UnsavedFilesUpdatedMessage &second)
|
|
||||||
{
|
|
||||||
return first.fileContainers == second.fileContainers;
|
|
||||||
}
|
|
||||||
|
|
||||||
public:
|
|
||||||
QVector<FileContainer> fileContainers;
|
|
||||||
};
|
|
||||||
|
|
||||||
CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const UnsavedFilesUpdatedMessage &message);
|
|
||||||
|
|
||||||
DECLARE_MESSAGE(UnsavedFilesUpdatedMessage);
|
|
||||||
} // namespace ClangBackEnd
|
|
@@ -1,58 +0,0 @@
|
|||||||
/****************************************************************************
|
|
||||||
**
|
|
||||||
** Copyright (C) 2016 The Qt Company Ltd.
|
|
||||||
** Contact: https://www.qt.io/licensing/
|
|
||||||
**
|
|
||||||
** This file is part of Qt Creator.
|
|
||||||
**
|
|
||||||
** Commercial License Usage
|
|
||||||
** Licensees holding valid commercial Qt licenses may use this file in
|
|
||||||
** accordance with the commercial license agreement provided with the
|
|
||||||
** Software or, alternatively, in accordance with the terms contained in
|
|
||||||
** a written agreement between you and The Qt Company. For licensing terms
|
|
||||||
** and conditions see https://www.qt.io/terms-conditions. For further
|
|
||||||
** information use the contact form at https://www.qt.io/contact-us.
|
|
||||||
**
|
|
||||||
** GNU General Public License Usage
|
|
||||||
** Alternatively, this file may be used under the terms of the GNU
|
|
||||||
** General Public License version 3 as published by the Free Software
|
|
||||||
** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
|
|
||||||
** included in the packaging of this file. Please review the following
|
|
||||||
** information to ensure the GNU General Public License requirements will
|
|
||||||
** be met: https://www.gnu.org/licenses/gpl-3.0.html.
|
|
||||||
**
|
|
||||||
****************************************************************************/
|
|
||||||
|
|
||||||
#include "utf8string.h"
|
|
||||||
|
|
||||||
#include "utf8stringvector.h"
|
|
||||||
|
|
||||||
#include <QString>
|
|
||||||
#include <QDebug>
|
|
||||||
|
|
||||||
#include <ostream>
|
|
||||||
|
|
||||||
QDebug operator<<(QDebug debug, const Utf8String &text)
|
|
||||||
{
|
|
||||||
debug << text.constData();
|
|
||||||
|
|
||||||
return debug;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::ostream& operator<<(std::ostream &os, const Utf8String &utf8String)
|
|
||||||
{
|
|
||||||
using std::ostream;
|
|
||||||
os << utf8String.constData();
|
|
||||||
|
|
||||||
return os;
|
|
||||||
}
|
|
||||||
|
|
||||||
Utf8StringVector Utf8String::split(char separator) const
|
|
||||||
{
|
|
||||||
Utf8StringVector utf8Vector;
|
|
||||||
|
|
||||||
for (const QByteArray &byteArrayPart : byteArray.split(separator))
|
|
||||||
utf8Vector.append(Utf8String::fromByteArray(byteArrayPart));
|
|
||||||
|
|
||||||
return utf8Vector;
|
|
||||||
}
|
|
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user