Prazek added inline comments. ================ Comment at: clang-tidy/modernize/MakeSmartPtrCheck.cpp:35 @@ +34,3 @@ + auto CanCallCtor = unless(has(ignoringImpCasts(cxxConstructExpr( + hasDeclaration(decl(anyOf(isPrivate(), isProtected()))))))); + ---------------- aaron.ballman wrote: > Prazek wrote: > > aaron.ballman wrote: > > > Perhaps: `unless(isPublic())` instead of `anyOf(isPrivate(), > > > isProtected())`? > > POD types doesn't have public constructors so it will fail :) > Don't they have an implicit one for the purposes of a CXXConstructExpr? > Looking at an AST dump for: > ``` > struct S { > int i; > }; > ``` > yields: > ``` > |-CXXRecordDecl 0x26d74ae5348 <line:25:1, line:27:1> line:25:8 referenced > struct S definition > | |-CXXRecordDecl 0x26d74ae5460 <col:1, col:8> col:8 implicit struct S > | |-FieldDecl 0x26d74ae7880 <line:26:3, col:7> col:7 i 'int' > | |-CXXConstructorDecl 0x26d74ae87b8 <line:25:8> col:8 implicit used S 'void > (void) noexcept' inline > | | `-CompoundStmt 0x26d74ae3850 <col:8> > | |-CXXConstructorDecl 0x26d74ae34a8 <col:8> col:8 implicit constexpr S 'void > (const struct S &)' inline noexcept-unevaluated 0x26d74ae34a8 > | | `-ParmVarDecl 0x26d74ae35e0 <col:8> col:8 'const struct S &' > | `-CXXConstructorDecl 0x26d74ae3678 <col:8> col:8 implicit constexpr S 'void > (struct S &&)' inline noexcept-unevaluated 0x26d74ae3678 > | `-ParmVarDecl 0x26d74ae37b0 <col:8> col:8 'struct S &&' > ``` what about std::shared_ptr<int> x = std::shared_ptr(new int); ? If I recall correctly, it didn't work on this test.
https://reviews.llvm.org/D23343 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits