PiotrZSL added inline comments.
================ Comment at: clang-tools-extra/clang-tidy/bugprone/UseAfterMoveCheck.cpp:400 void UseAfterMoveCheck::registerMatchers(MatchFinder *Finder) { auto CallMoveMatcher = + callExpr( ---------------- MarcoFalke wrote: > PiotrZSL wrote: > > This is correct but consider this: > > > > ``` > > auto TryEmplaceMatcher = > > cxxMemberCallExpr(callee(cxxMethodDecl(hasName("try_emplace")))); > > > > auto CallMoveMatcher = > > callExpr(argumentCountIs(1), // because matching this will be faster than > > checking name. > > callee(functionDecl(hasName("::std::move"))), > > unless(inDecltypeOrTemplateArg()), > > expr().bind("call-move"), > > unless(hasParent(TryEmplaceMatcher)), > > > > anyOf(hasAncestor(compoundStmt(hasParent(lambdaExpr().bind("containing-lambda")))), > > > > hasAncestor(functionDecl(anyOf(cxxConstructorDecl(hasAnyConstructorInitializer( > > > > withInitializer(expr( > > > > > > anyOf(equalsBounNode("call-move"), > > > > > > hasDescendant(equalsBounNode("call-move"))) > > > > ).bind("containing-ctor-init-stmt") > > > > )) > > > > ).bind("containing-ctor"), > > > > functionDecl().bind("containing-func"))))) > > ); > > ``` > > > I get: > > ``` > error: no matching function for call to object of type 'const > internal::ArgumentAdaptingMatcherFunc<clang::ast_matchers::internal::HasDescendantMatcher>' > > anyOf(equalsBoundNode("call-move"),hasDescendant(equalsBoundNode("call-move"))) > ^~~~~~~~~~~~~ > ./llvm-project/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1491:3: > note: candidate template ignored: could not match 'Matcher' against > 'PolymorphicMatcher' > operator()(const Matcher<T> &InnerMatcher) const { > ^ > ./llvm-project/clang/include/clang/ASTMatchers/ASTMatchersInternal.h:1498:3: > note: candidate template ignored: could not match 'MapAnyOfHelper' against > 'PolymorphicMatcher' > operator()(const MapAnyOfHelper<T...> &InnerMatcher) const { > ^ > 1 error generated. > ``` yee, forgot type: `hasDescendant(callExpr(equalsBoundNode("call-move"))))` +- something like this.. CHANGES SINCE LAST ACTION https://reviews.llvm.org/D146288/new/ https://reviews.llvm.org/D146288 _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits