Commit eb2c2386 authored by Brad King's avatar Brad King Committed by Kitware Robot
Browse files

Merge topic 'tidy-use-equals-delete'

b05b778a

 clang-tidy: Use `= delete`
Acked-by: Kitware Robot's avatarKitware Robot <kwrobot@kitware.com>
Rejected-by: vvs31415's avatarvvs31415 <vstakhovsky@fastmail.com>
Merge-request: !2848
parents 748d0245 b05b778a
Pipeline #129006 passed with stage
in 0 seconds
......@@ -14,7 +14,6 @@ modernize-*,\
-modernize-raw-string-literal,\
-modernize-return-braced-init-list,\
-modernize-use-auto,\
-modernize-use-equals-delete,\
-modernize-use-noexcept,\
-modernize-use-transparent-functors,\
-modernize-use-using,\
......
......@@ -30,16 +30,6 @@ building on older toolchains some constructs need to be handled with care:
The ``std::auto_ptr`` template is deprecated in C++11. Use ``std::unique_ptr``.
* Use ``CM_DISABLE_COPY(Class)`` to mark classes as non-copyable.
The ``CM_DISABLE_COPY`` macro should be used in the private section of a
class to make sure that attempts to copy or assign an instance of the class
lead to compiler errors even if the compiler does not support *deleted*
functions. As a guideline, all polymorphic classes should be made
non-copyable in order to avoid slicing. Classes that are composed of or
derived from non-copyable classes must also be made non-copyable explicitly
with ``CM_DISABLE_COPY``.
Source Tree Layout
==================
......
......@@ -12,11 +12,12 @@ class cmCursesMainForm;
class cmCursesBoolWidget : public cmCursesWidget
{
CM_DISABLE_COPY(cmCursesBoolWidget)
public:
cmCursesBoolWidget(int width, int height, int left, int top);
cmCursesBoolWidget(cmCursesBoolWidget const&) = delete;
cmCursesBoolWidget& operator=(cmCursesBoolWidget const&) = delete;
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
......
......@@ -13,14 +13,17 @@ class cmake;
class cmCursesCacheEntryComposite
{
CM_DISABLE_COPY(cmCursesCacheEntryComposite)
public:
cmCursesCacheEntryComposite(const std::string& key, int labelwidth,
int entrywidth);
cmCursesCacheEntryComposite(const std::string& key, cmake* cm, bool isNew,
int labelwidth, int entrywidth);
~cmCursesCacheEntryComposite();
cmCursesCacheEntryComposite(cmCursesCacheEntryComposite const&) = delete;
cmCursesCacheEntryComposite& operator=(cmCursesCacheEntryComposite const&) =
delete;
const char* GetValue();
friend class cmCursesMainForm;
......
......@@ -12,11 +12,12 @@ class cmCursesMainForm;
class cmCursesDummyWidget : public cmCursesWidget
{
CM_DISABLE_COPY(cmCursesDummyWidget)
public:
cmCursesDummyWidget(int width, int height, int left, int top);
cmCursesDummyWidget(cmCursesDummyWidget const&) = delete;
cmCursesDummyWidget& operator=(cmCursesDummyWidget const&) = delete;
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
......
......@@ -9,10 +9,11 @@
class cmCursesFilePathWidget : public cmCursesPathWidget
{
CM_DISABLE_COPY(cmCursesFilePathWidget)
public:
cmCursesFilePathWidget(int width, int height, int left, int top);
cmCursesFilePathWidget(cmCursesFilePathWidget const&) = delete;
cmCursesFilePathWidget& operator=(cmCursesFilePathWidget const&) = delete;
};
#endif // cmCursesFilePathWidget_h
......@@ -11,12 +11,13 @@
class cmCursesForm
{
CM_DISABLE_COPY(cmCursesForm)
public:
cmCursesForm();
virtual ~cmCursesForm();
cmCursesForm(cmCursesForm const&) = delete;
cmCursesForm& operator=(cmCursesForm const&) = delete;
// Description:
// Handle user input.
virtual void HandleInput() = 0;
......
......@@ -14,13 +14,14 @@ class cmCursesMainForm;
class cmCursesLabelWidget : public cmCursesWidget
{
CM_DISABLE_COPY(cmCursesLabelWidget)
public:
cmCursesLabelWidget(int width, int height, int left, int top,
const std::string& name);
~cmCursesLabelWidget() override;
cmCursesLabelWidget(cmCursesLabelWidget const&) = delete;
cmCursesLabelWidget& operator=(cmCursesLabelWidget const&) = delete;
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
......
......@@ -13,13 +13,14 @@
class cmCursesLongMessageForm : public cmCursesForm
{
CM_DISABLE_COPY(cmCursesLongMessageForm)
public:
cmCursesLongMessageForm(std::vector<std::string> const& messages,
const char* title);
~cmCursesLongMessageForm() override;
cmCursesLongMessageForm(cmCursesLongMessageForm const&) = delete;
cmCursesLongMessageForm& operator=(cmCursesLongMessageForm const&) = delete;
// Description:
// Handle user input.
void HandleInput() override;
......
......@@ -23,12 +23,13 @@ class cmake;
*/
class cmCursesMainForm : public cmCursesForm
{
CM_DISABLE_COPY(cmCursesMainForm)
public:
cmCursesMainForm(std::vector<std::string> args, int initwidth);
~cmCursesMainForm() override;
cmCursesMainForm(cmCursesMainForm const&) = delete;
cmCursesMainForm& operator=(cmCursesMainForm const&) = delete;
/**
* Set the widgets which represent the cache entries.
*/
......
......@@ -15,11 +15,12 @@ class cmCursesMainForm;
class cmCursesOptionsWidget : public cmCursesWidget
{
CM_DISABLE_COPY(cmCursesOptionsWidget)
public:
cmCursesOptionsWidget(int width, int height, int left, int top);
cmCursesOptionsWidget(cmCursesOptionsWidget const&) = delete;
cmCursesOptionsWidget& operator=(cmCursesOptionsWidget const&) = delete;
// Description:
// Handle user input. Called by the container of this widget
// when this widget has focus. Returns true if the input was
......
......@@ -14,11 +14,12 @@ class cmCursesMainForm;
class cmCursesPathWidget : public cmCursesStringWidget
{
CM_DISABLE_COPY(cmCursesPathWidget)
public:
cmCursesPathWidget(int width, int height, int left, int top);
cmCursesPathWidget(cmCursesPathWidget const&) = delete;
cmCursesPathWidget& operator=(cmCursesPathWidget const&) = delete;
/**
* This method is called when different keys are pressed. The
* subclass can have a special implementation handler for this.
......
......@@ -20,11 +20,12 @@ class cmCursesMainForm;
class cmCursesStringWidget : public cmCursesWidget
{
CM_DISABLE_COPY(cmCursesStringWidget)
public:
cmCursesStringWidget(int width, int height, int left, int top);
cmCursesStringWidget(cmCursesStringWidget const&) = delete;
cmCursesStringWidget& operator=(cmCursesStringWidget const&) = delete;
/**
* Handle user input. Called by the container of this widget
* when this widget has focus. Returns true if the input was
......
......@@ -14,12 +14,13 @@ class cmCursesMainForm;
class cmCursesWidget
{
CM_DISABLE_COPY(cmCursesWidget)
public:
cmCursesWidget(int width, int height, int left, int top);
virtual ~cmCursesWidget();
cmCursesWidget(cmCursesWidget const&) = delete;
cmCursesWidget& operator=(cmCursesWidget const&) = delete;
/**
* Handle user input. Called by the container of this widget
* when this widget has focus. Returns true if the input was
......
......@@ -10,12 +10,14 @@
class cmCLocaleEnvironmentScope
{
CM_DISABLE_COPY(cmCLocaleEnvironmentScope)
public:
cmCLocaleEnvironmentScope();
~cmCLocaleEnvironmentScope();
cmCLocaleEnvironmentScope(cmCLocaleEnvironmentScope const&) = delete;
cmCLocaleEnvironmentScope& operator=(cmCLocaleEnvironmentScope const&) =
delete;
private:
std::string GetEnv(std::string const& key);
void SetEnv(std::string const& key, std::string const& value);
......
......@@ -20,13 +20,15 @@ class cmLocalGenerator;
*/
class cmCPackPropertiesGenerator : public cmScriptGenerator
{
CM_DISABLE_COPY(cmCPackPropertiesGenerator)
public:
cmCPackPropertiesGenerator(cmLocalGenerator* lg,
cmInstalledFile const& installedFile,
std::vector<std::string> const& configurations);
cmCPackPropertiesGenerator(cmCPackPropertiesGenerator const&) = delete;
cmCPackPropertiesGenerator& operator=(cmCPackPropertiesGenerator const&) =
delete;
protected:
void GenerateScriptForConfig(std::ostream& os, const std::string& config,
Indent indent) override;
......
......@@ -24,8 +24,6 @@ struct cmListFileArgument;
*/
class cmCommand
{
CM_DISABLE_COPY(cmCommand)
public:
/**
* Construct the command. By default it has no makefile.
......@@ -37,6 +35,9 @@ public:
*/
virtual ~cmCommand() = default;
cmCommand(cmCommand const&) = delete;
cmCommand& operator=(cmCommand const&) = delete;
/**
* Specify the makefile.
*/
......
......@@ -12,8 +12,6 @@ class cmMakefile;
class cmCommandArgumentParserHelper
{
CM_DISABLE_COPY(cmCommandArgumentParserHelper)
public:
struct ParserType
{
......@@ -23,6 +21,10 @@ public:
cmCommandArgumentParserHelper();
~cmCommandArgumentParserHelper();
cmCommandArgumentParserHelper(cmCommandArgumentParserHelper const&) = delete;
cmCommandArgumentParserHelper& operator=(
cmCommandArgumentParserHelper const&) = delete;
int ParseString(const char* str, int verb);
// For the lexer:
......
......@@ -103,7 +103,6 @@ private:
std::vector<std::string> Vector;
unsigned int DataStart;
const char* Ignore;
cmCAStringVector();
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
};
......@@ -125,7 +124,6 @@ private:
unsigned int DataStart;
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
cmCAString();
};
/** cmCAEnabler is to be used for options which are off by default and can be
......@@ -143,7 +141,6 @@ private:
bool Enabled;
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
cmCAEnabler();
};
/** cmCADisable is to be used for options which are on by default and can be
......@@ -161,7 +158,6 @@ private:
bool Enabled;
bool DoConsume(const std::string& arg, unsigned int index) override;
void DoReset() override;
cmCADisabler();
};
/** Group of arguments, needed for ordering. E.g. WIN32, EXCLUDE_FROM_ALL and
......
......@@ -26,8 +26,4 @@
#define CM_FALLTHROUGH cmsys_FALLTHROUGH
#define CM_DISABLE_COPY(Class) \
Class(Class const&) = delete; \
Class& operator=(Class const&) = delete;
#endif
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment