[PATCH] D54745: [clang-tidy] Don't generate incorrect fixes for class with deleted copy constructor in smart_ptr check.

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Tue Nov 20 06:13:45 PST 2018


hokein added a comment.

Thanks for the review.

In https://reviews.llvm.org/D54745#1303972, @JonasToth wrote:

> Does make_unique require the copy constructor if it could move?


No, in that case, move constructor will be used. I have updated the patch to include these cases.

> And would the same argument apply to the move-constructors as the arguments are forwarded?
>  What would happen in the obscure case of a public copy-constructor, but private move-constructor (not saying it makes sense :))

This depends. The rule is complicated, for some cases it works, for other cases, it won't work.



================
Comment at: test/clang-tidy/modernize-make-unique.cpp:35
 
+struct NoCopyCtor {
+  NoCopyCtor(const NoCopyCtor&) = delete;
----------------
JonasToth wrote:
> please add a case for the `private` copy-constructor as well.
Added more tests.


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D54745





More information about the cfe-commits mailing list