malcolm.parsons added inline comments.

================
Comment at: test/clang-tidy/modernize-make-shared.cpp:122
+  Pderived = std::shared_ptr<Derived>(new Derived());
+  // CHECK-MESSAGES: :[[@LINE-1]]:14: warning: use std::make_shared instead
+  // CHECK-FIXES: Pderived = std::make_shared<Derived>();
----------------
Prazek wrote:
> I think the warning here could be better. The user is using make_shared here.
> Maybe ' warning: use std::make_shared with zero arguments ...', but only in 
> this case
The user isn't using make_shared.


================
Comment at: test/clang-tidy/modernize-make-shared.cpp:129
+  // FIXME: OK to replace when auto is not used
+  std::shared_ptr<Base> PBase = std::shared_ptr<Base>(new Derived());
+
----------------
Prazek wrote:
> I think it is good to replace it even with auto, like
> auto PBase = std::make_shared<Base>(new Derived());
> 
> For shared_ptr we can even do better, that we can't do for unique_ptr - we
> coud change it to
> auto PBase = std::make_shared<Derived>();
> because all conversions works.
> Of course not in this patch, but it would be good to leave a comment about 
> this here.
A smart pointer to Derived cannot be reset with a pointer to Base.


https://reviews.llvm.org/D25898



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

Reply via email to