aaron.ballman added a comment.

Good catch! Some small nits.


================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:32-33
@@ -31,1 +31,4 @@
 
+  // It is possible to make smart ptr calling private ctor inside of a member
+  // function. Change to make_smart_ptr will be invalid.
+  auto CallsPrivateCtor = has(
----------------
Nit: this reads a bit strangely, how about: `Calling make_smart_ptr from within 
a member function of a type with a private constructor would be ill-formed.`

================
Comment at: test/clang-tidy/modernize-make-shared.cpp:109
@@ +108,3 @@
+  void create() {
+    auto ptr = std::shared_ptr<Private>(new Private(42));
+  }
----------------
Add comments explaining why make_shared is not correct. Also, please add a case 
showing that protected constructors still get the proper fix applied.

================
Comment at: test/clang-tidy/modernize-make-unique.cpp:112
@@ +111,3 @@
+  void create() {
+    auto ptr = std::unique_ptr<Private>(new Private(42));
+  }
----------------
Add comments as above.


https://reviews.llvm.org/D23343



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

Reply via email to