aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMarco Bubke <marco.bubke@qt.io>2019-07-03 17:57:43 +0200
committerMarco Bubke <marco.bubke@qt.io>2019-07-04 08:41:10 +0000
commit376aae271132b39664d381f00bdcd45856acbd73 (patch)
tree7275d4d96b2005857e0df1c66ef9b5a45ea326b1 /src
parentf864c7a0d8e0da6ee41c3fede96af06db1cc08b9 (diff)
Clang: Remove old code
We maybe bring back the clang query interface but the local rename is better served by other plugins. Change-Id: I97bedcb20870632b7dd50977794a65b2b09ededb Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Diffstat (limited to 'src')
-rw-r--r--src/libs/clangsupport/clangrefactoringclientmessages.h1
-rw-r--r--src/libs/clangsupport/clangrefactoringservermessages.h1
-rw-r--r--src/libs/clangsupport/clangsupport-lib.pri5
-rw-r--r--src/libs/clangsupport/refactoringclientinterface.cpp3
-rw-r--r--src/libs/clangsupport/refactoringclientinterface.h2
-rw-r--r--src/libs/clangsupport/refactoringclientproxy.cpp5
-rw-r--r--src/libs/clangsupport/refactoringclientproxy.h3
-rw-r--r--src/libs/clangsupport/refactoringserverinterface.cpp3
-rw-r--r--src/libs/clangsupport/refactoringserverinterface.h2
-rw-r--r--src/libs/clangsupport/refactoringserverproxy.cpp5
-rw-r--r--src/libs/clangsupport/refactoringserverproxy.h1
-rw-r--r--src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp41
-rw-r--r--src/libs/clangsupport/requestsourcelocationforrenamingmessage.h108
-rw-r--r--src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp39
-rw-r--r--src/libs/clangsupport/sourcelocationsforrenamingmessage.h87
-rw-r--r--src/plugins/clangrefactoring/clangrefactoringplugin.cpp6
-rw-r--r--src/plugins/clangrefactoring/refactoringclient.cpp21
-rw-r--r--src/plugins/clangrefactoring/refactoringclient.h7
-rw-r--r--src/plugins/clangrefactoring/refactoringengine.cpp32
-rw-r--r--src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri7
-rw-r--r--src/tools/clangrefactoringbackend/source/findcursorusr.h191
-rw-r--r--src/tools/clangrefactoringbackend/source/findlocationsofusrs.h126
-rw-r--r--src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp128
-rw-r--r--src/tools/clangrefactoringbackend/source/findusrforcursoraction.h70
-rw-r--r--src/tools/clangrefactoringbackend/source/refactoringserver.cpp16
-rw-r--r--src/tools/clangrefactoringbackend/source/refactoringserver.h1
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolfinder.cpp79
-rw-r--r--src/tools/clangrefactoringbackend/source/symbolfinder.h58
-rw-r--r--src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp99
-rw-r--r--src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h71
30 files changed, 3 insertions, 1215 deletions
diff --git a/src/libs/clangsupport/clangrefactoringclientmessages.h b/src/libs/clangsupport/clangrefactoringclientmessages.h
index 012ca0431d..87b61b4c6b 100644
--- a/src/libs/clangsupport/clangrefactoringclientmessages.h
+++ b/src/libs/clangsupport/clangrefactoringclientmessages.h
@@ -27,6 +27,5 @@
#include "alivemessage.h"
#include "progressmessage.h"
-#include "sourcelocationsforrenamingmessage.h"
#include "sourcerangesanddiagnosticsforquerymessage.h"
#include "sourcerangesforquerymessage.h"
diff --git a/src/libs/clangsupport/clangrefactoringservermessages.h b/src/libs/clangsupport/clangrefactoringservermessages.h
index dd1cb3a6d7..8a79518c7e 100644
--- a/src/libs/clangsupport/clangrefactoringservermessages.h
+++ b/src/libs/clangsupport/clangrefactoringservermessages.h
@@ -27,7 +27,6 @@
#include "cancelmessage.h"
#include "endmessage.h"
-#include "requestsourcelocationforrenamingmessage.h"
#include "requestsourcerangesanddiagnosticsforquerymessage.h"
#include "requestsourcerangesforquerymessage.h"
#include "removegeneratedfilesmessage.h"
diff --git a/src/libs/clangsupport/clangsupport-lib.pri b/src/libs/clangsupport/clangsupport-lib.pri
index 1705be3c26..18896c0ea0 100644
--- a/src/libs/clangsupport/clangsupport-lib.pri
+++ b/src/libs/clangsupport/clangsupport-lib.pri
@@ -56,14 +56,12 @@ SOURCES += \
$$PWD/requestannotationsmessage.cpp \
$$PWD/requestfollowsymbolmessage.cpp \
$$PWD/requestreferencesmessage.cpp \
- $$PWD/requestsourcelocationforrenamingmessage.cpp \
$$PWD/requestsourcerangesanddiagnosticsforquerymessage.cpp \
$$PWD/requestsourcerangesforquerymessage.cpp \
$$PWD/requesttooltipmessage.cpp \
$$PWD/sourcelocationcontainer.cpp \
$$PWD/sourcelocationcontainerv2.cpp \
$$PWD/sourcelocationscontainer.cpp \
- $$PWD/sourcelocationsforrenamingmessage.cpp \
$$PWD/sourcerangecontainer.cpp \
$$PWD/processcreator.cpp \
$$PWD/processexception.cpp \
@@ -120,7 +118,6 @@ HEADERS += \
$$PWD/projectpartid.h \
$$PWD/projectpartsstorage.h \
$$PWD/projectpartsstorageinterface.h \
- $$PWD/projectsourcechunk.h \
$$PWD/requestcompletionsmessage.h \
$$PWD/echomessage.h \
$$PWD/endmessage.h \
@@ -164,14 +161,12 @@ HEADERS += \
$$PWD/requestannotationsmessage.h \
$$PWD/requestfollowsymbolmessage.h \
$$PWD/requestreferencesmessage.h \
- $$PWD/requestsourcelocationforrenamingmessage.h \
$$PWD/requestsourcerangesanddiagnosticsforquerymessage.h \
$$PWD/requestsourcerangesforquerymessage.h \
$$PWD/requesttooltipmessage.h \
$$PWD/sourcelocationcontainer.h \
$$PWD/sourcelocationcontainerv2.h \
$$PWD/sourcelocationscontainer.h \
- $$PWD/sourcelocationsforrenamingmessage.h \
$$PWD/sourcerangecontainer.h \
$$PWD/filepath.h \
$$PWD/processcreator.h \
diff --git a/src/libs/clangsupport/refactoringclientinterface.cpp b/src/libs/clangsupport/refactoringclientinterface.cpp
index 5e3b98df66..e862e4e4d9 100644
--- a/src/libs/clangsupport/refactoringclientinterface.cpp
+++ b/src/libs/clangsupport/refactoringclientinterface.cpp
@@ -38,9 +38,6 @@ void RefactoringClientInterface::dispatch(const MessageEnvelop &messageEnvelop)
case MessageType::AliveMessage:
alive();
break;
- case MessageType::SourceLocationsForRenamingMessage:
- sourceLocationsForRenamingMessage(messageEnvelop.message<SourceLocationsForRenamingMessage>());
- break;
case MessageType::SourceRangesAndDiagnosticsForQueryMessage:
sourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<SourceRangesAndDiagnosticsForQueryMessage>());
break;
diff --git a/src/libs/clangsupport/refactoringclientinterface.h b/src/libs/clangsupport/refactoringclientinterface.h
index c1127592d6..c7d2fcf7d0 100644
--- a/src/libs/clangsupport/refactoringclientinterface.h
+++ b/src/libs/clangsupport/refactoringclientinterface.h
@@ -47,10 +47,8 @@ public:
void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void alive() = 0;
- virtual void sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message) = 0;
virtual void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) = 0;
virtual void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) = 0;
- virtual void setLocalRenamingCallback(RenameCallback &&localRenamingCallback) = 0;
virtual void progress(ProgressMessage &&message) = 0;
protected:
diff --git a/src/libs/clangsupport/refactoringclientproxy.cpp b/src/libs/clangsupport/refactoringclientproxy.cpp
index 646cb0e161..b2d30d7bfb 100644
--- a/src/libs/clangsupport/refactoringclientproxy.cpp
+++ b/src/libs/clangsupport/refactoringclientproxy.cpp
@@ -66,11 +66,6 @@ void RefactoringClientProxy::alive()
writeMessageBlock.write(AliveMessage());
}
-void RefactoringClientProxy::sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message)
-{
- writeMessageBlock.write(message);
-}
-
void RefactoringClientProxy::sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message)
{
writeMessageBlock.write(message);
diff --git a/src/libs/clangsupport/refactoringclientproxy.h b/src/libs/clangsupport/refactoringclientproxy.h
index 07cba05e8d..371ae91f82 100644
--- a/src/libs/clangsupport/refactoringclientproxy.h
+++ b/src/libs/clangsupport/refactoringclientproxy.h
@@ -50,13 +50,10 @@ public:
void readMessages();
void alive() override;
- void sourceLocationsForRenamingMessage(SourceLocationsForRenamingMessage &&message) override;
void sourceRangesAndDiagnosticsForQueryMessage(SourceRangesAndDiagnosticsForQueryMessage &&message) override;
void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) override;
void progress(ProgressMessage &&message) override;
- void setLocalRenamingCallback(RenameCallback &&) final {}
-
private:
ClangBackEnd::WriteMessageBlock writeMessageBlock;
ClangBackEnd::ReadMessageBlock readMessageBlock;
diff --git a/src/libs/clangsupport/refactoringserverinterface.cpp b/src/libs/clangsupport/refactoringserverinterface.cpp
index a95837f80a..6fcaa0f054 100644
--- a/src/libs/clangsupport/refactoringserverinterface.cpp
+++ b/src/libs/clangsupport/refactoringserverinterface.cpp
@@ -38,9 +38,6 @@ void RefactoringServerInterface::dispatch(const MessageEnvelop &messageEnvelop)
case MessageType::EndMessage:
end();
break;
- case MessageType::RequestSourceLocationsForRenamingMessage:
- requestSourceLocationsForRenamingMessage(messageEnvelop.message<RequestSourceLocationsForRenamingMessage>());
- break;
case MessageType::RequestSourceRangesAndDiagnosticsForQueryMessage:
requestSourceRangesAndDiagnosticsForQueryMessage(messageEnvelop.message<RequestSourceRangesAndDiagnosticsForQueryMessage>());
break;
diff --git a/src/libs/clangsupport/refactoringserverinterface.h b/src/libs/clangsupport/refactoringserverinterface.h
index 2dcc503860..a8a677427c 100644
--- a/src/libs/clangsupport/refactoringserverinterface.h
+++ b/src/libs/clangsupport/refactoringserverinterface.h
@@ -32,7 +32,6 @@
namespace ClangBackEnd {
class RefactoringClientInterface;
-class RequestSourceLocationsForRenamingMessage;
class RequestSourceRangesAndDiagnosticsForQueryMessage;
class RequestSourceRangesForQueryMessage;
class CancelMessage;
@@ -46,7 +45,6 @@ public:
void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void end() = 0;
- virtual void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) = 0;
virtual void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) = 0;
virtual void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) = 0;
virtual void cancel() = 0;
diff --git a/src/libs/clangsupport/refactoringserverproxy.cpp b/src/libs/clangsupport/refactoringserverproxy.cpp
index 2208f3a0ce..a206a2531b 100644
--- a/src/libs/clangsupport/refactoringserverproxy.cpp
+++ b/src/libs/clangsupport/refactoringserverproxy.cpp
@@ -50,11 +50,6 @@ void RefactoringServerProxy::end()
m_writeMessageBlock.write(EndMessage());
}
-void RefactoringServerProxy::requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message)
-{
- m_writeMessageBlock.write(message);
-}
-
void RefactoringServerProxy::requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message)
{
m_writeMessageBlock.write(message);
diff --git a/src/libs/clangsupport/refactoringserverproxy.h b/src/libs/clangsupport/refactoringserverproxy.h
index 34861767d8..4b91036c46 100644
--- a/src/libs/clangsupport/refactoringserverproxy.h
+++ b/src/libs/clangsupport/refactoringserverproxy.h
@@ -52,7 +52,6 @@ public:
explicit RefactoringServerProxy(RefactoringClientInterface *client, QIODevice *ioDevice);
void end() override;
- void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) override;
void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) override;
void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) override;
void updateProjectParts(UpdateProjectPartsMessage &&message) override;
diff --git a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp b/src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp
deleted file mode 100644
index dd25a3ebae..0000000000
--- a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.cpp
+++ /dev/null
@@ -1,41 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#include "requestsourcelocationforrenamingmessage.h"
-
-namespace ClangBackEnd {
-
-QDebug operator<<(QDebug debug, const RequestSourceLocationsForRenamingMessage &message)
-{
- debug.nospace() << "RequestSourceLocationsForRenamingMessage("
- << message.filePath << ", "
- << message.line << ", "
- << message.column << ", "
- << message.unsavedContent << ")";
-
- return debug;
-}
-
-} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.h b/src/libs/clangsupport/requestsourcelocationforrenamingmessage.h
deleted file mode 100644
index 9082e0dfaf..0000000000
--- a/src/libs/clangsupport/requestsourcelocationforrenamingmessage.h
+++ /dev/null
@@ -1,108 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangsupport_global.h"
-#include "filepath.h"
-
-#include <utils/smallstringvector.h>
-
-namespace ClangBackEnd {
-
-class CLANGSUPPORT_EXPORT RequestSourceLocationsForRenamingMessage
-{
-public:
- RequestSourceLocationsForRenamingMessage() = default;
- RequestSourceLocationsForRenamingMessage(FilePath &&filePath,
- uint line,
- uint column,
- Utils::SmallString &&unsavedContent,
- Utils::SmallStringVector &&commandLine,
- int textDocumentRevision)
- : filePath(std::move(filePath)),
- unsavedContent(std::move(unsavedContent)),
- commandLine(std::move(commandLine)),
- line(line),
- column(column),
- textDocumentRevision(textDocumentRevision)
- {}
-
- friend QDataStream &operator<<(QDataStream &out, const RequestSourceLocationsForRenamingMessage &message)
- {
- out << message.filePath;
- out << message.unsavedContent;
- out << message.commandLine;
- out << message.line;
- out << message.column;
- out << message.textDocumentRevision;
-
- return out;
- }
-
- friend QDataStream &operator>>(QDataStream &in, RequestSourceLocationsForRenamingMessage &message)
- {
- in >> message.filePath;
- in >> message.unsavedContent;
- in >> message.commandLine;
- in >> message.line;
- in >> message.column;
- in >> message.textDocumentRevision;
-
- return in;
- }
-
- friend bool operator==(const RequestSourceLocationsForRenamingMessage &first, const RequestSourceLocationsForRenamingMessage &second)
- {
- return first.filePath == second.filePath
- && first.line == second.line
- && first.column == second.column
- && first.textDocumentRevision == second.textDocumentRevision
- && first.unsavedContent == second.unsavedContent
- && first.commandLine == second.commandLine;
- }
-
- RequestSourceLocationsForRenamingMessage clone() const
- {
- return RequestSourceLocationsForRenamingMessage(filePath.clone(),
- line, column,
- unsavedContent.clone(),
- commandLine.clone(),
- textDocumentRevision);
- }
-
-public:
- FilePath filePath;
- Utils::SmallString unsavedContent;
- Utils::SmallStringVector commandLine;
- uint line = 1;
- uint column = 1;
- int textDocumentRevision = 1;
-};
-
-CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const RequestSourceLocationsForRenamingMessage &message);
-
-DECLARE_MESSAGE(RequestSourceLocationsForRenamingMessage)
-} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp b/src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp
deleted file mode 100644
index 3490738531..0000000000
--- a/src/libs/clangsupport/sourcelocationsforrenamingmessage.cpp
+++ /dev/null
@@ -1,39 +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 "sourcelocationsforrenamingmessage.h"
-
-namespace ClangBackEnd {
-
-QDebug operator<<(QDebug debug, const SourceLocationsForRenamingMessage &message)
-{
- debug.nospace() << "SourceLocationsForRenamingMessage("
- << message.sourceLocations
- << ")";
-
- return debug;
-}
-
-} // namespace ClangBackEnd
diff --git a/src/libs/clangsupport/sourcelocationsforrenamingmessage.h b/src/libs/clangsupport/sourcelocationsforrenamingmessage.h
deleted file mode 100644
index 5be072677c..0000000000
--- a/src/libs/clangsupport/sourcelocationsforrenamingmessage.h
+++ /dev/null
@@ -1,87 +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 "sourcelocationscontainer.h"
-
-#include <utils/smallstring.h>
-
-namespace ClangBackEnd {
-
-class SourceLocationsForRenamingMessage
-{
-public:
- SourceLocationsForRenamingMessage() = default;
- SourceLocationsForRenamingMessage(Utils::SmallString &&symbolName,
- SourceLocationsContainer &&sourceLocationContainer,
- int textDocumentRevision)
- : symbolName(std::move(symbolName)),
- sourceLocations(std::move(sourceLocationContainer)),
- textDocumentRevision(textDocumentRevision)
- {}
-
- friend QDataStream &operator<<(QDataStream &out, const SourceLocationsForRenamingMessage &message)
- {
- out << message.symbolName;
- out << message.sourceLocations;
- out << message.textDocumentRevision;
-
- return out;
- }
-
- friend QDataStream &operator>>(QDataStream &in, SourceLocationsForRenamingMessage &message)
- {
- in >> message.symbolName;
- in >> message.sourceLocations;
- in >> message.textDocumentRevision;
-
- return in;
- }
-
- friend bool operator==(const SourceLocationsForRenamingMessage &first, const SourceLocationsForRenamingMessage &second)
- {
- return first.textDocumentRevision == second.textDocumentRevision
- && first.symbolName == second.symbolName
- && first.sourceLocations == second.sourceLocations;
- }
-
- SourceLocationsForRenamingMessage clone() const
- {
- return SourceLocationsForRenamingMessage(symbolName.clone(),
- sourceLocations.clone(),
- textDocumentRevision);
- }
-
-public:
- Utils::SmallString symbolName;
- SourceLocationsContainer sourceLocations;
- int textDocumentRevision = 0;
-};
-
-CLANGSUPPORT_EXPORT QDebug operator<<(QDebug debug, const SourceLocationsForRenamingMessage &message);
-
-DECLARE_MESSAGE(SourceLocationsForRenamingMessage)
-} // namespace ClangBackEnd
diff --git a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp
index 059eff4c78..d33e4e2b88 100644
--- a/src/plugins/clangrefactoring/clangrefactoringplugin.cpp
+++ b/src/plugins/clangrefactoring/clangrefactoringplugin.cpp
@@ -96,10 +96,6 @@ public:
SymbolQuery<QuerySqliteReadStatementFactory> symbolQuery{statementFactory};
ClangBackEnd::ProjectPartsStorage<Sqlite::Database> projectPartsStorage{database};
RefactoringEngine engine{connectionClient.serverProxy(), refactoringClient, filePathCache, symbolQuery};
- QtCreatorSearch qtCreatorSearch;
- QtCreatorClangQueryFindFilter qtCreatorfindFilter{connectionClient.serverProxy(),
- qtCreatorSearch,
- refactoringClient};
QtCreatorRefactoringProjectUpdater projectUpdate{connectionClient.serverProxy(),
ClangPchManagerPlugin::pchManagerClient(),
filePathCache,
@@ -126,7 +122,6 @@ bool ClangRefactoringPlugin::initialize(const QStringList & /*arguments*/, QStri
d->refactoringClient.setRefactoringEngine(&d->engine);
d->refactoringClient.setRefactoringConnectionClient(&d->connectionClient);
- ExtensionSystem::PluginManager::addObject(&d->qtCreatorfindFilter);
connectBackend();
startBackend();
@@ -145,7 +140,6 @@ void ClangRefactoringPlugin::extensionsInitialized()
ExtensionSystem::IPlugin::ShutdownFlag ClangRefactoringPlugin::aboutToShutdown()
{
- ExtensionSystem::PluginManager::removeObject(&d->qtCreatorfindFilter);
CppTools::CppModelManager::removeRefactoringEngine(
CppTools::RefactoringEngineType::ClangRefactoring);
d->refactoringClient.setRefactoringConnectionClient(nullptr);
diff --git a/src/plugins/clangrefactoring/refactoringclient.cpp b/src/plugins/clangrefactoring/refactoringclient.cpp
index 3bdeb9dd53..e39e27a22a 100644
--- a/src/plugins/clangrefactoring/refactoringclient.cpp
+++ b/src/plugins/clangrefactoring/refactoringclient.cpp
@@ -40,16 +40,6 @@ void RefactoringClient::alive()
m_connectionClient->resetProcessAliveTimer();
}
-void RefactoringClient::sourceLocationsForRenamingMessage(
- ClangBackEnd::SourceLocationsForRenamingMessage &&message)
-{
- m_localRenamingCallback(message.symbolName.toQString(),
- message.sourceLocations,
- message.textDocumentRevision);
-
- m_refactoringEngine->setRefactoringEngineAvailable(true);
-}
-
void RefactoringClient::sourceRangesAndDiagnosticsForQueryMessage(
ClangBackEnd::SourceRangesAndDiagnosticsForQueryMessage &&message)
{
@@ -64,12 +54,6 @@ void RefactoringClient::sourceRangesForQueryMessage(ClangBackEnd::SourceRangesFo
setResultCounterAndSendSearchIsFinishedIfFinished();
}
-void RefactoringClient::setLocalRenamingCallback(
- CppTools::RefactoringEngineInterface::RenameCallback &&localRenamingCallback)
-{
- m_localRenamingCallback = std::move(localRenamingCallback);
-}
-
void RefactoringClient::progress(ClangBackEnd::ProgressMessage &&message)
{
m_progressManager.setProgress(message.progress, message.total);
@@ -100,11 +84,6 @@ void RefactoringClient::setClangQueryHighlighter(ClangQueryHighlighter *highligh
m_clangQueryHighlighter = highlighter;
}
-bool RefactoringClient::hasValidLocalRenamingCallback() const
-{
- return bool(m_localRenamingCallback);
-}
-
void RefactoringClient::setExpectedResultCount(uint count)
{
m_expectedResultCount = count;
diff --git a/src/plugins/clangrefactoring/refactoringclient.h b/src/plugins/clangrefactoring/refactoringclient.h
index f3d9e218e5..a68fe39211 100644
--- a/src/plugins/clangrefactoring/refactoringclient.h
+++ b/src/plugins/clangrefactoring/refactoringclient.h
@@ -54,15 +54,11 @@ public:
{}
void alive() override;
- void sourceLocationsForRenamingMessage(
- ClangBackEnd::SourceLocationsForRenamingMessage &&message) override;
void sourceRangesAndDiagnosticsForQueryMessage(
ClangBackEnd::SourceRangesAndDiagnosticsForQueryMessage &&message) override;
void sourceRangesForQueryMessage(
ClangBackEnd::SourceRangesForQueryMessage &&message) override;
- void setLocalRenamingCallback(
- CppTools::RefactoringEngineInterface::RenameCallback &&localRenamingCallback) override;
void progress(ClangBackEnd::ProgressMessage &&message) override;
void setRefactoringEngine(ClangRefactoring::RefactoringEngine *refactoringEngine);
@@ -71,8 +67,6 @@ public:
void setClangQueryExampleHighlighter(ClangQueryExampleHighlighter *highlighter);
void setClangQueryHighlighter(ClangQueryHighlighter *highlighter);
- bool hasValidLocalRenamingCallback() const;
-
void setExpectedResultCount(uint count);
uint expectedResultCount() const;
uint resultCounter() const;
@@ -90,7 +84,6 @@ private:
void sendSearchIsFinished();
private:
- CppTools::RefactoringEngineInterface::RenameCallback m_localRenamingCallback;
ClangBackEnd::RefactoringConnectionClient *m_connectionClient = nullptr;
SearchHandle *m_searchHandle = nullptr;
RefactoringEngine *m_refactoringEngine = nullptr;
diff --git a/src/plugins/clangrefactoring/refactoringengine.cpp b/src/plugins/clangrefactoring/refactoringengine.cpp
index 38f857ef1c..cc9121331d 100644
--- a/src/plugins/clangrefactoring/refactoringengine.cpp
+++ b/src/plugins/clangrefactoring/refactoringengine.cpp
@@ -28,7 +28,6 @@
#include <filepath.h>
#include <refactoringserverinterface.h>
-#include <requestsourcelocationforrenamingmessage.h>
#include <cpptools/compileroptionsbuilder.h>
#include <cpptools/cpptoolsreuse.h>
@@ -47,7 +46,6 @@
namespace ClangRefactoring {
-using ClangBackEnd::RequestSourceLocationsForRenamingMessage;
RefactoringEngine::RefactoringEngine(ClangBackEnd::RefactoringServerInterface &server,
ClangBackEnd::RefactoringClientInterface &client,
@@ -62,34 +60,10 @@ RefactoringEngine::RefactoringEngine(ClangBackEnd::RefactoringServerInterface &s
RefactoringEngine::~RefactoringEngine() = default;
-void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &data,
- CppTools::ProjectPart *projectPart,
- RenameCallback &&renameSymbolsCallback)
+void RefactoringEngine::startLocalRenaming(const CppTools::CursorInEditor &,
+ CppTools::ProjectPart *,
+ RenameCallback &&)
{
- using CppTools::CompilerOptionsBuilder;
-
- setRefactoringEngineAvailable(false);
-
- m_client.setLocalRenamingCallback(std::move(renameSymbolsCallback));
-
- QString filePath = data.filePath().toString();
- QTextCursor textCursor = data.cursor();
- CompilerOptionsBuilder optionsBuilder{*projectPart, CppTools::UseSystemHeader::Yes};
- Utils::SmallStringVector commandLine{optionsBuilder.build(
- fileKindInProjectPart(projectPart, filePath),
- CppTools::getPchUsage())};
-
- commandLine.push_back(filePath);
-
- RequestSourceLocationsForRenamingMessage message(ClangBackEnd::FilePath(filePath),
- uint(textCursor.blockNumber() + 1),
- uint(textCursor.positionInBlock() + 1),
- textCursor.document()->toPlainText(),
- std::move(commandLine),
- textCursor.document()->revision());
-
-
- m_server.requestSourceLocationsForRenamingMessage(std::move(message));
}
CppTools::Usages RefactoringEngine::locationsAt(const CppTools::CursorInEditor &data) const
diff --git a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri
index a3da84d83b..9c51093632 100644
--- a/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri
+++ b/src/tools/clangrefactoringbackend/source/clangrefactoringbackend-source.pri
@@ -26,11 +26,8 @@ HEADERS += \
!isEmpty(LIBTOOLING_LIBS) {
SOURCES += \
$$PWD/refactoringcompilationdatabase.cpp \
- $$PWD/symbolfinder.cpp \
- $$PWD/symbollocationfinderaction.cpp \
$$PWD/refactoringserver.cpp \
$$PWD/macropreprocessorcallbacks.cpp \
- $$PWD/findusrforcursoraction.cpp \
$$PWD/clangquery.cpp \
$$PWD/clangtool.cpp \
$$PWD/sourcerangeextractor.cpp \
@@ -44,14 +41,10 @@ SOURCES += \
HEADERS += \
$$PWD/refactoringcompilationdatabase.h \
- $$PWD/symbolfinder.h \
- $$PWD/symbollocationfinderaction.h \
$$PWD/refactoringserver.h \
$$PWD/macropreprocessorcallbacks.h \
$$PWD/sourcelocationsutils.h \
$$PWD/findcursorusr.h \
- $$PWD/findusrforcursoraction.h \
- $$PWD/findlocationsofusrs.h \
$$PWD/clangquery.h \
$$PWD/clangtool.h \
$$PWD/sourcerangeextractor.h \
diff --git a/src/tools/clangrefactoringbackend/source/findcursorusr.h b/src/tools/clangrefactoringbackend/source/findcursorusr.h
deleted file mode 100644
index 06777d8611..0000000000
--- a/src/tools/clangrefactoringbackend/source/findcursorusr.h
+++ /dev/null
@@ -1,191 +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 "clangrefactoringbackend_global.h"
-
-#include <clang/AST/AST.h>
-#include <clang/AST/ASTContext.h>
-#include <clang/AST/RecursiveASTVisitor.h>
-#include <clang/Index/USRGeneration.h>
-#include <llvm/ADT/SmallVector.h>
-
-#include <vector>
-
-namespace ClangBackEnd {
-
-class FindNamedDeclarationASTVisitor : public clang::RecursiveASTVisitor<FindNamedDeclarationASTVisitor>
-{
-public:
- explicit FindNamedDeclarationASTVisitor(const clang::SourceManager &sourceManager,
- const clang::SourceLocation cursorSourceLocation)
- : m_sourceManager(sourceManager),
- m_cursorSourceLocation(cursorSourceLocation)
- {
- }
-
- bool shouldVisitTemplateInstantiations() const
- {
- return true;
- }
-
- bool VisitNamedDecl(const clang::NamedDecl *declaration)
- {
- auto name = declaration->getNameAsString();
-
- setResultIfCursorIsInBetween(declaration,
- declaration->getLocation(),
- declaration->getNameAsString().length());
-
- return true;
- }
-
- bool VisitDeclRefExpr(const clang::DeclRefExpr *expression)
- {
- if (!iterateNestedNameSpecifierLocation(expression->getQualifierLoc()))
- return false;
-
- const auto *declaration = expression->getFoundDecl();
- return setResultIfCursorIsInBetween(declaration,
- expression->getLocation(),
- declaration->getNameAsString().length());
- }
-
- bool VisitMemberExpr(const clang::MemberExpr *expression)
- {
- const auto *declaration = expression->getFoundDecl().getDecl();
- return setResultIfCursorIsInBetween(declaration,
- expression->getMemberLoc(),
- declaration->getNameAsString().length());
- }
-
- std::vector<const clang::NamedDecl*> takeNamedDecl()
- {
- return std::move(m_namedDeclarations);
- }
-
-private:
- bool canSetResult(const clang::NamedDecl *declaration,
- clang::SourceLocation location)
- {
- return declaration
- && !setResultIfCursorIsInBetween(declaration,
- location,
- declaration->getNameAsString().length());
- }
-
- bool iterateNestedNameSpecifierLocation(clang::NestedNameSpecifierLoc nameLocation) {
- while (nameLocation) {
- const auto *declaration = nameLocation.getNestedNameSpecifier()->getAsNamespace();
- if (canSetResult(declaration, nameLocation.getLocalBeginLoc()))
- return false;
-
- nameLocation = nameLocation.getPrefix();
- }
-
- return true;
- }
-
- bool isValidLocationWithCursorInside(clang::SourceLocation startLocation,
- clang::SourceLocation endLocation)
- {
- return startLocation.isValid()
- && startLocation.isFileID()
- && endLocation.isValid()
- && endLocation.isFileID()
- && isCursorLocationBetween(startLocation, endLocation);
- }
-
- bool setResultIfCursorIsInBetween(const clang::NamedDecl *declaration,
- clang::SourceLocation startLocation,
- clang::SourceLocation endLocation)
- {
- bool isValid = isValidLocationWithCursorInside(startLocation, endLocation);
-
- if (isValid)
- m_namedDeclarations.push_back(declaration);
-
- return !isValid;
- }
-
- bool setResultIfCursorIsInBetween(const clang::NamedDecl *declaration,
- clang::SourceLocation location,
- uint offset) {
- return offset == 0
- || setResultIfCursorIsInBetween(declaration, location, location.getLocWithOffset(offset - 1));
- }
-
- bool isCursorLocationBetween(const clang::SourceLocation startLocation,
- const clang::SourceLocation endLocation)
- {
- return m_cursorSourceLocation == startLocation
- || m_cursorSourceLocation == endLocation
- || (m_sourceManager.isBeforeInTranslationUnit(startLocation, m_cursorSourceLocation)
- && m_sourceManager.isBeforeInTranslationUnit(m_cursorSourceLocation, endLocation));
- }
-
- std::vector<const clang::NamedDecl*> m_namedDeclarations;
- const clang::SourceManager &m_sourceManager;
- const clang::SourceLocation m_cursorSourceLocation;
-};
-
-inline
-std::vector<const clang::NamedDecl *> namedDeclarationsAt(const clang::ASTContext &Context,
- const clang::SourceLocation cursorSourceLocation)
-{
- const auto &sourceManager = Context.getSourceManager();
- const auto currentFile = sourceManager.getFilename(cursorSourceLocation);
-
- FindNamedDeclarationASTVisitor visitor(sourceManager, cursorSourceLocation);
-
- auto declarations = Context.getTranslationUnitDecl()->decls();
- for (auto &currentDeclation : declarations) {
- const auto &fileLocation = currentDeclation->getBeginLoc();
- const auto &fileName = sourceManager.getFilename(fileLocation);
- if (fileName == currentFile) {
- visitor.TraverseDecl(currentDeclation);
- const auto &namedDeclarations = visitor.takeNamedDecl();
-
- if (!namedDeclarations.empty())
- return namedDeclarations;
- }
- }
-
- return std::vector<const clang::NamedDecl *>();
-}
-
-inline
-USRName USROfDeclaration(const clang::Decl *declaration)
-{
- USRName buffer;
-
- if (declaration == nullptr || clang::index::generateUSRForDecl(declaration, buffer))
- return buffer;
-
- return buffer;
-}
-
-} // namespace ClangBackend
diff --git a/src/tools/clangrefactoringbackend/source/findlocationsofusrs.h b/src/tools/clangrefactoringbackend/source/findlocationsofusrs.h
deleted file mode 100644
index b6662205da..0000000000
--- a/src/tools/clangrefactoringbackend/source/findlocationsofusrs.h
+++ /dev/null
@@ -1,126 +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 "findcursorusr.h"
-
-#include <clang/AST/ASTContext.h>
-#include <clang/AST/RecursiveASTVisitor.h>
-#include <clang/Basic/SourceLocation.h>
-#include <clang/Index/USRGeneration.h>
-#include <llvm/ADT/SmallVector.h>
-
-#include <vector>
-
-namespace ClangBackEnd {
-
-class FindLocationsOfUSRsASTVisitor : public clang::RecursiveASTVisitor<FindLocationsOfUSRsASTVisitor>
-{
-public:
- explicit FindLocationsOfUSRsASTVisitor(const std::vector<USRName> &unifiedSymbolResolutions)
- : unifiedSymbolResolutions(unifiedSymbolResolutions)
- {
- }
-
- bool VisitNamedDecl(const clang::NamedDecl *declaration) {
- auto declarationUSR = USROfDeclaration(declaration);
-
- if (containsUSR(declarationUSR))
- foundLocations.push_back(declaration->getLocation());
-
- return true;
- }
-
- bool VisitDeclRefExpr(const clang::DeclRefExpr *expression) {
- const auto *declaration = expression->getFoundDecl();
-
- iterateNestedNameSpecifierLocation(expression->getQualifierLoc());
- auto declarationUSR = USROfDeclaration(declaration);
-
- if (containsUSR(declarationUSR))
- foundLocations.push_back(expression->getLocation());
-
- return true;
- }
-
- bool VisitMemberExpr(const clang::MemberExpr *expression) {
- const auto *declaration = expression->getFoundDecl().getDecl();
- auto declarationUSR = USROfDeclaration(declaration);
-
- if (containsUSR(declarationUSR))
- foundLocations.push_back(expression->getMemberLoc());
-
- return true;
- }
-
- bool shouldVisitTemplateInstantiations() const
- {
- return true;
- }
-
- std::vector<clang::SourceLocation> takeFoundLocations() const {
- return std::move(foundLocations);
- }
-
-private:
- void iterateNestedNameSpecifierLocation(clang::NestedNameSpecifierLoc nameLocation) {
- while (nameLocation) {
- const auto *declaration = nameLocation.getNestedNameSpecifier()->getAsNamespace();
- if (declaration && containsUSR(USROfDeclaration(declaration)))
- foundLocations.push_back(nameLocation.getLocalBeginLoc());
-
- nameLocation = nameLocation.getPrefix();
- }
- }
-
- bool containsUSR(const USRName &unifiedSymbolResolution)
- {
- auto found = std::find(unifiedSymbolResolutions.cbegin(),
- unifiedSymbolResolutions.cend(),
- unifiedSymbolResolution);
-
- return found != unifiedSymbolResolutions.cend();
- }
-
-private:
-
- // All the locations of the USR were found.
- const std::vector<USRName> unifiedSymbolResolutions;
- std::vector<clang::SourceLocation> foundLocations;
-};
-
-inline
-std::vector<clang::SourceLocation> takeLocationsOfUSRs(std::vector<USRName> &unifiedSymbolResolutions,
- clang::Decl *declartation)
-{
- FindLocationsOfUSRsASTVisitor visitor(unifiedSymbolResolutions);
-
- visitor.TraverseDecl(declartation);
-
- return visitor.takeFoundLocations();
-}
-
-} // namespace ClangBackend
diff --git a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp b/src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp
deleted file mode 100644
index 6fa964f531..0000000000
--- a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.cpp
+++ /dev/null
@@ -1,128 +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 "findusrforcursoraction.h"
-
-#include "findcursorusr.h"
-
-#include <clang/AST/AST.h>
-#include <clang/AST/ASTConsumer.h>
-#include <clang/AST/ASTContext.h>
-
-#include <algorithm>
-#include <vector>
-
-namespace ClangBackEnd {
-
-namespace {
-
-std::vector<USRName> collectConstructorUnifiedSymbolResolutions(const clang::CXXRecordDecl *declarations)
-{
- std::vector<USRName> unifiedSymbolResolutions;
-
- const auto constructorDeclarations = declarations->getDefinition()->ctors();
-
- std::transform(constructorDeclarations.begin(),
- constructorDeclarations.end(),
- std::back_inserter(unifiedSymbolResolutions),
- USROfDeclaration);
-
- return unifiedSymbolResolutions;
-}
-
-void addUnifiedSymbolResolutionsForDeclaration(const std::vector<const clang::NamedDecl *> &declarations,
- std::vector<USRName> &usrs)
-{
-
- std::transform(declarations.begin(),
- declarations.end(),
- std::back_inserter(usrs),
- [&] (const clang::NamedDecl *declaration) {
- return USROfDeclaration(declaration);
- });
-}
-
-}
-
-class FindDeclarationsConsumer : public clang::ASTConsumer
-{
-public:
- FindDeclarationsConsumer(Utils::SmallString &symbolName,
- std::vector<USRName> &unifiedSymbolResolutions,
- uint line,
- uint column)
- : m_symbolName(symbolName),
- m_unifiedSymbolResolutions(unifiedSymbolResolutions),
- m_line(line),
- m_column(column)
- {
- }
-
- void HandleTranslationUnit(clang::ASTContext &astContext) override {
- const auto &sourceManager = astContext.getSourceManager();
- const auto cursorSourceLocation = sourceManager.translateLineCol(sourceManager.getMainFileID(),
- m_line,
- m_column);
-
- if (cursorSourceLocation.isValid())
- collectUnifiedSymbolResoltions(astContext, cursorSourceLocation);
- }
-
- void collectUnifiedSymbolResoltions(clang::ASTContext &astContext,
- const clang::SourceLocation &cursorSourceLocation)
- {
- const auto foundDeclarations = namedDeclarationsAt(astContext, cursorSourceLocation);
-
- if (!foundDeclarations.empty()) {
- const auto firstFoundDeclaration = foundDeclarations.front();
-
- if (const auto *constructorDecl = clang::dyn_cast<clang::CXXConstructorDecl>(firstFoundDeclaration)) {
- const clang::CXXRecordDecl *foundDeclarationParent = constructorDecl->getParent();
- m_unifiedSymbolResolutions = collectConstructorUnifiedSymbolResolutions(foundDeclarationParent);
- } else if (const auto *destructorDecl = clang::dyn_cast<clang::CXXDestructorDecl>(firstFoundDeclaration)) {
- const clang::CXXRecordDecl *foundDeclarationParent = destructorDecl->getParent();
- m_unifiedSymbolResolutions = collectConstructorUnifiedSymbolResolutions(foundDeclarationParent);
- } else if (const auto *recordDeclaration = clang::dyn_cast<clang::CXXRecordDecl>(firstFoundDeclaration)) {
- m_unifiedSymbolResolutions = collectConstructorUnifiedSymbolResolutions(recordDeclaration);
- }
-
- addUnifiedSymbolResolutionsForDeclaration(foundDeclarations, m_unifiedSymbolResolutions);
- m_symbolName = firstFoundDeclaration->getNameAsString();
- }
- }
-
-private:
- Utils::SmallString &m_symbolName;
- std::vector<USRName> &m_unifiedSymbolResolutions;
- uint m_line;
- uint m_column;
-};
-
-std::unique_ptr<clang::ASTConsumer>
-USRFindingAction::newASTConsumer() {
- return std::make_unique<FindDeclarationsConsumer>(m_symbolName, m_unifiedSymbolResolutions, m_line, m_column);
-}
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.h b/src/tools/clangrefactoringbackend/source/findusrforcursoraction.h
deleted file mode 100644
index bfa4a373a4..0000000000
--- a/src/tools/clangrefactoringbackend/source/findusrforcursoraction.h
+++ /dev/null
@@ -1,70 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangrefactoringbackend_global.h"
-
-#include <utils/smallstring.h>
-
-#include <clang/Frontend/FrontendAction.h>
-
-namespace clang {
-class ASTConsumer;
-class CompilerInstance;
-class NamedDecl;
-}
-
-namespace ClangBackEnd {
-
-class USRFindingAction
-{
-public:
- USRFindingAction(uint line, uint column)
- : m_line(line),
- m_column(column)
- {
- }
-
- std::unique_ptr<clang::ASTConsumer> newASTConsumer();
-
- std::string takeSymbolName()
- {
- return std::string(m_symbolName);
- }
-
- std::vector<USRName> takeUnifiedSymbolResolutions()
- {
- return std::move(m_unifiedSymbolResolutions);
- }
-
-private:
- Utils::SmallString m_symbolName;
- std::vector<USRName> m_unifiedSymbolResolutions;
- uint m_line;
- uint m_column;
-};
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/refactoringserver.cpp b/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
index 83aa5a31fd..387f850c0f 100644
--- a/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
+++ b/src/tools/clangrefactoringbackend/source/refactoringserver.cpp
@@ -25,7 +25,6 @@
#include "refactoringserver.h"
-#include "symbolfinder.h"
#include "clangquery.h"
#include "symbolindexing.h"
@@ -58,21 +57,6 @@ void RefactoringServer::end()
QCoreApplication::exit();
}
-void RefactoringServer::requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message)
-{
- SymbolFinder symbolFinder(message.line, message.column, m_filePathCache);
-
- symbolFinder.addFile(std::move(message.filePath),
- std::move(message.unsavedContent),
- std::move(message.commandLine));
-
- symbolFinder.findSymbol();
-
- client()->sourceLocationsForRenamingMessage({symbolFinder.takeSymbolName(),
- symbolFinder.takeSourceLocations(),
- message.textDocumentRevision});
-}
-
void RefactoringServer::requestSourceRangesAndDiagnosticsForQueryMessage(
RequestSourceRangesAndDiagnosticsForQueryMessage &&message)
{
diff --git a/src/tools/clangrefactoringbackend/source/refactoringserver.h b/src/tools/clangrefactoringbackend/source/refactoringserver.h
index 75b161f1ab..7934790518 100644
--- a/src/tools/clangrefactoringbackend/source/refactoringserver.h
+++ b/src/tools/clangrefactoringbackend/source/refactoringserver.h
@@ -60,7 +60,6 @@ public:
GeneratedFiles &generatedFiles);
void end() override;
- void requestSourceLocationsForRenamingMessage(RequestSourceLocationsForRenamingMessage &&message) override;
void requestSourceRangesAndDiagnosticsForQueryMessage(RequestSourceRangesAndDiagnosticsForQueryMessage &&message) override;
void requestSourceRangesForQueryMessage(RequestSourceRangesForQueryMessage &&message) override;
void updateProjectParts(UpdateProjectPartsMessage &&message) override;
diff --git a/src/tools/clangrefactoringbackend/source/symbolfinder.cpp b/src/tools/clangrefactoringbackend/source/symbolfinder.cpp
deleted file mode 100644
index 8f002f10a1..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbolfinder.cpp
+++ /dev/null
@@ -1,79 +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 "symbolfinder.h"
-
-#include "locationsourcefilecallbacks.h"
-#include "symbollocationfinderaction.h"
-
-namespace ClangBackEnd {
-
-SymbolFinder::SymbolFinder(uint line, uint column, FilePathCachingInterface &filePathCache)
- : m_usrFindingAction(line, column),
- m_symbolLocationFinderAction(filePathCache),
- m_sourceFileCallbacks(line, column, filePathCache)
-{
-}
-
-void SymbolFinder::findSymbol()
-{
- clang::tooling::ClangTool tool = createTool();
-
- tool.run(clang::tooling::newFrontendActionFactory(&m_usrFindingAction, &m_sourceFileCallbacks).get());
-
- if (m_sourceFileCallbacks.hasSourceLocations()) {
- m_sourceLocations_ = m_sourceFileCallbacks.takeSourceLocations();
- m_symbolName = m_sourceFileCallbacks.takeSymbolName();
- } else {
- m_symbolLocationFinderAction.setUnifiedSymbolResolutions(m_usrFindingAction.takeUnifiedSymbolResolutions());
-
- tool.run(clang::tooling::newFrontendActionFactory(&m_symbolLocationFinderAction).get());
-
- m_sourceLocations_ = m_symbolLocationFinderAction.takeSourceLocations();
- m_symbolName = m_usrFindingAction.takeSymbolName();
- }
-}
-
-Utils::SmallString SymbolFinder::takeSymbolName()
-{
- return std::move(m_symbolName);
-}
-
-const std::vector<USRName> &SymbolFinder::unifiedSymbolResolutions()
-{
- return m_symbolLocationFinderAction.unifiedSymbolResolutions();
-}
-
-const SourceLocationsContainer &SymbolFinder::sourceLocations() const
-{
- return m_sourceLocations_;
-}
-
-SourceLocationsContainer SymbolFinder::takeSourceLocations()
-{
- return std::move(m_sourceLocations_);
-}
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbolfinder.h b/src/tools/clangrefactoringbackend/source/symbolfinder.h
deleted file mode 100644
index a3c9659032..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbolfinder.h
+++ /dev/null
@@ -1,58 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangtool.h"
-#include "findusrforcursoraction.h"
-#include "symbollocationfinderaction.h"
-#include "locationsourcefilecallbacks.h"
-
-#include <filepathcachingfwd.h>
-#include <sourcelocationscontainer.h>
-
-namespace ClangBackEnd {
-
-class SymbolFinder : public ClangTool
-{
-public:
- SymbolFinder(uint line, uint column, FilePathCachingInterface &filePathCache);
-
- void findSymbol();
-
- Utils::SmallString takeSymbolName();
- const std::vector<USRName> &unifiedSymbolResolutions();
- const SourceLocationsContainer &sourceLocations() const;
- SourceLocationsContainer takeSourceLocations();
-
-private:
- Utils::SmallString m_symbolName;
- USRFindingAction m_usrFindingAction;
- SymbolLocationFinderAction m_symbolLocationFinderAction;
- LocationSourceFileCallbacks m_sourceFileCallbacks;
- ClangBackEnd::SourceLocationsContainer m_sourceLocations_;
-};
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp b/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp
deleted file mode 100644
index eddcf683c7..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.cpp
+++ /dev/null
@@ -1,99 +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 "symbollocationfinderaction.h"
-
-#include "sourcelocationsutils.h"
-#include "findlocationsofusrs.h"
-
-#include <filepathcachingfwd.h>
-
-#include <clang/AST/ASTConsumer.h>
-#include <clang/AST/ASTContext.h>
-
-#include <memory>
-
-namespace ClangBackEnd {
-
-class FindingSymbolsASTConsumer : public clang::ASTConsumer
-{
-public:
- FindingSymbolsASTConsumer(std::vector<USRName> &unifiedSymbolResolutions,
- FilePathCachingInterface &filePathCache)
- : m_unifiedSymbolResolutions(unifiedSymbolResolutions),
- m_filePathCache(filePathCache)
- {
- }
-
- void HandleTranslationUnit(clang::ASTContext &context) override
- {
- std::vector<clang::SourceLocation> sourceLocations;
-
-
- auto &&sourceLocationsOfUsr = takeLocationsOfUSRs(m_unifiedSymbolResolutions, context.getTranslationUnitDecl());
- sourceLocations.insert(sourceLocations.end(),
- sourceLocationsOfUsr.begin(),
- sourceLocationsOfUsr.end());
-
-
- std::sort(sourceLocations.begin(), sourceLocations.end());
- auto newEnd = std::unique(sourceLocations.begin(), sourceLocations.end());
- sourceLocations.erase(newEnd, sourceLocations.end());
-
- updateSourceLocations(sourceLocations, context.getSourceManager());
-
- }
-
- void updateSourceLocations(const std::vector<clang::SourceLocation> &sourceLocations,
- const clang::SourceManager &sourceManager)
- {
- appendSourceLocationsToSourceLocationsContainer(*m_sourceLocationsContainer,
- sourceLocations,
- sourceManager,
- m_filePathCache);
- }
-
- void setSourceLocations(ClangBackEnd::SourceLocationsContainer *sourceLocations)
- {
- m_sourceLocationsContainer = sourceLocations;
- }
-
-private:
- ClangBackEnd::SourceLocationsContainer *m_sourceLocationsContainer = nullptr;
- std::vector<USRName> &m_unifiedSymbolResolutions;
- FilePathCachingInterface &m_filePathCache;
-};
-
-std::unique_ptr<clang::ASTConsumer> SymbolLocationFinderAction::newASTConsumer()
-{
- auto consumer = std::make_unique<FindingSymbolsASTConsumer>(m_unifiedSymbolResolutions_,
- m_filePathCache);
-
- consumer->setSourceLocations(&m_sourceLocations);
-
- return consumer;
-}
-
-} // namespace ClangBackEnd
diff --git a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h b/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h
deleted file mode 100644
index e3f4c4a2f3..0000000000
--- a/src/tools/clangrefactoringbackend/source/symbollocationfinderaction.h
+++ /dev/null
@@ -1,71 +0,0 @@
-/****************************************************************************
-**
-** Copyright (C) 2016 The Qt Company Ltd.
-** Contact: https://www.qt.io/licensing/
-**
-** This file is part of Qt Creator.
-**
-** Commercial License Usage
-** Licensees holding valid commercial Qt licenses may use this file in
-** accordance with the commercial license agreement provided with the
-** Software or, alternatively, in accordance with the terms contained in
-** a written agreement between you and The Qt Company. For licensing terms
-** and conditions see https://www.qt.io/terms-conditions. For further
-** information use the contact form at https://www.qt.io/contact-us.
-**
-** GNU General Public License Usage
-** Alternatively, this file may be used under the terms of the GNU
-** General Public License version 3 as published by the Free Software
-** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT
-** included in the packaging of this file. Please review the following
-** information to ensure the GNU General Public License requirements will
-** be met: https://www.gnu.org/licenses/gpl-3.0.html.
-**
-****************************************************************************/
-
-#pragma once
-
-#include "clangrefactoringbackend_global.h"
-
-#include <filepathcachingfwd.h>
-#include <sourcelocationscontainer.h>
-
-#include <clang/Tooling/Refactoring.h>
-
-namespace clang {
-class ASTConsumer;
-}
-
-namespace ClangBackEnd {
-
-class SymbolLocationFinderAction
-{
-public:
- SymbolLocationFinderAction(FilePathCachingInterface &filePathCache)
- : m_filePathCache(filePathCache)
- {}
-
- std::unique_ptr<clang::ASTConsumer> newASTConsumer();
-
- SourceLocationsContainer takeSourceLocations()
- {
- return std::move(m_sourceLocations);
- }
-
- void setUnifiedSymbolResolutions(std::vector<USRName> &&unifiedSymbolResolutions)
- {
- m_unifiedSymbolResolutions_ = std::move(unifiedSymbolResolutions);
- }
-
- const std::vector<USRName> &unifiedSymbolResolutions() const
- {
- return m_unifiedSymbolResolutions_;
- }
-
-private:
- ClangBackEnd::SourceLocationsContainer m_sourceLocations;
- std::vector<USRName> m_unifiedSymbolResolutions_;
- FilePathCachingInterface &m_filePathCache;
-};
-
-} // namespace ClangBackEnd