Author: Aaron Ballman Date: 2023-01-20T15:36:57-05:00 New Revision: 12251c64548785cb70b09ffd3ba91f639660341f
URL: https://github.com/llvm/llvm-project/commit/12251c64548785cb70b09ffd3ba91f639660341f DIFF: https://github.com/llvm/llvm-project/commit/12251c64548785cb70b09ffd3ba91f639660341f.diff LOG: Correct documentation for the refersToType AST matcher The docs used a nonexisting matcher that caused some confusion. It has now been replaced with the correct syntax. Fixes #58044 Added: Modified: clang/docs/LibASTMatchersReference.html clang/include/clang/ASTMatchers/ASTMatchers.h Removed: ################################################################################ diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index a67b384d537b8..571dfc3f21b81 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -9578,9 +9578,9 @@ <h2 id="traversal-matchers">AST Traversal Matchers</h2> struct X {}; template<typename T> struct A {}; A<X> a; -classTemplateSpecializationDecl(hasAnyTemplateArgument( - refersToType(class(hasName("X"))))) - matches the specialization A<X> +classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType( + recordType(hasDeclaration(recordDecl(hasName("X"))))))) +matches the specialization of struct A generated by A<X>. </pre></td></tr> diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index baedc890881c6..98b727e6940b5 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -1102,9 +1102,9 @@ AST_POLYMORPHIC_MATCHER_P( /// template<typename T> struct A {}; /// A<X> a; /// \endcode -/// classTemplateSpecializationDecl(hasAnyTemplateArgument( -/// refersToType(class(hasName("X"))))) -/// matches the specialization \c A<X> +/// classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType( +/// recordType(hasDeclaration(recordDecl(hasName("X"))))))) +/// matches the specialization of \c struct A generated by \c A<X>. AST_MATCHER_P(TemplateArgument, refersToType, internal::Matcher<QualType>, InnerMatcher) { if (Node.getKind() != TemplateArgument::Type) _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits