[PATCH] D30610: [clang-tidy] Added options to cppcoreguidelines-special-member-functions check

Malcolm Parsons via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Nov 24 14:48:03 PST 2017


malcolm.parsons added a comment.

I have 1000s of warnings from this check.

A lot of them are about google tests:
warning: class 'Foo_Bar_Test' defines a copy constructor and a copy assignment operator but does not define a destructor [cppcoreguidelines-special-member-functions]
I'd like an option to suppress these.

It warns about classes that use boost::noncopyable:
warning: class 'Foo' defines a non-default destructor but does not define a copy constructor or a copy assignment operator [cppcoreguidelines-special-member-functions]
class Foo : boost::noncopyable
I think this is a bug in the check.

In https://reviews.llvm.org/D30610#934862, @fgross wrote:

> My 2 cents on this one: Even with `AllowMissingMoveFunctions=1` at least the missing destructor definition should be diagnosed, because it violates the classic rule of three. If you delete your copy operations, you likely have some resources that need to be taken care of in your destructor, so this piece of code would worry me. Better be clear about it and explicitly default the destructor.


This is a rule of zero class, but with copying disabled; the resources are just as safe as with a normal rule of zero class.


https://reviews.llvm.org/D30610





More information about the cfe-commits mailing list