[PATCH] D143851: [clang-tidy] Tweak 'rule of 3/5' checks to allow defaulting a destructor outside the class.

Roy Jacobson via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Feb 14 09:42:42 PST 2023


royjacobson added a comment.

In D143851#4126453 <https://reviews.llvm.org/D143851#4126453>, @ClockMan wrote:

> Thing is that same issue may happen with all other members, what about copy/move constructors defaulted in .cpp (just to speed up compilation for classes with many members).
> Best thing would simply to check if all definitions are available. In that case issues would be reported only for source file that corresponds to header file with defined class.
> This would also reduce amount of generated warnings for a big project that include such header with class in many places.
>
> Other good option would be to excluded classes defined in system headers, no point to check if some boost class or std::vector got proper constructors.

Defaulting destructors is usually fine, but explicitly defaulting copy/move constructors implicitly deletes the other special member functions which this check should diagnose.
This is why this option was only available for destructors in the first place, I imagine.

About the second point - this sounds pretty general, doesn't clang-tidy already filter diagnostics in system headers? At least Clang does.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D143851/new/

https://reviews.llvm.org/D143851



More information about the cfe-commits mailing list