Clang: Improve interfaces

The interfaces should never used to handle ownership. So it is now using
protected destructors. Copy operations are forbidden too.

https://github.com/isocpp/CppCoreGuidelines/blob/master/CppCoreGuidelines.md#c35-a-base-class-destructor-should-be-either-public-and-virtual-or-protected-and-nonvirtual

Change-Id: Ib0b60a73a7ec130973b5cb0095cc5b2f10fa0758
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
Marco Bubke
2018-03-12 14:08:18 +01:00
parent f1e02c0826
commit 9c4bfbe20a
52 changed files with 186 additions and 316 deletions

View File

@@ -45,6 +45,9 @@ public:
void setIoDevice(QIODevice *ioDevice);
protected:
~BaseServerProxy() = default;
protected:
ClangBackEnd::WriteMessageBlock m_writeMessageBlock;
ClangBackEnd::ReadMessageBlock m_readMessageBlock;

View File

@@ -63,6 +63,9 @@ public:
virtual void references(const ReferencesMessage &message) = 0;
virtual void followSymbol(const FollowSymbolMessage &message) = 0;
virtual void tooltip(const ToolTipMessage &message) = 0;
protected:
~ClangCodeModelClientInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -33,15 +33,20 @@ namespace ClangBackEnd {
class ClangPathWatcherNotifier;
class CLANGSUPPORT_EXPORT ClangPathWatcherInterface
class ClangPathWatcherInterface
{
public:
virtual ~ClangPathWatcherInterface();
ClangPathWatcherInterface() = default;
ClangPathWatcherInterface(const ClangPathWatcherInterface &) = delete;
ClangPathWatcherInterface &operator=(const ClangPathWatcherInterface &) = delete;
virtual void updateIdPaths(const std::vector<IdPaths> &idPaths) = 0;
virtual void removeIds(const Utils::SmallStringVector &ids) = 0;
virtual void setNotifier(ClangPathWatcherNotifier *notifier) = 0;
protected:
~ClangPathWatcherInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -33,16 +33,18 @@
namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT ClangPathWatcherNotifier
class ClangPathWatcherNotifier
{
public:
ClangPathWatcherNotifier() = default;
virtual ~ClangPathWatcherNotifier();
ClangPathWatcherNotifier(const ClangPathWatcherNotifier &) = delete;
void operator=(const ClangPathWatcherNotifier &) = delete;
ClangPathWatcherNotifier &operator=(const ClangPathWatcherNotifier &) = delete;
virtual void pathsWithIdsChanged(const Utils::SmallStringVector &ids) = 0;
virtual void pathsChanged(const FilePathIds &filePathIds) = 0;
protected:
~ClangPathWatcherNotifier() = default;
};
} // namespace ClangBackEnd

View File

@@ -16,8 +16,6 @@ SOURCES += \
$$PWD/clangcodemodelconnectionclient.cpp \
$$PWD/clangcodemodelserverinterface.cpp \
$$PWD/clangcodemodelserverproxy.cpp \
$$PWD/clangpathwatcherinterface.cpp \
$$PWD/clangpathwatchernotifier.cpp \
$$PWD/cmbalivemessage.cpp \
$$PWD/cmbcodecompletedmessage.cpp \
$$PWD/cmbcompletecodemessage.cpp \
@@ -41,9 +39,6 @@ SOURCES += \
$$PWD/filepath.cpp \
$$PWD/fixitcontainer.cpp \
$$PWD/followsymbolmessage.cpp \
$$PWD/ipcclientinterface.cpp \
$$PWD/ipcinterface.cpp \
$$PWD/ipcserverinterface.cpp \
$$PWD/lineprefixer.cpp \
$$PWD/messageenvelop.cpp \
$$PWD/pchmanagerclientinterface.cpp \
@@ -92,8 +87,7 @@ SOURCES += \
$$PWD/writemessageblock.cpp \
$$PWD/filepathcaching.cpp \
$$PWD/filepathid.cpp \
$$PWD/baseserverproxy.cpp \
$$PWD/projectpartpchproviderinterface.cpp
$$PWD/baseserverproxy.cpp
HEADERS += \
$$PWD/cancelmessage.h \

View File

@@ -54,7 +54,9 @@ class CLANGSUPPORT_EXPORT ConnectionClient : public QObject
public:
ConnectionClient(const QString &connectionName);
virtual ~ConnectionClient();
ConnectionClient(const ConnectionClient &) = delete;
ConnectionClient &operator=(const ConnectionClient &) = delete;
void startProcessAndConnectToServerAsynchronously();
void disconnectFromServer();
@@ -82,6 +84,9 @@ signals:
void disconnectedFromLocalSocket();
void processFinished();
protected:
~ConnectionClient();
protected:
QIODevice *ioDevice();
const QTemporaryDir &temporaryDirectory() const;

View File

@@ -36,7 +36,7 @@
namespace ClangBackEnd {
template <typename FilePathStorage>
class CLANGSUPPORT_GCCEXPORT FilePathCache
class FilePathCache
{
using DirectoryPathCache = StringCache<Utils::PathString,
int,
@@ -53,6 +53,9 @@ public:
: m_filePathStorage(filePathStorage)
{}
FilePathCache(const FilePathCache &) = delete;
FilePathCache &operator=(const FilePathCache &) = delete;
FilePathId filePathId(FilePathView filePath) const
{
Utils::SmallStringView directoryPath = filePath.directory();

View File

@@ -34,6 +34,10 @@ namespace ClangBackEnd {
class FilePathCachingInterface
{
public:
FilePathCachingInterface() = default;
FilePathCachingInterface(const FilePathCachingInterface &) = delete;
FilePathCachingInterface &operator=(const FilePathCachingInterface &) = delete;
virtual FilePathId filePathId(FilePathView filePath) const = 0;
virtual FilePath filePath(FilePathId filePathId) const = 0;
@@ -69,6 +73,9 @@ public:
return filePaths;
}
protected:
~FilePathCachingInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -29,10 +29,10 @@
namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT IpcClientInterface : public IpcInterface
class IpcClientInterface : public IpcInterface
{
public:
IpcClientInterface();
protected:
~IpcClientInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -33,11 +33,17 @@ namespace ClangBackEnd {
class MessageEnvelop;
class CLANGSUPPORT_EXPORT IpcInterface
class IpcInterface
{
public:
virtual ~IpcInterface();
IpcInterface() = default;
IpcInterface(const IpcInterface &) = delete;
IpcInterface &operator=(const IpcInterface &) = delete;
virtual void dispatch(const MessageEnvelop &messageEnvelop) = 0;
protected:
~IpcInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -31,6 +31,8 @@ namespace ClangBackEnd {
class IpcServerInterface : public IpcInterface
{
protected:
~IpcServerInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -38,6 +38,9 @@ public:
virtual void alive() = 0;
virtual void precompiledHeadersUpdated(PrecompiledHeadersUpdatedMessage &&message) = 0;
protected:
~PchManagerClientInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -41,6 +41,9 @@ public:
void dispatch(const MessageEnvelop &messageEnvelop) override;
virtual void end() = 0;
protected:
~PchManagerServerInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -32,11 +32,14 @@ namespace ClangBackEnd {
class RemoveProjectPartsMessage;
class UpdateProjectPartsMessage;
class CLANGSUPPORT_EXPORT ProjectManagementServerInterface : public IpcInterface
class ProjectManagementServerInterface : public IpcInterface
{
public:
virtual void updateProjectParts(UpdateProjectPartsMessage &&message) = 0;
virtual void removeProjectParts(RemoveProjectPartsMessage &&message) = 0;
protected:
~ProjectManagementServerInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -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 "projectpartpchproviderinterface.h"
namespace ClangBackEnd {
ProjectPartPchProviderInterface::~ProjectPartPchProviderInterface()
{
}
} // namespace ClangBackEnd

View File

@@ -31,14 +31,20 @@
namespace ClangBackEnd {
class CLANGSUPPORT_EXPORT ProjectPartPchProviderInterface
class ProjectPartPchProviderInterface
{
public:
virtual ~ProjectPartPchProviderInterface();
ProjectPartPchProviderInterface() = default;
ProjectPartPchProviderInterface(const ProjectPartPchProviderInterface &) = delete;
ProjectPartPchProviderInterface &operator=(const ProjectPartPchProviderInterface &) = delete;
virtual Utils::optional<ClangBackEnd::ProjectPartPch> projectPartPch(
Utils::SmallStringView projectPartId) const = 0;
virtual const ClangBackEnd::ProjectPartPchs &projectPartPchs() const = 0;
virtual const ClangBackEnd::ProjectPartPchs &projectPartPchs() const = 0;
protected:
~ProjectPartPchProviderInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -51,6 +51,9 @@ public:
virtual void sourceRangesForQueryMessage(SourceRangesForQueryMessage &&message) = 0;
virtual void setLocalRenamingCallback(RenameCallback &&localRenamingCallback) = 0;
protected:
~RefactoringClientInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -60,6 +60,9 @@ public:
isAvailable_ = isAvailable;
}
protected:
~RefactoringServerInterface() = default;
private:
bool isAvailable_ = false;
};

View File

@@ -131,6 +131,9 @@ public:
m_indices.reserve(reserveSize);
}
StringCache(const StringCache &) = delete;
StringCache &operator=(const StringCache &) = delete;
void populate(CacheEntries &&entries)
{
uncheckedPopulate(std::move(entries));

View File

@@ -17,7 +17,6 @@ SOURCES += \
$$PWD/sqliteglobal.cpp \
$$PWD/sqlitereadstatement.cpp \
$$PWD/sqlitereadwritestatement.cpp \
$$PWD/sqlitetransaction.cpp \
$$PWD/sqlitewritestatement.cpp \
$$PWD/sqlstatementbuilder.cpp \
$$PWD/sqlstatementbuilderexception.cpp \

View File

@@ -53,6 +53,9 @@ class SQLITE_EXPORT BaseStatement
public:
explicit BaseStatement(Utils::SmallStringView sqlStatement, Database &database);
BaseStatement(const BaseStatement &) = delete;
BaseStatement &operator=(const BaseStatement &) = delete;
static void deleteCompiledStatement(sqlite3_stmt *m_compiledStatement);
bool next() const;
@@ -123,6 +126,9 @@ public:
Database &database() const;
protected:
~BaseStatement() = default;
private:
std::unique_ptr<sqlite3_stmt, void (*)(sqlite3_stmt*)> m_compiledStatement;
Database &m_database;
@@ -146,7 +152,7 @@ extern template SQLITE_EXPORT Utils::SmallString BaseStatement::fetchValue<Utils
extern template SQLITE_EXPORT Utils::PathString BaseStatement::fetchValue<Utils::PathString>(int column) const;
template <typename BaseStatement>
class SQLITE_EXPORT StatementImplementation : public BaseStatement
class StatementImplementation : public BaseStatement
{
public:
@@ -290,6 +296,8 @@ public:
return statement.template fetchValue<Type>(0);
}
protected:
~StatementImplementation() = default;
private:
struct Resetter

View File

@@ -55,10 +55,7 @@ public:
Database(Utils::PathString &&databaseFilePath, JournalMode journalMode=JournalMode::Wal);
Database(const Database &) = delete;
bool operator=(const Database &) = delete;
Database(Database &&) = delete;
bool operator=(Database &&) = delete;
Database &operator=(const Database &) = delete;
void open();
void open(Utils::PathString &&databaseFilePath);

View File

@@ -35,11 +35,10 @@ namespace Sqlite {
class DatabaseBackend;
class Database;
class SQLITE_EXPORT TransactionInterface
class TransactionInterface
{
public:
TransactionInterface() = default;
virtual ~TransactionInterface();
TransactionInterface(const TransactionInterface &) = delete;
TransactionInterface &operator=(const TransactionInterface &) = delete;
@@ -48,6 +47,9 @@ public:
virtual void exclusiveBegin() = 0;
virtual void commit() = 0;
virtual void rollback() = 0;
protected:
~TransactionInterface() = default;
};
class AbstractTransaction
@@ -63,6 +65,7 @@ public:
}
protected:
~AbstractTransaction() = default;
AbstractTransaction(TransactionInterface &interface)
: m_interface(interface)
{
@@ -76,6 +79,8 @@ protected:
class AbstractThrowingTransaction : public AbstractTransaction
{
public:
AbstractThrowingTransaction(const AbstractThrowingTransaction &) = delete;
AbstractThrowingTransaction &operator=(const AbstractThrowingTransaction &) = delete;
~AbstractThrowingTransaction() noexcept(false)
{
try {
@@ -97,6 +102,8 @@ protected:
class AbstractNonThrowingDestructorTransaction : public AbstractTransaction
{
public:
AbstractNonThrowingDestructorTransaction(const AbstractNonThrowingDestructorTransaction &) = delete;
AbstractNonThrowingDestructorTransaction &operator=(const AbstractNonThrowingDestructorTransaction &) = delete;
~AbstractNonThrowingDestructorTransaction()
{
try {

View File

@@ -46,7 +46,7 @@ class BackendReceiver : public ClangBackEnd::ClangCodeModelClientInterface
{
public:
BackendReceiver();
~BackendReceiver() override;
~BackendReceiver();
using AliveHandler = std::function<void ()>;
void setAliveHandler(const AliveHandler &handler);

View File

@@ -22,6 +22,5 @@ SOURCES += \
$$PWD/pchmanagernotifierinterface.cpp \
$$PWD/pchmanagerconnectionclient.cpp \
$$PWD/projectupdater.cpp \
$$PWD/pchmanagerprojectupdater.cpp \
$$PWD/precompiledheaderstorageinterface.cpp
$$PWD/pchmanagerprojectupdater.cpp

View File

@@ -73,7 +73,7 @@ ClangPchManagerPlugin::~ClangPchManagerPlugin() = default;
bool ClangPchManagerPlugin::initialize(const QStringList & /*arguments*/, QString * /*errorMessage*/)
{
d.reset(new ClangPchManagerPluginData);
d = std::make_unique<ClangPchManagerPluginData>();
startBackend();

View File

@@ -37,17 +37,18 @@ class CLANGPCHMANAGER_EXPORT PchManagerNotifierInterface
{
public:
PchManagerNotifierInterface(PchManagerClient &pchManagerClient);
PchManagerNotifierInterface(const PchManagerNotifierInterface &) = delete;
PchManagerNotifierInterface &operator=(const PchManagerNotifierInterface &) = delete;
virtual ~PchManagerNotifierInterface();
virtual void precompiledHeaderUpdated(const QString &projectPartId,
const QString &pchFilePath,
long long lastModified) = 0;
virtual void precompiledHeaderRemoved(const QString &projectPartId) = 0;
PchManagerNotifierInterface(const PchManagerNotifierInterface &) = delete;
void operator=(const PchManagerNotifierInterface &) const = delete;
PchManagerClient &m_pchManagerClient;
protected:
~PchManagerNotifierInterface();
};
} // namespace ClangPchManager

View File

@@ -1,32 +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 "precompiledheaderstorageinterface.h"
namespace ClangPchManager {
PrecompiledHeaderStorageInterface::~PrecompiledHeaderStorageInterface() = default;
} // namespace ClangPchManager

View File

@@ -33,7 +33,6 @@ class PrecompiledHeaderStorageInterface
{
public:
PrecompiledHeaderStorageInterface() = default;
virtual ~PrecompiledHeaderStorageInterface();
PrecompiledHeaderStorageInterface(const PrecompiledHeaderStorageInterface&) = delete;
PrecompiledHeaderStorageInterface &operator=(const PrecompiledHeaderStorageInterface&) = delete;
@@ -43,6 +42,9 @@ public:
long long pchBuildTime) = 0;
virtual void deletePrecompiledHeader(Utils::SmallStringView projectPartName) = 0;
protected:
~PrecompiledHeaderStorageInterface() = default;
};
} // namespace ClangPchManager

View File

@@ -39,7 +39,5 @@ SOURCES += \
$$PWD/refactoringconnectionclient.cpp \
$$PWD/refactoringengine.cpp \
$$PWD/refactoringprojectupdater.cpp \
$$PWD/searchinterface.cpp \
$$PWD/searchhandle.cpp \
$$PWD/symbolsfindfilter.cpp \
$$PWD/projectpartproviderinterface.cpp
$$PWD/symbolsfindfilter.cpp

View File

@@ -1,32 +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 "projectpartproviderinterface.h"
namespace ClangRefactoring {
ProjectPartProviderInterface::~ProjectPartProviderInterface() = default;
} // namespace ClangRefactoring

View File

@@ -39,7 +39,6 @@ class ProjectPartProviderInterface
{
public:
ProjectPartProviderInterface() = default;
virtual ~ProjectPartProviderInterface();
ProjectPartProviderInterface(const ProjectPartProviderInterface&) = delete;
ProjectPartProviderInterface& operator=(const ProjectPartProviderInterface&) = delete;
@@ -49,6 +48,9 @@ public:
virtual CppTools::ProjectPart *projectPart(const QString &projectPartId) const = 0;
virtual ClangBackEnd::V2::FileContainers generatedFiles() const = 0;
protected:
~ProjectPartProviderInterface() = default;
};
} // namespace ClangRefactoring

View File

@@ -34,6 +34,10 @@ namespace ClangRefactoring {
class SearchHandle
{
public:
SearchHandle() = default;
SearchHandle(const SearchHandle &) = delete;
SearchHandle &operator=(const SearchHandle &) = delete;
virtual ~SearchHandle();
virtual void addResult(const QString &fileName,

View File

@@ -36,9 +36,15 @@ namespace ClangRefactoring {
class SearchInterface
{
public:
virtual ~SearchInterface();
SearchInterface() = default;
SearchInterface(const SearchInterface &) = delete;
SearchInterface &operator=(const SearchInterface &) = delete;
virtual std::unique_ptr<SearchHandle> startNewSearch(const QString &searchLabel,
const QString &searchTerm) = 0;
const QString &searchTerm) = 0;
protected:
~SearchInterface() = default;
};
} // namespace ClangRefactoring

View File

@@ -47,7 +47,10 @@ enum class SymbolType
class SymbolQueryInterface
{
public:
virtual ~SymbolQueryInterface() {}
SymbolQueryInterface() = default;
SymbolQueryInterface(const SymbolQueryInterface &) = delete;
SymbolQueryInterface &operator=(const SymbolQueryInterface &) = delete;
virtual SourceLocations locationsAt(ClangBackEnd::FilePathId filePathId,
int line,
int utf8Column) const = 0;
@@ -57,6 +60,9 @@ public:
virtual Symbols symbolsContaining(SymbolType symbolType,
Utils::SmallStringView regularExpression) const = 0;
virtual Functions functionsContaining(Utils::SmallStringView regularExpression) const = 0;
protected:
~SymbolQueryInterface() = default;
};
} // namespace ClangRefactoring

View File

@@ -2,11 +2,7 @@ INCLUDEPATH += $$PWD
SOURCES += \
$$PWD/pchmanagerserver.cpp \
$$PWD/projectparts.cpp \
$$PWD/pchcreatorinterface.cpp \
$$PWD/projectpartsinterface.cpp \
$$PWD/pchgeneratornotifierinterface.cpp \
$$PWD/pchgeneratorinterface.cpp
$$PWD/projectparts.cpp
HEADERS += \
$$PWD/pchmanagerserver.h \

View File

@@ -32,10 +32,16 @@ namespace ClangBackEnd {
class Environment
{
public:
virtual ~Environment() = default;
Environment() = default;
Environment(const Environment &) = delete;
Environment &operator=(const Environment &) = delete;
virtual QString pchBuildDirectory() const = 0;
virtual QString clangCompilerPath() const = 0;
virtual uint hardwareConcurrency() const = 0;
protected:
~Environment() = default;
};
} // namespace ClangBackEnd

View File

@@ -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.
**
****************************************************************************/
#include "pchcreatorinterface.h"
namespace ClangBackEnd {
PchCreatorInterface::~PchCreatorInterface()
{
}
} // namespace ClangBackEnd

View File

@@ -36,11 +36,16 @@ namespace ClangBackEnd {
class PchCreatorInterface
{
public:
virtual ~PchCreatorInterface();
PchCreatorInterface() = default;
PchCreatorInterface(const PchCreatorInterface &) = delete;
PchCreatorInterface &operator=(const PchCreatorInterface &) = delete;
virtual void generatePchs(V2::ProjectPartContainers &&projectsParts) = 0;
virtual void setGeneratedFiles(V2::FileContainers &&generatedFiles) = 0;
virtual std::vector<IdPaths> takeProjectsIncludes() = 0;
protected:
~PchCreatorInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -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 "pchgeneratorinterface.h"
ClangBackEnd::PchGeneratorInterface::~PchGeneratorInterface()
{
}

View File

@@ -34,11 +34,15 @@ class ProjectPartPch;
class PchGeneratorInterface
{
public:
virtual ~PchGeneratorInterface();
PchGeneratorInterface() = default;
PchGeneratorInterface(const PchGeneratorInterface &) = delete;
PchGeneratorInterface &operator=(const PchGeneratorInterface &) = delete;
virtual void startTask(Utils::SmallStringVector &&compilerArguments,
ProjectPartPch &&projectPartPch) = 0;
protected:
~PchGeneratorInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -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.
**
****************************************************************************/
#include "pchgeneratornotifierinterface.h"
#include <ostream>
namespace ClangBackEnd {
PchGeneratorNotifierInterface::~PchGeneratorNotifierInterface()
{
}
std::ostream &operator<<(std::ostream &out, TaskFinishStatus status)
{
enum class TaskFinishStatus
{
Successfully,
Unsuccessfully
};
if (status == ClangBackEnd::TaskFinishStatus::Successfully)
out << "Successfully";
else
out << "Unsuccessfully";
return out;
}
} // namespace ClangBackEnd

View File

@@ -40,11 +40,14 @@ enum class TaskFinishStatus
class PchGeneratorNotifierInterface
{
public:
virtual ~PchGeneratorNotifierInterface();
PchGeneratorNotifierInterface() = default;
PchGeneratorNotifierInterface(const PchGeneratorNotifierInterface &) = delete;
PchGeneratorNotifierInterface &operator=(const PchGeneratorNotifierInterface &) = delete;
virtual void taskFinished(TaskFinishStatus status, const ProjectPartPch &projectPartPch) = 0;
protected:
~PchGeneratorNotifierInterface() = default;
};
std::ostream &operator<<(std::ostream &out, TaskFinishStatus status);
} // namespace ClangBackEnd

View File

@@ -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 "projectpartsinterface.h"
namespace ClangBackEnd {
ProjectPartsInterface::~ProjectPartsInterface()
{
}
} // namespace ClangBackEnd

View File

@@ -32,11 +32,16 @@ namespace ClangBackEnd {
class ProjectPartsInterface
{
public:
virtual ~ProjectPartsInterface();
ProjectPartsInterface() = default;
ProjectPartsInterface(const ProjectPartsInterface &) = delete;
ProjectPartsInterface &operator=(const ProjectPartsInterface &) = delete;
virtual V2::ProjectPartContainers update(V2::ProjectPartContainers &&projectsParts) = 0;
virtual void remove(const Utils::SmallStringVector &projectPartIds) = 0;
virtual V2::ProjectPartContainers projects(const Utils::SmallStringVector &projectPartIds) const = 0;
protected:
~ProjectPartsInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -67,6 +67,5 @@ SOURCES += \
$$PWD/sourcerangefilter.cpp \
$$PWD/symbolindexer.cpp \
$$PWD/symbolentry.cpp \
$$PWD/symbolstorageinterface.cpp \
$$PWD/projectpartartefact.cpp \
$$PWD/filestatuscache.cpp

View File

@@ -56,6 +56,8 @@ public:
using size_type = Internal::FileStatusCacheEntries::size_type;
FileStatusCache(FilePathCachingInterface &filePathCache);
FileStatusCache &operator=(const FileStatusCache &) = delete;
FileStatusCache(const FileStatusCache &) = delete;
long long lastModifiedTime(ClangBackEnd::FilePathId filePathId) const;
void update(ClangBackEnd::FilePathId filePathId);

View File

@@ -27,4 +27,9 @@
namespace ClangBackEnd {
void SymbolIndexing::updateProjectParts(V2::ProjectPartContainers &&projectParts, V2::FileContainers &&generatedFiles)
{
m_indexer.updateProjectParts(std::move(projectParts), std::move(generatedFiles));
}
} // namespace ClangBackEnd

View File

@@ -62,10 +62,7 @@ public:
}
void updateProjectParts(V2::ProjectPartContainers &&projectParts,
V2::FileContainers &&generatedFiles)
{
m_indexer.updateProjectParts(std::move(projectParts), std::move(generatedFiles));
}
V2::FileContainers &&generatedFiles);
private:
FilePathCachingInterface &m_filePathCache;

View File

@@ -33,8 +33,15 @@ namespace ClangBackEnd {
class SymbolIndexingInterface
{
public:
SymbolIndexingInterface() = default;
SymbolIndexingInterface(const SymbolIndexingInterface&) = delete;
SymbolIndexingInterface &operator=(const SymbolIndexingInterface&) = delete;
virtual void updateProjectParts(V2::ProjectPartContainers &&projectParts,
V2::FileContainers &&generatedFiles) = 0;
protected:
~SymbolIndexingInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -43,6 +43,10 @@ namespace ClangBackEnd {
class SymbolsCollectorInterface
{
public:
SymbolsCollectorInterface() = default;
SymbolsCollectorInterface(const SymbolsCollectorInterface &) = delete;
SymbolsCollectorInterface &operator=(const SymbolsCollectorInterface &) = delete;
virtual void addFiles(const FilePathIds &filePathIds,
const Utils::SmallStringVector &arguments) = 0;
@@ -58,6 +62,9 @@ public:
virtual const UsedMacros &usedMacros() const = 0;
virtual const FileStatuses &fileStatuses() const = 0;
virtual const SourceDependencies &sourceDependencies() const = 0;
protected:
~SymbolsCollectorInterface() = default;
};
} // namespace ClangBackEnd

View File

@@ -44,7 +44,6 @@ class SymbolStorageInterface
{
public:
SymbolStorageInterface() = default;
virtual ~SymbolStorageInterface();
SymbolStorageInterface(const SymbolStorageInterface &) = delete;
SymbolStorageInterface &operator=(const SymbolStorageInterface &) = delete;
@@ -65,6 +64,9 @@ public:
virtual Utils::optional<ProjectPartArtefact> fetchProjectPartArtefact(Utils::SmallStringView projectPartName) const = 0;
virtual long long fetchLowestLastModifiedTime(FilePathId sourceId) const = 0;
virtual Utils::optional<ProjectPartPch> fetchPrecompiledHeader(int projectPartId) const = 0;
protected:
~SymbolStorageInterface() = default;
};
} // namespace ClangBackEnd