From 5340574a9ac6335e2effc15e73f122018ffc58a2 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 28 Oct 2025 22:33:53 +0300 Subject: [PATCH 01/11] [GitHub][CI] Add running of dump_ast_matchers.py to premerge workflow --- llvm/utils/git/code-format-helper.py | 65 +++++++++++++++++++++++++++- 1 file changed, 64 insertions(+), 1 deletion(-) diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index 406a72817acb8..6de7d21ab68a6 100755 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -466,7 +466,70 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str return report -ALL_FORMATTERS = (DarkerFormatHelper(), ClangFormatHelper(), UndefGetFormatHelper()) +class DumpASTMatchersHelper(FormatHelper): + name = "dump_ast_matchers" + friendly_name = "AST matchers documentation" + + output_html = "clang/docs/LibASTMatchersReference.html" + script_dir = "clang/docs/tools" + script_name = "dump_ast_matchers.py" + + @property + def instructions(self) -> str: + return f"cd {self.script_dir} && python {self.script_name}" + + def should_run(self, changed_files: List[str]) -> List[str]: + for file in changed_files: + if file == "clang/include/clang/ASTMatchers/ASTMatchers.h": + return True + return False + + def has_tool(self) -> bool: + if not os.path.exists(os.path.join(self.script_dir, self.script_name)): + return False + return True + + def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str]: + if not self.should_run(changed_files): + return None + + if args.verbose: + print(f"Running: {self.instructions}") + + # Run the 'dump_ast_matchers.py' from its directory as specified in the script doc + proc = subprocess.run( + ["python", self.script_name], + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, + encoding="utf-8", + cwd=self.script_dir, + ) + + if proc.returncode != 0: + return f"Execution of 'dump_ast_matchers.py' failed:\n{proc.stderr}\n{proc.stdout}" + + # Check if 'LibASTMatchersReference.html' file was modified + cmd = ["git", "diff", "--exit-code", self.output_html] + proc = subprocess.run( + cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8" + ) + + # 'LibASTMatchersReference.html' was modified - count as failure + if proc.returncode != 0: + if args.verbose: + print(f"error: {self.name} exited with code {proc.returncode}") + print(proc.stdout.decode("utf-8")) + return proc.stdout.decode("utf-8") + else: + return None + + +ALL_FORMATTERS = ( + DarkerFormatHelper(), + ClangFormatHelper(), + UndefGetFormatHelper(), + DumpASTMatchersHelper(), +) def hook_main(): From 1e19a19d600a6238e53b19a5cc75c81e7232b93e Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 28 Oct 2025 23:25:38 +0300 Subject: [PATCH 02/11] add change to matchers --- clang/include/clang/ASTMatchers/ASTMatchers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index 98e62de2a9bfb..cc72613db4d15 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -1390,7 +1390,7 @@ extern const internal::VariadicDynCastAllOfMatcher /// Matches concept requirement body declaration. /// -/// Example matches '{ *p; }' +/// Example matches '{ * p; }' /// \code /// template /// concept dereferencable = requires(T p) { *p; } From 7669f00a30207bda4bca1d78c05712375889d597 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 28 Oct 2025 23:54:20 +0300 Subject: [PATCH 03/11] use python3 --- llvm/utils/git/code-format-helper.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index 6de7d21ab68a6..0ae800d4000c9 100755 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -476,7 +476,7 @@ class DumpASTMatchersHelper(FormatHelper): @property def instructions(self) -> str: - return f"cd {self.script_dir} && python {self.script_name}" + return f"cd {self.script_dir} && python3 {self.script_name}" def should_run(self, changed_files: List[str]) -> List[str]: for file in changed_files: @@ -498,7 +498,7 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str # Run the 'dump_ast_matchers.py' from its directory as specified in the script doc proc = subprocess.run( - ["python", self.script_name], + ["python3", self.script_name], stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8", @@ -506,7 +506,7 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str ) if proc.returncode != 0: - return f"Execution of 'dump_ast_matchers.py' failed:\n{proc.stderr}\n{proc.stdout}" + return f"dump_ast_matchers.py failed with code {proc.returncode}:\n{proc.stderr}\n{proc.stdout}" # Check if 'LibASTMatchersReference.html' file was modified cmd = ["git", "diff", "--exit-code", self.output_html] @@ -518,8 +518,8 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str if proc.returncode != 0: if args.verbose: print(f"error: {self.name} exited with code {proc.returncode}") - print(proc.stdout.decode("utf-8")) - return proc.stdout.decode("utf-8") + print(proc.stdout) + return proc.stdout else: return None From 8aa3cb4a42264d325f796a3e13c6c5cdee34ef6d Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Tue, 28 Oct 2025 23:58:24 +0300 Subject: [PATCH 04/11] run test command provided by dump_ast_matchers.py --- clang/docs/LibASTMatchersReference.html | 594 +++++++++++++----------- 1 file changed, 313 insertions(+), 281 deletions(-) diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index 9b30057b5257f..09337281bb0ca 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -1028,6 +1028,15 @@

Node Matchers

+Matcher<Decl>requiresExprBodyDeclMatcher<RequiresExprBodyDecl>... +
Matches concept requirement body declaration.
+
+Example matches '{ * p; }'
+  template<typename T>
+  concept dereferencable = requires(T p) { *p; }
+
+ + Matcher<Decl>staticAssertDeclMatcher<StaticAssertDecl>...
Matches a C++ static_assert declaration.
 
@@ -1190,6 +1199,17 @@ 

Node Matchers

matches using enum X::x
+Matcher<Decl>usingShadowDeclMatcher<UsingShadowDecl>... +
Matches shadow declarations introduced into a scope by a
+       (resolved) using declaration.
+
+Given
+  namespace n { int f; }
+  namespace declToImport { using n::f; }
+usingShadowDecl()
+  matches f 
+ + Matcher<Decl>valueDeclMatcher<ValueDecl>...
Matches any value declaration.
 
@@ -1210,6 +1230,15 @@ 

Node Matchers

+Matcher<Expr>requiresExprMatcher<RequiresExpr>... +
Matches concept requirement.
+
+Example matches 'requires(T p) { *p; }'
+  template<typename T>
+  concept dereferencable = requires(T p) { *p; }
+
+ + Matcher<LambdaCapture>lambdaCaptureMatcher<LambdaCapture>...
Matches lambda captures.
 
@@ -1679,6 +1708,19 @@ 

Node Matchers

+Matcher<Stmt>cxxNamedCastExprMatcher<CXXNamedCastExpr>... +
Matches any named cast expression.
+
+Example: Matches all four of the casts in
+  struct S { virtual void f(); };
+  S* p = nullptr;
+  S* ptr1 = static_cast<S*>(p);
+  S* ptr2 = reinterpret_cast<S*>(p);
+  S* ptr3 = dynamic_cast<S*>(p);
+  S* ptr4 = const_cast<S*>(p);
+
+ + Matcher<Stmt>cxxNewExprMatcher<CXXNewExpr>...
Matches new expressions.
 
@@ -2168,7 +2210,7 @@ 

Node Matchers

-Matcher<Stmt>ompExecutableDirectiveMatcher<OMPExecutableDirective>... +Matcher<Stmt>ompExecutableDirectiveMatcher<OMPExecutableDirective>...
Matches any ``#pragma omp`` executable directive.
 
 Given
@@ -2393,17 +2435,6 @@ 

Node Matchers

-Matcher<TypeLoc>elaboratedTypeLocMatcher<ElaboratedTypeLoc>... -
Matches C or C++ elaborated `TypeLoc`s.
-
-Given
-  struct s {};
-  struct s ss;
-elaboratedTypeLoc()
-  matches the `TypeLoc` of the variable declaration of `ss`.
-
- - Matcher<TypeLoc>pointerTypeLocMatcher<PointerTypeLoc>...
Matches pointer `TypeLoc`s.
 
@@ -2474,7 +2505,7 @@ 

Node Matchers

