[PATCH] D54832: [clang-tidy] No fixes for auto new expression in smart check

Haojian Wu via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 26 02:35:05 PST 2018


hokein added inline comments.


================
Comment at: test/clang-tidy/modernize-make-unique.cpp:288
+  // CHECK-MESSAGES: :[[@LINE-1]]:7: warning: use std::make_unique instead
+  // CHECK-FIXES: PE1.reset(new auto(E()));
+
----------------
aaron.ballman wrote:
> It seems like we could also generate the correct replacement for the user here.
> ```
> PE1 = std::make_unique<decltype(E())>();
> ```
> However, I feel like this isn't worth it in general and the correct behavior is to not diagnose in this situation in the first place -- I don't think anyone will find the `make_unique<>` version to be an improvement over the `new auto()` version. What do you think?
This seems reasonable to me. Also the `new auto()` is very rare even in our monolithic repository. 


Repository:
  rCTE Clang Tools Extra

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

https://reviews.llvm.org/D54832





More information about the cfe-commits mailing list