[PATCH] D25898: [clang-tidy] Enhance modernize-make-unique to handle unique_ptr.reset()

Aaron Ballman via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 26 13:11:42 PDT 2016


aaron.ballman added inline comments.


================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:74
 
+  if (Construct) {
+    checkConstruct(SM, Construct, Type, New);
----------------
Can elide the braces for the `if` and `else`.


================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:147
+      CharSourceRange::getCharRange(OperatorLoc, ExprEnd),
+      " = " + makeSmartPtrFunctionName + "<" +
+          New->getAllocatedType().getAsString(getLangOpts()) + ">");
----------------
I kind of wonder if this should be using `Twine` to avoid a lot of extra allocations and copies.


================
Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:150
+
+  if (Expr->isArrow()) {
+    Diag << FixItHint::CreateInsertion(ExprStart, "*");
----------------
Elide braces


https://reviews.llvm.org/D25898





More information about the cfe-commits mailing list