Decorate some classes and methods with final keyword

This way we silence the clang warnings about calling
virtual methods from c'tor or from d'tor:
[clang-analyzer-optin.cplusplus.VirtualCall]

Change-Id: I8d6318b490152133da4833bda2ba28622bce30dd
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
This commit is contained in:
Jarek Kobus
2020-11-18 17:04:54 +01:00
parent b2a766a79a
commit 48c2afe157
28 changed files with 34 additions and 34 deletions

View File

@@ -44,7 +44,7 @@ namespace ADS {
class DockManager; class DockManager;
class WorkspaceNameInputDialog; class WorkspaceNameInputDialog;
class WorkspaceModel : public QAbstractTableModel class WorkspaceModel final : public QAbstractTableModel
{ {
Q_OBJECT Q_OBJECT

View File

@@ -32,7 +32,7 @@
namespace Utils { namespace Utils {
class QTCREATOR_UTILS_EXPORT FlowLayout : public QLayout class QTCREATOR_UTILS_EXPORT FlowLayout final : public QLayout
{ {
public: public:
explicit FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1); explicit FlowLayout(QWidget *parent, int margin = -1, int hSpacing = -1, int vSpacing = -1);

View File

@@ -53,7 +53,7 @@ public:
ProgressIndicatorPainter(ProgressIndicatorSize size); ProgressIndicatorPainter(ProgressIndicatorSize size);
virtual ~ProgressIndicatorPainter() = default; virtual ~ProgressIndicatorPainter() = default;
virtual void setIndicatorSize(ProgressIndicatorSize size); void setIndicatorSize(ProgressIndicatorSize size);
ProgressIndicatorSize indicatorSize() const; ProgressIndicatorSize indicatorSize() const;
void setUpdateCallback(const UpdateCallback &cb); void setUpdateCallback(const UpdateCallback &cb);

View File

@@ -34,7 +34,7 @@ namespace Internal {
class AndroidRunner; class AndroidRunner;
class AndroidRunSupport : public AndroidRunner class AndroidRunSupport final : public AndroidRunner
{ {
Q_OBJECT Q_OBJECT

View File

@@ -32,7 +32,7 @@
namespace ClangCodeModel { namespace ClangCodeModel {
namespace Internal { namespace Internal {
class ClangHoverHandler : public TextEditor::BaseHoverHandler class ClangHoverHandler final : public TextEditor::BaseHoverHandler
{ {
Q_DECLARE_TR_FUNCTIONS(ClangHoverHandler) Q_DECLARE_TR_FUNCTIONS(ClangHoverHandler)

View File

@@ -74,7 +74,7 @@ static Utils::Id defaultCMakeToolId()
static const char TOOL_ID[] = "CMakeProjectManager.CMakeKitInformation"; static const char TOOL_ID[] = "CMakeProjectManager.CMakeKitInformation";
class CMakeKitAspectWidget : public KitAspectWidget class CMakeKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeKitAspect) Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeKitAspect)
public: public:
@@ -316,7 +316,7 @@ static const char EXTRA_GENERATOR_KEY[] = "ExtraGenerator";
static const char PLATFORM_KEY[] = "Platform"; static const char PLATFORM_KEY[] = "Platform";
static const char TOOLSET_KEY[] = "Toolset"; static const char TOOLSET_KEY[] = "Toolset";
class CMakeGeneratorKitAspectWidget : public KitAspectWidget class CMakeGeneratorKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeGeneratorKitAspect) Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeGeneratorKitAspect)
public: public:
@@ -822,7 +822,7 @@ static const char CMAKE_CXX_TOOLCHAIN_KEY[] = "CMAKE_CXX_COMPILER";
static const char CMAKE_QMAKE_KEY[] = "QT_QMAKE_EXECUTABLE"; static const char CMAKE_QMAKE_KEY[] = "QT_QMAKE_EXECUTABLE";
static const char CMAKE_PREFIX_PATH_KEY[] = "CMAKE_PREFIX_PATH"; static const char CMAKE_PREFIX_PATH_KEY[] = "CMAKE_PREFIX_PATH";
class CMakeConfigurationKitAspectWidget : public KitAspectWidget class CMakeConfigurationKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeConfigurationKitAspect) Q_DECLARE_TR_FUNCTIONS(CMakeProjectManager::Internal::CMakeConfigurationKitAspect)
public: public:

View File

@@ -49,7 +49,7 @@ public:
virtual Utils::FilePath filePath() const = 0; virtual Utils::FilePath filePath() const = 0;
}; };
class CORE_EXPORT ListIterator : public Iterator { class CORE_EXPORT ListIterator final : public Iterator {
public: public:
ListIterator(const Utils::FilePaths &filePaths); ListIterator(const Utils::FilePaths &filePaths);

View File

@@ -43,7 +43,7 @@ using namespace Utils;
namespace CppTools { namespace CppTools {
namespace Internal { namespace Internal {
class CppIncludesIterator : public BaseFileFilter::Iterator class CppIncludesIterator final : public BaseFileFilter::Iterator
{ {
public: public:
CppIncludesIterator(CPlusPlus::Snapshot snapshot, const QSet<QString> &seedPaths); CppIncludesIterator(CPlusPlus::Snapshot snapshot, const QSet<QString> &seedPaths);

View File

@@ -48,7 +48,7 @@ using ScriptEvaluator = std::function<void (QString)>;
class ConsoleItemModel; class ConsoleItemModel;
class ConsoleView; class ConsoleView;
class Console : public Core::IOutputPane class Console final : public Core::IOutputPane
{ {
Q_OBJECT Q_OBJECT

View File

@@ -55,7 +55,7 @@ namespace Debugger {
namespace Internal { namespace Internal {
class DebuggerKitAspectWidget : public KitAspectWidget class DebuggerKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerKitAspect) Q_DECLARE_TR_FUNCTIONS(Debugger::DebuggerKitAspect)

View File

@@ -45,7 +45,7 @@ namespace Internal {
class DiffEditorDocument; class DiffEditorDocument;
class UnifiedDiffEditorWidget : public SelectableTextEditorWidget class UnifiedDiffEditorWidget final : public SelectableTextEditorWidget
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -218,7 +218,7 @@ protected:
IosDeviceType m_devType; IosDeviceType m_devType;
}; };
class IosDeviceToolHandlerPrivate : public IosToolHandlerPrivate class IosDeviceToolHandlerPrivate final : public IosToolHandlerPrivate
{ {
enum State { enum State {
NonStarted, NonStarted,

View File

@@ -271,7 +271,7 @@ public:
}; };
class LanguageClientCompletionAssistProcessor : public IAssistProcessor class LanguageClientCompletionAssistProcessor final : public IAssistProcessor
{ {
public: public:
LanguageClientCompletionAssistProcessor(Client *client); LanguageClientCompletionAssistProcessor(Client *client);

View File

@@ -32,7 +32,7 @@ namespace LanguageClient {
class Client; class Client;
class HoverHandler : public TextEditor::BaseHoverHandler class HoverHandler final : public TextEditor::BaseHoverHandler
{ {
Q_DECLARE_TR_FUNCTIONS(HoverHandler) Q_DECLARE_TR_FUNCTIONS(HoverHandler)
public: public:

View File

@@ -145,7 +145,7 @@ protected:
QString m_currentValue; QString m_currentValue;
}; };
struct FeatureBuildOption : BuildOption struct FeatureBuildOption final : BuildOption
{ {
QVariant value() const override { return QVariant::fromValue(m_currentValue); } QVariant value() const override { return QVariant::fromValue(m_currentValue); }
QString valueStr() const override { return m_currentValue.value(); } QString valueStr() const override { return m_currentValue.value(); }
@@ -225,7 +225,7 @@ protected:
QStringList m_currentValue; QStringList m_currentValue;
}; };
struct BooleanBuildOption : BuildOption struct BooleanBuildOption final : BuildOption
{ {
QVariant value() const override { return m_currentValue; } QVariant value() const override { return m_currentValue; }
QString valueStr() const override QString valueStr() const override

View File

@@ -47,7 +47,7 @@ namespace Internal {
class ShowOutputTaskHandler; class ShowOutputTaskHandler;
class CompileOutputTextEdit; class CompileOutputTextEdit;
class CompileOutputWindow : public Core::IOutputPane class CompileOutputWindow final : public Core::IOutputPane
{ {
Q_OBJECT Q_OBJECT

View File

@@ -205,7 +205,7 @@ void SysRootKitAspect::setSysRoot(Kit *k, const Utils::FilePath &v)
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
namespace Internal { namespace Internal {
class ToolChainKitAspectWidget : public KitAspectWidget class ToolChainKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ToolChainKitAspect) Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::ToolChainKitAspect)
@@ -693,7 +693,7 @@ void ToolChainKitAspect::toolChainRemoved(ToolChain *tc)
// DeviceTypeKitAspect: // DeviceTypeKitAspect:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
namespace Internal { namespace Internal {
class DeviceTypeKitAspectWidget : public KitAspectWidget class DeviceTypeKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DeviceTypeKitAspect) Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DeviceTypeKitAspect)
@@ -811,7 +811,7 @@ QSet<Utils::Id> DeviceTypeKitAspect::availableFeatures(const Kit *k) const
// DeviceKitAspect: // DeviceKitAspect:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
namespace Internal { namespace Internal {
class DeviceKitAspectWidget : public KitAspectWidget class DeviceKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DeviceKitAspect) Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::DeviceKitAspect)
@@ -1062,7 +1062,7 @@ void DeviceKitAspect::devicesChanged()
// EnvironmentKitAspect: // EnvironmentKitAspect:
// -------------------------------------------------------------------------- // --------------------------------------------------------------------------
namespace Internal { namespace Internal {
class EnvironmentKitAspectWidget : public KitAspectWidget class EnvironmentKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::EnvironmentKitAspect) Q_DECLARE_TR_FUNCTIONS(ProjectExplorer::EnvironmentKitAspect)

View File

@@ -43,7 +43,7 @@ namespace Internal {
class TaskWindowPrivate; class TaskWindowPrivate;
// Show issues (warnings or errors) and open the editor on click. // Show issues (warnings or errors) and open the editor on click.
class TaskWindow : public Core::IOutputPane class TaskWindow final : public Core::IOutputPane
{ {
Q_OBJECT Q_OBJECT

View File

@@ -39,7 +39,7 @@ class QbsSession;
class QbsBuildStepConfigWidget; class QbsBuildStepConfigWidget;
class QbsBuildStep : public ProjectExplorer::BuildStep class QbsBuildStep final : public ProjectExplorer::BuildStep
{ {
Q_OBJECT Q_OBJECT

View File

@@ -38,7 +38,7 @@ namespace Internal {
class ErrorInfo; class ErrorInfo;
class QbsSession; class QbsSession;
class QbsCleanStep : public ProjectExplorer::BuildStep class QbsCleanStep final : public ProjectExplorer::BuildStep
{ {
Q_OBJECT Q_OBJECT

View File

@@ -39,7 +39,7 @@ namespace Internal {
class ErrorInfo; class ErrorInfo;
class QbsSession; class QbsSession;
class QbsInstallStep : public ProjectExplorer::BuildStep class QbsInstallStep final : public ProjectExplorer::BuildStep
{ {
Q_OBJECT Q_OBJECT

View File

@@ -45,7 +45,7 @@ using namespace Utils;
namespace QmakeProjectManager { namespace QmakeProjectManager {
namespace Internal { namespace Internal {
class QmakeKitAspectWidget : public KitAspectWidget class QmakeKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(QmakeProjectManager::Internal::QmakeKitAspect) Q_DECLARE_TR_FUNCTIONS(QmakeProjectManager::Internal::QmakeKitAspect)

View File

@@ -56,7 +56,7 @@ public:
AbstractAction(const QString &description = QString()); AbstractAction(const QString &description = QString());
AbstractAction(DefaultAction *action); AbstractAction(DefaultAction *action);
QAction *action() const override; QAction *action() const override final;
DefaultAction *defaultAction() const; DefaultAction *defaultAction() const;
void currentContextChanged(const SelectionContext &selectionContext) override; void currentContextChanged(const SelectionContext &selectionContext) override;

View File

@@ -49,7 +49,7 @@ using namespace Utils;
namespace QtSupport { namespace QtSupport {
namespace Internal { namespace Internal {
class QtKitAspectWidget : public KitAspectWidget class QtKitAspectWidget final : public KitAspectWidget
{ {
Q_DECLARE_TR_FUNCTIONS(QtSupport::QtKitAspectWidget) Q_DECLARE_TR_FUNCTIONS(QtSupport::QtKitAspectWidget)
public: public:

View File

@@ -34,7 +34,7 @@ namespace PluginInterface {
/** /**
* @brief The ParalllelItem class represents Parallel-state of the SCXML-standard. It is a extended class from the StateItem. * @brief The ParalllelItem class represents Parallel-state of the SCXML-standard. It is a extended class from the StateItem.
*/ */
class ParallelItem : public StateItem class ParallelItem final : public StateItem
{ {
public: public:
explicit ParallelItem(const QPointF &pos = QPointF(), BaseItem *parent = nullptr); explicit ParallelItem(const QPointF &pos = QPointF(), BaseItem *parent = nullptr);

View File

@@ -35,7 +35,7 @@ namespace PluginInterface {
class ScxmlTag; class ScxmlTag;
class SCShapeProvider : public ShapeProvider class SCShapeProvider final : public ShapeProvider
{ {
Q_OBJECT Q_OBJECT
public: public:

View File

@@ -37,7 +37,7 @@ class IDocument;
namespace TextEditor { namespace TextEditor {
namespace Internal { namespace Internal {
class FindInCurrentFile : public BaseFileFind class FindInCurrentFile final : public BaseFileFind
{ {
Q_OBJECT Q_OBJECT

View File

@@ -37,7 +37,7 @@ namespace Internal {
class UpdateInfoPluginPrivate; class UpdateInfoPluginPrivate;
class UpdateInfoPlugin : public ExtensionSystem::IPlugin class UpdateInfoPlugin final : public ExtensionSystem::IPlugin
{ {
Q_OBJECT Q_OBJECT
Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "UpdateInfo.json") Q_PLUGIN_METADATA(IID "org.qt-project.Qt.QtCreatorPlugin" FILE "UpdateInfo.json")