-Matcher<Type>autoTypeMatcher<AutoType>... +Matcher<Type>autoTypeMatcher<AutoType>...
Matches types nodes representing C++11 auto types.
 
 Given:
@@ -2544,7 +2575,7 @@ 

Node Matchers

-Matcher<Type>decltypeTypeMatcher<DecltypeType>... +Matcher<Type>decltypeTypeMatcher<DecltypeType>...
Matches types nodes representing C++11 decltype(<expr>) types.
 
 Given:
@@ -2556,7 +2587,7 @@ 

Node Matchers

-Matcher<Type>deducedTemplateSpecializationTypeMatcher<DeducedTemplateSpecializationType>... +Matcher<Type>deducedTemplateSpecializationTypeMatcher<DeducedTemplateSpecializationType>...
Matches C++17 deduced template specialization types, e.g. deduced class
 template types.
 
@@ -2570,7 +2601,7 @@ 

Node Matchers

-Matcher<Type>dependentNameTypeMatcher<DependentNameType>... +Matcher<Type>dependentNameTypeMatcher<DependentNameType>...
Matches a dependent name type
 
 Example matches T::type
@@ -2607,38 +2638,7 @@ 

Node Matchers

-Matcher<Type>dependentTemplateSpecializationTypeMatcher<DependentTemplateSpecializationType>... -
Matches a dependent template specialization type
-
-Example matches A<T>::template B<T>
-  template<typename T> struct A;
-  template<typename T> struct declToImport {
-    typename A<T>::template B<T> a;
-  };
-
- - -Matcher<Type>elaboratedTypeMatcher<ElaboratedType>... -
Matches types specified with an elaborated type keyword or with a
-qualified name.
-
-Given
-  namespace N {
-    namespace M {
-      class D {};
-    }
-  }
-  class C {};
-
-  class C c;
-  N::M::D d;
-
-elaboratedType() matches the type of the variable declarations of both
-c and d.
-
- - -Matcher<Type>enumTypeMatcher<EnumType>... +Matcher<Type>enumTypeMatcher<EnumType>...
Matches enum types.
 
 Given
@@ -2688,7 +2688,7 @@ 

Node Matchers

-Matcher<Type>injectedClassNameTypeMatcher<InjectedClassNameType>... +Matcher<Type>injectedClassNameTypeMatcher<InjectedClassNameType>...
Matches injected class name types.
 
 Example matches S s, but not S<T> s.
@@ -2800,7 +2800,7 @@ 

Node Matchers

-Matcher<Type>recordTypeMatcher<RecordType>... +Matcher<Type>recordTypeMatcher<RecordType>...
Matches record types (e.g. structs, classes).
 
 Given
@@ -2831,7 +2831,7 @@ 

Node Matchers

-Matcher<Type>substTemplateTypeParmTypeMatcher<SubstTemplateTypeParmType>... +Matcher<Type>substTemplateTypeParmTypeMatcher<SubstTemplateTypeParmType>...
Matches types that represent the result of substituting a type for a
 template type parameter.
 
@@ -2845,7 +2845,7 @@ 

Node Matchers

-Matcher<Type>tagTypeMatcher<TagType>... +Matcher<Type>tagTypeMatcher<TagType>...
Matches tag types (record and enum types).
 
 Given
@@ -2860,7 +2860,7 @@ 

Node Matchers

-Matcher<Type>templateSpecializationTypeMatcher<TemplateSpecializationType>... +Matcher<Type>templateSpecializationTypeMatcher<TemplateSpecializationType>...
Matches template specialization types.
 
 Given
@@ -2875,7 +2875,7 @@ 

Node Matchers

-Matcher<Type>templateTypeParmTypeMatcher<TemplateTypeParmType>... +Matcher<Type>templateTypeParmTypeMatcher<TemplateTypeParmType>...
Matches template type parameter types.
 
 Example matches T, but not int.
@@ -2899,7 +2899,7 @@ 

Node Matchers

-Matcher<Type>unaryTransformTypeMatcher<UnaryTransformType>... +Matcher<Type>unaryTransformTypeMatcher<UnaryTransformType>...
Matches types nodes representing unary type transformations.
 
 Given:
