From 12251c64548785cb70b09ffd3ba91f639660341f Mon Sep 17 00:00:00 2001 From: Aaron Ballman Date: Fri, 20 Jan 2023 15:35:54 -0500 Subject: [PATCH] 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 --- clang/docs/LibASTMatchersReference.html | 6 +++--- clang/include/clang/ASTMatchers/ASTMatchers.h | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index a67b384..571dfc3 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -9578,9 +9578,9 @@ Given 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>. diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index baedc89..98b727e 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -1102,9 +1102,9 @@ AST_POLYMORPHIC_MATCHER_P( /// template struct A {}; /// A a; /// \endcode -/// classTemplateSpecializationDecl(hasAnyTemplateArgument( -/// refersToType(class(hasName("X"))))) -/// matches the specialization \c A +/// classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType( +/// recordType(hasDeclaration(recordDecl(hasName("X"))))))) +/// matches the specialization of \c struct A generated by \c A. AST_MATCHER_P(TemplateArgument, refersToType, internal::Matcher, InnerMatcher) { if (Node.getKind() != TemplateArgument::Type) -- 2.7.4