poelmanc added a comment.

In D69145#1725026 <https://reviews.llvm.org/D69145#1725026>, @malcolm.parsons 
wrote:

> I like that this check warns about copy constructors that don't copy.
>  The warning can be suppressed with a NOLINT comment if not copying is 
> intentional.


Thanks for the comment! It's not clear to me how you suggest proceeding though.

I think it would be great to have a warning about "copy constructors that don't 
copy", which I would expect to warn regardless of whether the default 
initialization is explicit, e.g.

  MyClass( const MyClass& other) : BaseClass() {...}`

or implicit, e.g.

  MyClass( const MyClass& other) {...}

An intelligent "copy constructors that don't copy" warning might even examine 
the `{...}` to see what's being handled there.

Unfortunately currently we have two tools each of which warns in one case but 
not the other:

- `gcc -Wextra` warns only in the latter case, and can be fixed by changing 
each occurrence to the former.
- clang-tidy's current `readability-redundant-member-init` check warns only in 
the former case, and fixes it by changing each occurrence to the latter.
  - (Also clang-tidy's warning about `: BaseClass()` being redundant isn't a 
very clear warning about copy constructor that don't copy.)

This patch just offers an option to make peace between the two tools.


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D69145



_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to