@@ -3077,8 +3077,8 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isPrivate -
Matches private C++ declarations and C++ base specifers that specify private
-inheritance.
+
Matches private C++ declarations and C++ base specifiers that specify
+private inheritance.
 
 Examples:
   class C {
@@ -3094,7 +3094,7 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isProtected -
Matches protected C++ declarations and C++ base specifers that specify
+
Matches protected C++ declarations and C++ base specifiers that specify
 protected inheritance.
 
 Examples:
@@ -3110,7 +3110,7 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isPublic -
Matches public C++ declarations and C++ base specifers that specify public
+
Matches public C++ declarations and C++ base specifiers that specify public
 inheritance.
 
 Examples:
@@ -3127,7 +3127,7 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isVirtual -
Matches declarations of virtual methods and C++ base specifers that specify
+
Matches declarations of virtual methods and C++ base specifiers that specify
 virtual inheritance.
 
 Example:
@@ -3709,7 +3709,7 @@ 

Narrowing Matchers

Matcher<CXXMethodDecl>isVirtual -
Matches declarations of virtual methods and C++ base specifers that specify
+
Matches declarations of virtual methods and C++ base specifiers that specify
 virtual inheritance.
 
 Example:
@@ -4161,6 +4161,12 @@ 

Narrowing Matchers

+Matcher<Decl>declaresSameEntityAsBoundNodestd::string ID +
Matches a declaration if it declares the same entity as the node previously
+bound to ID.
+
+ + Matcher<Decl>equalsBoundNodestd::string ID
Matches if a node equals a previously bound node.
 
@@ -4322,8 +4328,8 @@ 

Narrowing Matchers

Matcher<Decl>isPrivate -
Matches private C++ declarations and C++ base specifers that specify private
-inheritance.
+
Matches private C++ declarations and C++ base specifiers that specify
+private inheritance.
 
 Examples:
   class C {
@@ -4339,7 +4345,7 @@ 

Narrowing Matchers

Matcher<Decl>isProtected -
Matches protected C++ declarations and C++ base specifers that specify
+
Matches protected C++ declarations and C++ base specifiers that specify
 protected inheritance.
 
 Examples:
@@ -4355,7 +4361,7 @@ 

Narrowing Matchers

Matcher<Decl>isPublic -
Matches public C++ declarations and C++ base specifers that specify public
+
Matches public C++ declarations and C++ base specifiers that specify public
 inheritance.
 
 Examples:
@@ -4371,7 +4377,7 @@ 

Narrowing Matchers

-Matcher<DependentNameType>hasDependentNamestd::string N +Matcher<DependentNameType>hasDependentNamestd::string N
Matches the dependent name of a DependentScopeDeclRefExpr or
 DependentNameType
 
@@ -5046,7 +5052,7 @@ 

Narrowing Matchers

int z; Example matches f() because it has external formal linkage despite being -unique to the translation unit as though it has internal likage +unique to the translation unit as though it has internal linkage (matcher = functionDecl(hasExternalFormalLinkage())) namespace { @@ -5182,7 +5188,7 @@

Narrowing Matchers

-Matcher<OMPExecutableDirective>isAllowedToContainClauseKindOpenMPClauseKind CKind +Matcher<OMPExecutableDirective>isAllowedToContainClauseKindOpenMPClauseKind CKind
Matches if the OpenMP directive is allowed to contain the specified OpenMP
 clause kind.
 
@@ -5192,7 +5198,7 @@ 

Narrowing Matchers

#pragma omp parallel for #pragma omp for -`ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches +``ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches ``omp parallel`` and ``omp parallel for``. If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter @@ -5201,7 +5207,7 @@

Narrowing Matchers

-Matcher<OMPExecutableDirective>isStandaloneDirective +Matcher<OMPExecutableDirective>isStandaloneDirective
Matches standalone OpenMP directives,
 i.e., directives that can't have a structured block.
 
@@ -5545,10 +5551,10 @@ 

Narrowing Matchers

Given void a(int); - void b(long); + void b(unsigned long); void c(double); functionDecl(hasAnyParameter(hasType(isInteger()))) -matches "a(int)", "b(long)", but not "c(double)". +matches "a(int)", "b(unsigned long)", but not "c(double)".
@@ -5781,7 +5787,7 @@

Narrowing Matchers

Matches a TemplateArgument of integral type with a given value.
 
 Note that 'Value' is a string as the template argument's value is
-an arbitrary precision integer. 'Value' must be euqal to the canonical
+an arbitrary precision integer. 'Value' must be equal to the canonical
 representation of that integral value in base 10.
 
 Given
@@ -5806,7 +5812,7 @@ 

Narrowing Matchers

-Matcher<TemplateSpecializationType>templateArgumentCountIsunsigned N +Matcher<TemplateSpecializationType>templateArgumentCountIsunsigned N
Matches if the number of template arguments equals N.
 
 Given
@@ -6571,8 +6577,8 @@ 

AST Traversal Matchers

Matcher<AbstractConditionalOperator>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop,
-switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop, while loop,
+do-while loop, switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
@@ -6600,8 +6606,8 @@ 

AST Traversal Matchers

-Matcher<AddrLabelExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<AddrLabelExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -6626,11 +6632,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -6701,7 +6707,7 @@

AST Traversal Matchers

-Matcher<AutoType>hasDeducedTypeMatcher<Type> +Matcher<AutoType>hasDeducedTypeMatcher<Type>
Matches AutoType nodes where the deduced type is a specific type.
 
 Note: There is no TypeLoc for the deduced type and thus no
@@ -6713,7 +6719,7 @@ 

AST Traversal Matchers

autoType(hasDeducedType(isInteger())) matches "auto a" -Usable as: Matcher<AutoType> +Usable as: Matcher<AutoType>
@@ -7026,8 +7032,8 @@

AST Traversal Matchers

-Matcher<CXXConstructExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<CXXConstructExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -7052,11 +7058,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -7489,8 +7495,8 @@

AST Traversal Matchers

-Matcher<CXXNewExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<CXXNewExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -7515,11 +7521,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -7952,8 +7958,8 @@

AST Traversal Matchers

-Matcher<CallExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<CallExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -7978,11 +7984,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -8204,7 +8210,7 @@

AST Traversal Matchers

Matcher<DecayedType>hasDecayedTypeMatcher<QualType> InnerType -
Matches the decayed type, whoes decayed type matches InnerMatcher
+
Matches the decayed type, whose decayed type matches InnerMatcher
 
@@ -8223,8 +8229,8 @@

AST Traversal Matchers

-Matcher<DeclRefExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<DeclRefExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -8249,11 +8255,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -8373,24 +8379,11 @@

AST Traversal Matchers

} } -cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the +cxxRecordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the declaration of class D.
-Matcher<DecltypeType>hasUnderlyingTypeMatcher<Type> -
Matches DecltypeType or UsingType nodes to find the underlying type.
-
-Given
-  decltype(1) a = 1;
-  decltype(2.0) b = 2.0;
-decltypeType(hasUnderlyingType(isInteger()))
-  matches the type of "a"
-
-Usable as: Matcher<DecltypeType>, Matcher<UsingType>
-
- - Matcher<DecompositionDecl>hasAnyBindingMatcher<BindingDecl> InnerMatcher
Matches any binding of a DecompositionDecl.
 
@@ -8451,66 +8444,16 @@ 

AST Traversal Matchers

Matcher<DoStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop,
-switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop, while loop,
+do-while loop, switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
-Matcher<ElaboratedTypeLoc>hasNamedTypeLocMatcher<TypeLoc> InnerMatcher -
Matches elaborated `TypeLoc`s that have a named `TypeLoc` matching
-`InnerMatcher`.
-
-Given
-  template <typename T>
-  class C {};
-  class C<int> c;
-
-  class D {};
-  class D d;
-elaboratedTypeLoc(hasNamedTypeLoc(templateSpecializationTypeLoc()));
-  matches the `TypeLoc` of the variable declaration of `c`, but not `d`.
-
- - -Matcher<ElaboratedType>hasQualifierMatcher<NestedNameSpecifier> InnerMatcher -
Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
-matches InnerMatcher if the qualifier exists.
-
-Given
-  namespace N {
-    namespace M {
-      class D {};
-    }
-  }
-  N::M::D d;
-
-elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
-matches the type of the variable declaration of d.
-
- - -Matcher<ElaboratedType>namesTypeMatcher<QualType> InnerMatcher -
Matches ElaboratedTypes whose named type matches InnerMatcher.
-
-Given
-  namespace N {
-    namespace M {
-      class D {};
-    }
-  }
-  N::M::D d;
-
-elaboratedType(namesType(recordType(
-hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
-declaration of d.
-
- - -Matcher<EnumType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<EnumType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -8535,11 +8478,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -8788,14 +8731,26 @@

AST Traversal Matchers

Matcher<ForStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop,
-switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop, while loop,
+do-while loop, switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
+Matcher<ForStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher +
Matches the condition variable statement in an if statement, for loop,
+while loop or switch statement.
+
+Given
+  if (A* a = GetAPointer()) {}
+  for (; A* a = GetAPointer(); ) {}
+hasConditionVariableStatement(...)
+  matches both 'A* a = GetAPointer()'.
+
+ + Matcher<ForStmt>hasIncrementMatcher<Stmt> InnerMatcher
Matches the increment statement of a for loop.
 
@@ -9099,8 +9054,8 @@ 

AST Traversal Matchers

Matcher<IfStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop,
-switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop, while loop,
+do-while loop, switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
@@ -9108,12 +9063,14 @@ 

AST Traversal Matchers

Matcher<IfStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher -
Matches the condition variable statement in an if statement.
+
Matches the condition variable statement in an if statement, for loop,
+while loop or switch statement.
 
 Given
   if (A* a = GetAPointer()) {}
+  for (; A* a = GetAPointer(); ) {}
 hasConditionVariableStatement(...)
-  matches 'A* a = GetAPointer()'.
+  matches both 'A* a = GetAPointer()'.
 
@@ -9179,8 +9136,8 @@

AST Traversal Matchers

-Matcher<InjectedClassNameType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<InjectedClassNameType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9205,16 +9162,16 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
-Matcher<LabelStmt>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<LabelStmt>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9239,11 +9196,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -9293,8 +9250,8 @@

AST Traversal Matchers

-Matcher<MemberExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<MemberExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9319,11 +9276,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -9456,7 +9413,7 @@

AST Traversal Matchers

-Matcher<OMPExecutableDirective>hasAnyClauseMatcher<OMPClause> InnerMatcher +Matcher<OMPExecutableDirective>hasAnyClauseMatcher<OMPClause> InnerMatcher
Matches any clause in an OpenMP directive.
 
 Given
@@ -9469,7 +9426,7 @@ 

AST Traversal Matchers

-Matcher<OMPExecutableDirective>hasStructuredBlockMatcher<Stmt> InnerMatcher +Matcher<OMPExecutableDirective>hasStructuredBlockMatcher<Stmt> InnerMatcher
Matches the structured-block of the OpenMP executable directive
 
 Prerequisite: the executable directive must not be standalone directive.
@@ -9826,8 +9783,8 @@ 

AST Traversal Matchers

-Matcher<QualType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<QualType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9852,11 +9809,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -9920,8 +9877,8 @@

AST Traversal Matchers

-Matcher<RecordType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<RecordType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9946,11 +9903,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -10066,7 +10023,7 @@

AST Traversal Matchers

-Matcher<SubstTemplateTypeParmType>hasReplacementTypeMatcher<Type> +Matcher<SubstTemplateTypeParmType>hasReplacementTypeMatcher<Type>
Matches template type parameter substitutions that have a replacement
 type that matches the provided matcher.
 
@@ -10094,14 +10051,26 @@ 

AST Traversal Matchers

Matcher<SwitchStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop,
-switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop, while loop,
+do-while loop, switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
+Matcher<SwitchStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher +
Matches the condition variable statement in an if statement, for loop,
+while loop or switch statement.
+
+Given
+  if (A* a = GetAPointer()) {}
+  for (; A* a = GetAPointer(); ) {}
+hasConditionVariableStatement(...)
+  matches both 'A* a = GetAPointer()'.
+
+ + Matcher<SwitchStmt>hasInitStatementMatcher<Stmt> InnerMatcher
Matches selection statements with initializer.
 
@@ -10125,8 +10094,8 @@ 

AST Traversal Matchers

-Matcher<TagType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TagType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10151,11 +10120,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -10284,7 +10253,7 @@

AST Traversal Matchers

-Matcher<TemplateSpecializationType>forEachTemplateArgumentMatcher<TemplateArgument> InnerMatcher +Matcher<TemplateSpecializationType>forEachTemplateArgumentMatcher<TemplateArgument> InnerMatcher
Matches templateSpecializationType, class template specialization,
 variable template specialization, and function template specialization
 nodes where the template argument matches the inner matcher. This matcher
@@ -10310,7 +10279,7 @@ 

AST Traversal Matchers

-Matcher<TemplateSpecializationType>hasAnyTemplateArgumentMatcher<TemplateArgument> InnerMatcher +Matcher<TemplateSpecializationType>hasAnyTemplateArgumentMatcher<TemplateArgument> InnerMatcher
Matches templateSpecializationTypes, class template specializations,
 variable template specializations, and function template specializations
 that have at least one TemplateArgument matching the given InnerMatcher.
@@ -10332,8 +10301,8 @@ 

AST Traversal Matchers

-Matcher<TemplateSpecializationType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TemplateSpecializationType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10358,15 +10327,15 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
-Matcher<TemplateSpecializationType>hasTemplateArgumentunsigned N, Matcher<TemplateArgument> InnerMatcher +Matcher<TemplateSpecializationType>hasTemplateArgumentunsigned N, Matcher<TemplateArgument> InnerMatcher
Matches templateSpecializationType, class template specializations,
 variable template specializations, and function template specializations
 where the n'th TemplateArgument matches the given InnerMatcher.
@@ -10387,8 +10356,8 @@ 

AST Traversal Matchers

-Matcher<TemplateTypeParmType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TemplateTypeParmType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10413,11 +10382,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -10473,8 +10442,8 @@

AST Traversal Matchers

-Matcher<TypedefType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TypedefType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10499,11 +10468,41 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType> +
+ + +Matcher<Type>hasQualifierMatcher<NestedNameSpecifier> InnerMatcher +
Matches Types whose qualifier, a NestedNameSpecifier,
+matches InnerMatcher if the qualifier exists.
+
+Given
+  namespace N {
+    namespace M {
+      class D {};
+    }
+  }
+  N::M::D d;
+
+elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
+matches the type of the variable declaration of d.
+
+ + +Matcher<Type>hasUnderlyingTypeMatcher<QualType> Inner +
Matches QualType nodes to find the underlying type.
+
+Given
+  decltype(1) a = 1;
+  decltype(2.0) b = 2.0;
+decltypeType(hasUnderlyingType(isInteger()))
+  matches the type of "a"
+
+Usable as: Matcher<QualType>
 
@@ -10556,8 +10555,8 @@

AST Traversal Matchers

-Matcher<UnresolvedUsingType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<UnresolvedUsingType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10582,11 +10581,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>, Matcher<UsingType>
@@ -10602,16 +10601,37 @@

AST Traversal Matchers

matches using X::b but not using X::a
-Matcher<UsingType>hasUnderlyingTypeMatcher<Type> -
Matches DecltypeType or UsingType nodes to find the underlying type.
+Matcher<UsingType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
+matches the given matcher.
 
-Given
-  decltype(1) a = 1;
-  decltype(2.0) b = 2.0;
-decltypeType(hasUnderlyingType(isInteger()))
-  matches the type of "a"
+The associated declaration is:
+- for type nodes, the declaration of the underlying type
+- for CallExpr, the declaration of the callee
+- for MemberExpr, the declaration of the referenced member
+- for CXXConstructExpr, the declaration of the constructor
+- for CXXNewExpr, the declaration of the operator new
+- for ObjCIvarExpr, the declaration of the ivar
+
+For type nodes, hasDeclaration will generally match the declaration of the
+sugared type. Given
+  class X {};
+  typedef X Y;
+  Y y;
+in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
+typedefDecl. A common use case is to match the underlying, desugared type.
+This can be achieved by using the hasUnqualifiedDesugaredType matcher:
+  varDecl(hasType(hasUnqualifiedDesugaredType(
+      recordType(hasDeclaration(decl())))))
+In this matcher, the decl will match the CXXRecordDecl of class X.
 
-Usable as: Matcher<DecltypeType>, Matcher<UsingType>
+Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
+  Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
+  Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>,
+  Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>,
+  Matcher<TagType>, Matcher<TemplateSpecializationType>,
+  Matcher<TemplateTypeParmType>, Matcher<TypedefType>,
+  Matcher<UnresolvedUsingType>, Matcher<UsingType>
 
@@ -10832,13 +10852,25 @@

AST Traversal Matchers

Matcher<WhileStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop,
-switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop, while loop,
+do-while loop, switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
+ +Matcher<WhileStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher +
Matches the condition variable statement in an if statement, for loop,
+while loop or switch statement.
+
+Given
+  if (A* a = GetAPointer()) {}
+  for (; A* a = GetAPointer(); ) {}
+hasConditionVariableStatement(...)
+  matches both 'A* a = GetAPointer()'.
+
+ From 510979936cab74c8e5e2e47b8c712451822e92d1 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 29 Oct 2025 00:01:07 +0300 Subject: [PATCH 05/11] Revert "add change to matchers" This reverts commit 1e19a19d600a6238e53b19a5cc75c81e7232b93e. --- clang/include/clang/ASTMatchers/ASTMatchers.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h index cc72613db4d15..98e62de2a9bfb 100644 --- a/clang/include/clang/ASTMatchers/ASTMatchers.h +++ b/clang/include/clang/ASTMatchers/ASTMatchers.h @@ -1390,7 +1390,7 @@ extern const internal::VariadicDynCastAllOfMatcher /// Matches concept requirement body declaration. /// -/// Example matches '{ * p; }' +/// Example matches '{ *p; }' /// \code /// template /// concept dereferencable = requires(T p) { *p; } From fd7c03b32c2c3a4bcbab0f8e5d72e1621104d902 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 29 Oct 2025 00:01:20 +0300 Subject: [PATCH 06/11] Revert "run test command provided by dump_ast_matchers.py" This reverts commit 8aa3cb4a42264d325f796a3e13c6c5cdee34ef6d. --- clang/docs/LibASTMatchersReference.html | 594 +++++++++++------------- 1 file changed, 281 insertions(+), 313 deletions(-) diff --git a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html index 09337281bb0ca..9b30057b5257f 100644 --- a/clang/docs/LibASTMatchersReference.html +++ b/clang/docs/LibASTMatchersReference.html @@ -1028,15 +1028,6 @@

Node Matchers

-Matcher<Decl>requiresExprBodyDeclMatcher<RequiresExprBodyDecl>... -
Matches concept requirement body declaration.
-
-Example matches '{ * p; }'
-  template<typename T>
-  concept dereferencable = requires(T p) { *p; }
-
- - Matcher<Decl>staticAssertDeclMatcher<StaticAssertDecl>...
Matches a C++ static_assert declaration.
 
@@ -1199,17 +1190,6 @@ 

Node Matchers

matches using enum X::x
-Matcher<Decl>usingShadowDeclMatcher<UsingShadowDecl>... -
Matches shadow declarations introduced into a scope by a
-       (resolved) using declaration.
-
-Given
-  namespace n { int f; }
-  namespace declToImport { using n::f; }
-usingShadowDecl()
-  matches f 
- - Matcher<Decl>valueDeclMatcher<ValueDecl>...
Matches any value declaration.
 
@@ -1230,15 +1210,6 @@ 

Node Matchers

-Matcher<Expr>requiresExprMatcher<RequiresExpr>... -
Matches concept requirement.
-
-Example matches 'requires(T p) { *p; }'
-  template<typename T>
-  concept dereferencable = requires(T p) { *p; }
-
- - Matcher<LambdaCapture>lambdaCaptureMatcher<LambdaCapture>...
Matches lambda captures.
 
@@ -1708,19 +1679,6 @@ 

Node Matchers

-Matcher<Stmt>cxxNamedCastExprMatcher<CXXNamedCastExpr>... -
Matches any named cast expression.
-
-Example: Matches all four of the casts in
-  struct S { virtual void f(); };
-  S* p = nullptr;
-  S* ptr1 = static_cast<S*>(p);
-  S* ptr2 = reinterpret_cast<S*>(p);
-  S* ptr3 = dynamic_cast<S*>(p);
-  S* ptr4 = const_cast<S*>(p);
-
- - Matcher<Stmt>cxxNewExprMatcher<CXXNewExpr>...
Matches new expressions.
 
@@ -2210,7 +2168,7 @@ 

Node Matchers

-Matcher<Stmt>ompExecutableDirectiveMatcher<OMPExecutableDirective>... +Matcher<Stmt>ompExecutableDirectiveMatcher<OMPExecutableDirective>...
Matches any ``#pragma omp`` executable directive.
 
 Given
@@ -2435,6 +2393,17 @@ 

Node Matchers

+Matcher<TypeLoc>elaboratedTypeLocMatcher<ElaboratedTypeLoc>... +
Matches C or C++ elaborated `TypeLoc`s.
+
+Given
+  struct s {};
+  struct s ss;
+elaboratedTypeLoc()
+  matches the `TypeLoc` of the variable declaration of `ss`.
+
+ + Matcher<TypeLoc>pointerTypeLocMatcher<PointerTypeLoc>...
Matches pointer `TypeLoc`s.
 
@@ -2505,7 +2474,7 @@ 

Node Matchers

-Matcher<Type>autoTypeMatcher<AutoType>... +Matcher<Type>autoTypeMatcher<AutoType>...
Matches types nodes representing C++11 auto types.
 
 Given:
@@ -2575,7 +2544,7 @@ 

Node Matchers

-Matcher<Type>decltypeTypeMatcher<DecltypeType>... +Matcher<Type>decltypeTypeMatcher<DecltypeType>...
Matches types nodes representing C++11 decltype(<expr>) types.
 
 Given:
@@ -2587,7 +2556,7 @@ 

Node Matchers

-Matcher<Type>deducedTemplateSpecializationTypeMatcher<DeducedTemplateSpecializationType>... +Matcher<Type>deducedTemplateSpecializationTypeMatcher<DeducedTemplateSpecializationType>...
Matches C++17 deduced template specialization types, e.g. deduced class
 template types.
 
@@ -2601,7 +2570,7 @@ 

Node Matchers

-Matcher<Type>dependentNameTypeMatcher<DependentNameType>... +Matcher<Type>dependentNameTypeMatcher<DependentNameType>...
Matches a dependent name type
 
 Example matches T::type
@@ -2638,7 +2607,38 @@ 

Node Matchers

-Matcher<Type>enumTypeMatcher<EnumType>... +Matcher<Type>dependentTemplateSpecializationTypeMatcher<DependentTemplateSpecializationType>... +
Matches a dependent template specialization type
+
+Example matches A<T>::template B<T>
+  template<typename T> struct A;
+  template<typename T> struct declToImport {
+    typename A<T>::template B<T> a;
+  };
+
+ + +Matcher<Type>elaboratedTypeMatcher<ElaboratedType>... +
Matches types specified with an elaborated type keyword or with a
+qualified name.
+
+Given
+  namespace N {
+    namespace M {
+      class D {};
+    }
+  }
+  class C {};
+
+  class C c;
+  N::M::D d;
+
+elaboratedType() matches the type of the variable declarations of both
+c and d.
+
+ + +Matcher<Type>enumTypeMatcher<EnumType>...
Matches enum types.
 
 Given
@@ -2688,7 +2688,7 @@ 

Node Matchers

-Matcher<Type>injectedClassNameTypeMatcher<InjectedClassNameType>... +Matcher<Type>injectedClassNameTypeMatcher<InjectedClassNameType>...
Matches injected class name types.
 
 Example matches S s, but not S<T> s.
@@ -2800,7 +2800,7 @@ 

Node Matchers

-Matcher<Type>recordTypeMatcher<RecordType>... +Matcher<Type>recordTypeMatcher<RecordType>...
Matches record types (e.g. structs, classes).
 
 Given
@@ -2831,7 +2831,7 @@ 

Node Matchers

-Matcher<Type>substTemplateTypeParmTypeMatcher<SubstTemplateTypeParmType>... +Matcher<Type>substTemplateTypeParmTypeMatcher<SubstTemplateTypeParmType>...
Matches types that represent the result of substituting a type for a
 template type parameter.
 
@@ -2845,7 +2845,7 @@ 

Node Matchers

-Matcher<Type>tagTypeMatcher<TagType>... +Matcher<Type>tagTypeMatcher<TagType>...
Matches tag types (record and enum types).
 
 Given
@@ -2860,7 +2860,7 @@ 

Node Matchers

-Matcher<Type>templateSpecializationTypeMatcher<TemplateSpecializationType>... +Matcher<Type>templateSpecializationTypeMatcher<TemplateSpecializationType>...
Matches template specialization types.
 
 Given
@@ -2875,7 +2875,7 @@ 

Node Matchers

-Matcher<Type>templateTypeParmTypeMatcher<TemplateTypeParmType>... +Matcher<Type>templateTypeParmTypeMatcher<TemplateTypeParmType>...
Matches template type parameter types.
 
 Example matches T, but not int.
@@ -2899,7 +2899,7 @@ 

Node Matchers

-Matcher<Type>unaryTransformTypeMatcher<UnaryTransformType>... +Matcher<Type>unaryTransformTypeMatcher<UnaryTransformType>...
Matches types nodes representing unary type transformations.
 
 Given:
@@ -3077,8 +3077,8 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isPrivate -
Matches private C++ declarations and C++ base specifiers that specify
-private inheritance.
+
Matches private C++ declarations and C++ base specifers that specify private
+inheritance.
 
 Examples:
   class C {
@@ -3094,7 +3094,7 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isProtected -
Matches protected C++ declarations and C++ base specifiers that specify
+
Matches protected C++ declarations and C++ base specifers that specify
 protected inheritance.
 
 Examples:
@@ -3110,7 +3110,7 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isPublic -
Matches public C++ declarations and C++ base specifiers that specify public
+
Matches public C++ declarations and C++ base specifers that specify public
 inheritance.
 
 Examples:
@@ -3127,7 +3127,7 @@ 

Narrowing Matchers

Matcher<CXXBaseSpecifier>isVirtual -
Matches declarations of virtual methods and C++ base specifiers that specify
+
Matches declarations of virtual methods and C++ base specifers that specify
 virtual inheritance.
 
 Example:
@@ -3709,7 +3709,7 @@ 

Narrowing Matchers

Matcher<CXXMethodDecl>isVirtual -
Matches declarations of virtual methods and C++ base specifiers that specify
+
Matches declarations of virtual methods and C++ base specifers that specify
 virtual inheritance.
 
 Example:
@@ -4161,12 +4161,6 @@ 

Narrowing Matchers

-Matcher<Decl>declaresSameEntityAsBoundNodestd::string ID -
Matches a declaration if it declares the same entity as the node previously
-bound to ID.
-
- - Matcher<Decl>equalsBoundNodestd::string ID
Matches if a node equals a previously bound node.
 
@@ -4328,8 +4322,8 @@ 

Narrowing Matchers

Matcher<Decl>isPrivate -
Matches private C++ declarations and C++ base specifiers that specify
-private inheritance.
+
Matches private C++ declarations and C++ base specifers that specify private
+inheritance.
 
 Examples:
   class C {
@@ -4345,7 +4339,7 @@ 

Narrowing Matchers

Matcher<Decl>isProtected -
Matches protected C++ declarations and C++ base specifiers that specify
+
Matches protected C++ declarations and C++ base specifers that specify
 protected inheritance.
 
 Examples:
@@ -4361,7 +4355,7 @@ 

Narrowing Matchers

Matcher<Decl>isPublic -
Matches public C++ declarations and C++ base specifiers that specify public
+
Matches public C++ declarations and C++ base specifers that specify public
 inheritance.
 
 Examples:
@@ -4377,7 +4371,7 @@ 

Narrowing Matchers

-Matcher<DependentNameType>hasDependentNamestd::string N +Matcher<DependentNameType>hasDependentNamestd::string N
Matches the dependent name of a DependentScopeDeclRefExpr or
 DependentNameType
 
@@ -5052,7 +5046,7 @@ 

Narrowing Matchers

int z; Example matches f() because it has external formal linkage despite being -unique to the translation unit as though it has internal linkage +unique to the translation unit as though it has internal likage (matcher = functionDecl(hasExternalFormalLinkage())) namespace { @@ -5188,7 +5182,7 @@

Narrowing Matchers

-Matcher<OMPExecutableDirective>isAllowedToContainClauseKindOpenMPClauseKind CKind +Matcher<OMPExecutableDirective>isAllowedToContainClauseKindOpenMPClauseKind CKind
Matches if the OpenMP directive is allowed to contain the specified OpenMP
 clause kind.
 
@@ -5198,7 +5192,7 @@ 

Narrowing Matchers

#pragma omp parallel for #pragma omp for -``ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches +`ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches ``omp parallel`` and ``omp parallel for``. If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter @@ -5207,7 +5201,7 @@

Narrowing Matchers

-Matcher<OMPExecutableDirective>isStandaloneDirective +Matcher<OMPExecutableDirective>isStandaloneDirective
Matches standalone OpenMP directives,
 i.e., directives that can't have a structured block.
 
@@ -5551,10 +5545,10 @@ 

Narrowing Matchers

Given void a(int); - void b(unsigned long); + void b(long); void c(double); functionDecl(hasAnyParameter(hasType(isInteger()))) -matches "a(int)", "b(unsigned long)", but not "c(double)". +matches "a(int)", "b(long)", but not "c(double)".
@@ -5787,7 +5781,7 @@

Narrowing Matchers

Matches a TemplateArgument of integral type with a given value.
 
 Note that 'Value' is a string as the template argument's value is
-an arbitrary precision integer. 'Value' must be equal to the canonical
+an arbitrary precision integer. 'Value' must be euqal to the canonical
 representation of that integral value in base 10.
 
 Given
@@ -5812,7 +5806,7 @@ 

Narrowing Matchers

-Matcher<TemplateSpecializationType>templateArgumentCountIsunsigned N +Matcher<TemplateSpecializationType>templateArgumentCountIsunsigned N
Matches if the number of template arguments equals N.
 
 Given
@@ -6577,8 +6571,8 @@ 

AST Traversal Matchers

Matcher<AbstractConditionalOperator>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop, while loop,
-do-while loop, switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop,
+switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
@@ -6606,8 +6600,8 @@ 

AST Traversal Matchers

-Matcher<AddrLabelExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<AddrLabelExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -6632,11 +6626,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -6707,7 +6701,7 @@

AST Traversal Matchers

-Matcher<AutoType>hasDeducedTypeMatcher<Type> +Matcher<AutoType>hasDeducedTypeMatcher<Type>
Matches AutoType nodes where the deduced type is a specific type.
 
 Note: There is no TypeLoc for the deduced type and thus no
@@ -6719,7 +6713,7 @@ 

AST Traversal Matchers

autoType(hasDeducedType(isInteger())) matches "auto a" -Usable as: Matcher<AutoType> +Usable as: Matcher<AutoType>
@@ -7032,8 +7026,8 @@

AST Traversal Matchers

-Matcher<CXXConstructExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<CXXConstructExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -7058,11 +7052,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -7495,8 +7489,8 @@

AST Traversal Matchers

-Matcher<CXXNewExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<CXXNewExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -7521,11 +7515,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -7958,8 +7952,8 @@

AST Traversal Matchers

-Matcher<CallExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<CallExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -7984,11 +7978,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -8210,7 +8204,7 @@

AST Traversal Matchers

Matcher<DecayedType>hasDecayedTypeMatcher<QualType> InnerType -
Matches the decayed type, whose decayed type matches InnerMatcher
+
Matches the decayed type, whoes decayed type matches InnerMatcher
 
@@ -8229,8 +8223,8 @@

AST Traversal Matchers

-Matcher<DeclRefExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<DeclRefExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -8255,11 +8249,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -8379,11 +8373,24 @@

AST Traversal Matchers

} } -cxxRecordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the +cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the declaration of class D.
+Matcher<DecltypeType>hasUnderlyingTypeMatcher<Type> +
Matches DecltypeType or UsingType nodes to find the underlying type.
+
+Given
+  decltype(1) a = 1;
+  decltype(2.0) b = 2.0;
+decltypeType(hasUnderlyingType(isInteger()))
+  matches the type of "a"
+
+Usable as: Matcher<DecltypeType>, Matcher<UsingType>
+
+ + Matcher<DecompositionDecl>hasAnyBindingMatcher<BindingDecl> InnerMatcher
Matches any binding of a DecompositionDecl.
 
@@ -8444,16 +8451,66 @@ 

AST Traversal Matchers

Matcher<DoStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop, while loop,
-do-while loop, switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop,
+switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
-Matcher<EnumType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<ElaboratedTypeLoc>hasNamedTypeLocMatcher<TypeLoc> InnerMatcher
+
Matches elaborated `TypeLoc`s that have a named `TypeLoc` matching
+`InnerMatcher`.
+
+Given
+  template <typename T>
+  class C {};
+  class C<int> c;
+
+  class D {};
+  class D d;
+elaboratedTypeLoc(hasNamedTypeLoc(templateSpecializationTypeLoc()));
+  matches the `TypeLoc` of the variable declaration of `c`, but not `d`.
+
+ + +Matcher<ElaboratedType>hasQualifierMatcher<NestedNameSpecifier> InnerMatcher +
Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
+matches InnerMatcher if the qualifier exists.
+
+Given
+  namespace N {
+    namespace M {
+      class D {};
+    }
+  }
+  N::M::D d;
+
+elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
+matches the type of the variable declaration of d.
+
+ + +Matcher<ElaboratedType>namesTypeMatcher<QualType> InnerMatcher +
Matches ElaboratedTypes whose named type matches InnerMatcher.
+
+Given
+  namespace N {
+    namespace M {
+      class D {};
+    }
+  }
+  N::M::D d;
+
+elaboratedType(namesType(recordType(
+hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
+declaration of d.
+
+ + +Matcher<EnumType>hasDeclarationMatcher<Decl> InnerMatcher +
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -8478,11 +8535,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -8731,26 +8788,14 @@

AST Traversal Matchers

Matcher<ForStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop, while loop,
-do-while loop, switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop,
+switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
-Matcher<ForStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher -
Matches the condition variable statement in an if statement, for loop,
-while loop or switch statement.
-
-Given
-  if (A* a = GetAPointer()) {}
-  for (; A* a = GetAPointer(); ) {}
-hasConditionVariableStatement(...)
-  matches both 'A* a = GetAPointer()'.
-
- - Matcher<ForStmt>hasIncrementMatcher<Stmt> InnerMatcher
Matches the increment statement of a for loop.
 
@@ -9054,8 +9099,8 @@ 

AST Traversal Matchers

Matcher<IfStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop, while loop,
-do-while loop, switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop,
+switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
@@ -9063,14 +9108,12 @@ 

AST Traversal Matchers

Matcher<IfStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher -
Matches the condition variable statement in an if statement, for loop,
-while loop or switch statement.
+
Matches the condition variable statement in an if statement.
 
 Given
   if (A* a = GetAPointer()) {}
-  for (; A* a = GetAPointer(); ) {}
 hasConditionVariableStatement(...)
-  matches both 'A* a = GetAPointer()'.
+  matches 'A* a = GetAPointer()'.
 
@@ -9136,8 +9179,8 @@

AST Traversal Matchers

-Matcher<InjectedClassNameType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<InjectedClassNameType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9162,16 +9205,16 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
-Matcher<LabelStmt>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<LabelStmt>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9196,11 +9239,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -9250,8 +9293,8 @@

AST Traversal Matchers

-Matcher<MemberExpr>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<MemberExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9276,11 +9319,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -9413,7 +9456,7 @@

AST Traversal Matchers

-Matcher<OMPExecutableDirective>hasAnyClauseMatcher<OMPClause> InnerMatcher +Matcher<OMPExecutableDirective>hasAnyClauseMatcher<OMPClause> InnerMatcher
Matches any clause in an OpenMP directive.
 
 Given
@@ -9426,7 +9469,7 @@ 

AST Traversal Matchers

-Matcher<OMPExecutableDirective>hasStructuredBlockMatcher<Stmt> InnerMatcher +Matcher<OMPExecutableDirective>hasStructuredBlockMatcher<Stmt> InnerMatcher
Matches the structured-block of the OpenMP executable directive
 
 Prerequisite: the executable directive must not be standalone directive.
@@ -9783,8 +9826,8 @@ 

AST Traversal Matchers

-Matcher<QualType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<QualType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9809,11 +9852,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -9877,8 +9920,8 @@

AST Traversal Matchers

-Matcher<RecordType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<RecordType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -9903,11 +9946,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -10023,7 +10066,7 @@

AST Traversal Matchers

-Matcher<SubstTemplateTypeParmType>hasReplacementTypeMatcher<Type> +Matcher<SubstTemplateTypeParmType>hasReplacementTypeMatcher<Type>
Matches template type parameter substitutions that have a replacement
 type that matches the provided matcher.
 
@@ -10051,26 +10094,14 @@ 

AST Traversal Matchers

Matcher<SwitchStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop, while loop,
-do-while loop, switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop,
+switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
-Matcher<SwitchStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher -
Matches the condition variable statement in an if statement, for loop,
-while loop or switch statement.
-
-Given
-  if (A* a = GetAPointer()) {}
-  for (; A* a = GetAPointer(); ) {}
-hasConditionVariableStatement(...)
-  matches both 'A* a = GetAPointer()'.
-
- - Matcher<SwitchStmt>hasInitStatementMatcher<Stmt> InnerMatcher
Matches selection statements with initializer.
 
@@ -10094,8 +10125,8 @@ 

AST Traversal Matchers

-Matcher<TagType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TagType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10120,11 +10151,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -10253,7 +10284,7 @@

AST Traversal Matchers

-Matcher<TemplateSpecializationType>forEachTemplateArgumentMatcher<TemplateArgument> InnerMatcher +Matcher<TemplateSpecializationType>forEachTemplateArgumentMatcher<TemplateArgument> InnerMatcher
Matches templateSpecializationType, class template specialization,
 variable template specialization, and function template specialization
 nodes where the template argument matches the inner matcher. This matcher
@@ -10279,7 +10310,7 @@ 

AST Traversal Matchers

-Matcher<TemplateSpecializationType>hasAnyTemplateArgumentMatcher<TemplateArgument> InnerMatcher +Matcher<TemplateSpecializationType>hasAnyTemplateArgumentMatcher<TemplateArgument> InnerMatcher
Matches templateSpecializationTypes, class template specializations,
 variable template specializations, and function template specializations
 that have at least one TemplateArgument matching the given InnerMatcher.
@@ -10301,8 +10332,8 @@ 

AST Traversal Matchers

-Matcher<TemplateSpecializationType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TemplateSpecializationType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10327,15 +10358,15 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
-Matcher<TemplateSpecializationType>hasTemplateArgumentunsigned N, Matcher<TemplateArgument> InnerMatcher +Matcher<TemplateSpecializationType>hasTemplateArgumentunsigned N, Matcher<TemplateArgument> InnerMatcher
Matches templateSpecializationType, class template specializations,
 variable template specializations, and function template specializations
 where the n'th TemplateArgument matches the given InnerMatcher.
@@ -10356,8 +10387,8 @@ 

AST Traversal Matchers

-Matcher<TemplateTypeParmType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TemplateTypeParmType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10382,11 +10413,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -10442,8 +10473,8 @@

AST Traversal Matchers

-Matcher<TypedefType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<TypedefType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10468,41 +10499,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> -
- - -Matcher<Type>hasQualifierMatcher<NestedNameSpecifier> InnerMatcher -
Matches Types whose qualifier, a NestedNameSpecifier,
-matches InnerMatcher if the qualifier exists.
-
-Given
-  namespace N {
-    namespace M {
-      class D {};
-    }
-  }
-  N::M::D d;
-
-elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
-matches the type of the variable declaration of d.
-
- - -Matcher<Type>hasUnderlyingTypeMatcher<QualType> Inner -
Matches QualType nodes to find the underlying type.
-
-Given
-  decltype(1) a = 1;
-  decltype(2.0) b = 2.0;
-decltypeType(hasUnderlyingType(isInteger()))
-  matches the type of "a"
-
-Usable as: Matcher<QualType>
+  Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>,
+  Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>,
+  Matcher<TagType>, Matcher<TemplateSpecializationType>,
+  Matcher<TemplateTypeParmType>, Matcher<TypedefType>,
+  Matcher<UnresolvedUsingType>
 
@@ -10555,8 +10556,8 @@

AST Traversal Matchers

-Matcher<UnresolvedUsingType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
+Matcher<UnresolvedUsingType>hasDeclarationMatcher<Decl>  InnerMatcher
+
Matches a node if the declaration associated with that node
 matches the given matcher.
 
 The associated declaration is:
@@ -10581,11 +10582,11 @@ 

AST Traversal Matchers

Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>, Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>, - Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, - Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, - Matcher<TagType>, Matcher<TemplateSpecializationType>, - Matcher<TemplateTypeParmType>, Matcher<TypedefType>, - Matcher<UnresolvedUsingType>, Matcher<UsingType> + Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>, + Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>, + Matcher<TagType>, Matcher<TemplateSpecializationType>, + Matcher<TemplateTypeParmType>, Matcher<TypedefType>, + Matcher<UnresolvedUsingType>
@@ -10601,37 +10602,16 @@

AST Traversal Matchers

matches using X::b but not using X::a
-Matcher<UsingType>hasDeclarationMatcher<Decl> InnerMatcher -
Matches a node if the declaration associated with that node
-matches the given matcher.
-
-The associated declaration is:
-- for type nodes, the declaration of the underlying type
-- for CallExpr, the declaration of the callee
-- for MemberExpr, the declaration of the referenced member
-- for CXXConstructExpr, the declaration of the constructor
-- for CXXNewExpr, the declaration of the operator new
-- for ObjCIvarExpr, the declaration of the ivar
+Matcher<UsingType>hasUnderlyingTypeMatcher<Type>
+
Matches DecltypeType or UsingType nodes to find the underlying type.
 
-For type nodes, hasDeclaration will generally match the declaration of the
-sugared type. Given
-  class X {};
-  typedef X Y;
-  Y y;
-in varDecl(hasType(hasDeclaration(decl()))) the decl will match the
-typedefDecl. A common use case is to match the underlying, desugared type.
-This can be achieved by using the hasUnqualifiedDesugaredType matcher:
-  varDecl(hasType(hasUnqualifiedDesugaredType(
-      recordType(hasDeclaration(decl())))))
-In this matcher, the decl will match the CXXRecordDecl of class X.
+Given
+  decltype(1) a = 1;
+  decltype(2.0) b = 2.0;
+decltypeType(hasUnderlyingType(isInteger()))
+  matches the type of "a"
 
-Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
-  Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
-  Matcher<EnumType>, Matcher<InjectedClassNameType>, Matcher<LabelStmt>,
-  Matcher<MemberExpr>, Matcher<QualType>, Matcher<RecordType>,
-  Matcher<TagType>, Matcher<TemplateSpecializationType>,
-  Matcher<TemplateTypeParmType>, Matcher<TypedefType>,
-  Matcher<UnresolvedUsingType>, Matcher<UsingType>
+Usable as: Matcher<DecltypeType>, Matcher<UsingType>
 
@@ -10852,25 +10832,13 @@

AST Traversal Matchers

Matcher<WhileStmt>hasConditionMatcher<Expr> InnerMatcher -
Matches the condition expression of an if statement, for loop, while loop,
-do-while loop, switch statement or conditional operator.
+
Matches the condition expression of an if statement, for loop,
+switch statement or conditional operator.
 
 Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
   if (true) {}
 
- -Matcher<WhileStmt>hasConditionVariableStatementMatcher<DeclStmt> InnerMatcher -
Matches the condition variable statement in an if statement, for loop,
-while loop or switch statement.
-
-Given
-  if (A* a = GetAPointer()) {}
-  for (; A* a = GetAPointer(); ) {}
-hasConditionVariableStatement(...)
-  matches both 'A* a = GetAPointer()'.
-
- From 4116baea52beb6910754bf6e257d866cd6cb46a7 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 29 Oct 2025 00:02:31 +0300 Subject: [PATCH 07/11] fix linter name --- llvm/utils/git/code-format-helper.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index 0ae800d4000c9..f5fea40c15948 100755 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -467,7 +467,7 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str class DumpASTMatchersHelper(FormatHelper): - name = "dump_ast_matchers" + name = "dump_ast_matchers.py" friendly_name = "AST matchers documentation" output_html = "clang/docs/LibASTMatchersReference.html" From be562350bf298ff06fb19f8a1564c4a5bcb9d9f9 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 29 Oct 2025 00:57:58 +0300 Subject: [PATCH 08/11] implement easy solution --- clang/docs/tools/dump_ast_matchers.py | 5 ++++- clang/test/AST/ast_matchers_updated.test | 2 ++ 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 clang/test/AST/ast_matchers_updated.test diff --git a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py index 46b7bb718ba08..c1065603274cb 100755 --- a/clang/docs/tools/dump_ast_matchers.py +++ b/clang/docs/tools/dump_ast_matchers.py @@ -6,6 +6,7 @@ import collections import re import os +import sys try: from urllib.request import urlopen @@ -615,5 +616,7 @@ def sort_table(matcher_type, matcher_map): flags=re.S, ) -with open(HTML_FILE, "w", newline="\n") as output: +output_file = sys.argv[1] if len(sys.argv) == 2 else HTML_FILE + +with open(output_file, "w", newline="\n") as output: output.write(reference) diff --git a/clang/test/AST/ast_matchers_updated.test b/clang/test/AST/ast_matchers_updated.test new file mode 100644 index 0000000000000..15b76e88307d7 --- /dev/null +++ b/clang/test/AST/ast_matchers_updated.test @@ -0,0 +1,2 @@ +// RUN: %python %S/../../docs/tools/dump_ast_matchers.py %t +// RUN: diff %t %S/../../docs/LibASTMatchersReference.html \ No newline at end of file From f1fe83751c32a4d7504e47d9262681232fefe1da Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 29 Oct 2025 00:59:57 +0300 Subject: [PATCH 09/11] Revert "[GitHub][CI] Add running of dump_ast_matchers.py to premerge workflow" This reverts commit 5340574a9ac6335e2effc15e73f122018ffc58a2. --- llvm/utils/git/code-format-helper.py | 65 +--------------------------- 1 file changed, 1 insertion(+), 64 deletions(-) diff --git a/llvm/utils/git/code-format-helper.py b/llvm/utils/git/code-format-helper.py index f5fea40c15948..406a72817acb8 100755 --- a/llvm/utils/git/code-format-helper.py +++ b/llvm/utils/git/code-format-helper.py @@ -466,70 +466,7 @@ def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str return report -class DumpASTMatchersHelper(FormatHelper): - name = "dump_ast_matchers.py" - friendly_name = "AST matchers documentation" - - output_html = "clang/docs/LibASTMatchersReference.html" - script_dir = "clang/docs/tools" - script_name = "dump_ast_matchers.py" - - @property - def instructions(self) -> str: - return f"cd {self.script_dir} && python3 {self.script_name}" - - def should_run(self, changed_files: List[str]) -> List[str]: - for file in changed_files: - if file == "clang/include/clang/ASTMatchers/ASTMatchers.h": - return True - return False - - def has_tool(self) -> bool: - if not os.path.exists(os.path.join(self.script_dir, self.script_name)): - return False - return True - - def format_run(self, changed_files: List[str], args: FormatArgs) -> Optional[str]: - if not self.should_run(changed_files): - return None - - if args.verbose: - print(f"Running: {self.instructions}") - - # Run the 'dump_ast_matchers.py' from its directory as specified in the script doc - proc = subprocess.run( - ["python3", self.script_name], - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, - encoding="utf-8", - cwd=self.script_dir, - ) - - if proc.returncode != 0: - return f"dump_ast_matchers.py failed with code {proc.returncode}:\n{proc.stderr}\n{proc.stdout}" - - # Check if 'LibASTMatchersReference.html' file was modified - cmd = ["git", "diff", "--exit-code", self.output_html] - proc = subprocess.run( - cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding="utf-8" - ) - - # 'LibASTMatchersReference.html' was modified - count as failure - if proc.returncode != 0: - if args.verbose: - print(f"error: {self.name} exited with code {proc.returncode}") - print(proc.stdout) - return proc.stdout - else: - return None - - -ALL_FORMATTERS = ( - DarkerFormatHelper(), - ClangFormatHelper(), - UndefGetFormatHelper(), - DumpASTMatchersHelper(), -) +ALL_FORMATTERS = (DarkerFormatHelper(), ClangFormatHelper(), UndefGetFormatHelper()) def hook_main(): From eae9c302258a87767d1ecf1ef607e2fab01b3ac4 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Wed, 29 Oct 2025 01:01:00 +0300 Subject: [PATCH 10/11] add newline --- clang/test/AST/ast_matchers_updated.test | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/clang/test/AST/ast_matchers_updated.test b/clang/test/AST/ast_matchers_updated.test index 15b76e88307d7..1362ee167c56e 100644 --- a/clang/test/AST/ast_matchers_updated.test +++ b/clang/test/AST/ast_matchers_updated.test @@ -1,2 +1,2 @@ // RUN: %python %S/../../docs/tools/dump_ast_matchers.py %t -// RUN: diff %t %S/../../docs/LibASTMatchersReference.html \ No newline at end of file +// RUN: diff %t %S/../../docs/LibASTMatchersReference.html From 1b055dd2bff54aa1618070809cd9375d7d831334 Mon Sep 17 00:00:00 2001 From: Victor Baranov Date: Fri, 31 Oct 2025 00:50:21 +0300 Subject: [PATCH 11/11] make windows as unsupported --- clang/test/AST/ast_matchers_updated.test | 2 ++ 1 file changed, 2 insertions(+) diff --git a/clang/test/AST/ast_matchers_updated.test b/clang/test/AST/ast_matchers_updated.test index 1362ee167c56e..0eba16a1a5c00 100644 --- a/clang/test/AST/ast_matchers_updated.test +++ b/clang/test/AST/ast_matchers_updated.test @@ -1,2 +1,4 @@ +// FIXME enable windows +// UNSUPPORTED: system-windows // RUN: %python %S/../../docs/tools/dump_ast_matchers.py %t // RUN: diff %t %S/../../docs/LibASTMatchersReference.html