aaron.ballman accepted this revision. aaron.ballman added a comment. This revision is now accepted and ready to land.
> Currently the smart_ptr check (modernize-make-unique) generates the fixes > that cannot compile for cases like below -- because brace list can not be > deduced in make_unique. > > class Bar { int a, b; }; > class Foo { Foo(Bar); }; > auto foo = std::unique_ptr<Foo>(new Foo({1, 2})); This code isn't legal in the first place. ;-) Aside from some small nits, this LGTM. ================ Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:287 + // Foo(Bar{1, 2}) => true + // Foo(1) => false + auto HasListIntializedArgument = [](const CXXConstructExpr *CE) { ---------------- I assume this is expected to be false? `Foo{1}` ================ Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:294 + // std::initializer_list. + auto IsStdInitListInitConstructExpr = [](const Expr *E) { + assert(E); ---------------- No need for this lambda (then again, it was in the original code). ================ Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:295 + auto IsStdInitListInitConstructExpr = [](const Expr *E) { + assert(E); + if (const auto *ImplicitCE = dyn_cast<CXXConstructExpr>(E)) { ---------------- No need to assert this; `dyn_cast<>` does it for you. Repository: rCTE Clang Tools Extra https://reviews.llvm.org/D54704 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits