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

@@ -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