diff --git a/third_party/llvm/workspace.bzl b/third_party/llvm/workspace.bzl index 4731757d05f..c624c15b081 100644 --- a/third_party/llvm/workspace.bzl +++ b/third_party/llvm/workspace.bzl @@ -4,8 +4,8 @@ load("//third_party:repo.bzl", "tf_http_archive") def repo(name): """Imports LLVM.""" - LLVM_COMMIT = "6e1acdcdc1b33c8d3cccf09b8d38279eef2ba69e" - LLVM_SHA256 = "6e6514c637a012fa88e9a584772916b6e82799b0ad5a70a0783ecc5db7aca409" + LLVM_COMMIT = "b03a747fc0fc27ddcad3b50f2117d8150ee262f1" + LLVM_SHA256 = "04e54670f439d664d09b91f5fecddee6c9a7198be2305584b6db5e3086835053" tf_http_archive( name = name, diff --git a/third_party/shardy/temporary.patch b/third_party/shardy/temporary.patch index 08949280c9c..9b8fac30243 100644 --- a/third_party/shardy/temporary.patch +++ b/third_party/shardy/temporary.patch @@ -1,26000 +1,15 @@ -diff --git a/third_party/llvm/generated.patch b/third_party/llvm/generated.patch -index 2e8413f..509398d 100644 ---- a/third_party/llvm/generated.patch -+++ b/third_party/llvm/generated.patch -@@ -1,25980 +1 @@ - Auto generated patch. Do not edit or delete it, even if empty. --diff -ruN --strip-trailing-cr a/clang/docs/doxygen.cfg.in b/clang/docs/doxygen.cfg.in ----- a/clang/docs/doxygen.cfg.in --+++ b/clang/docs/doxygen.cfg.in --@@ -220,14 +220,7 @@ -- # "Side Effects:". You can put \n's in the value part of an alias to insert -- # newlines. -- ---ALIASES += compile_args{1}="Compiled with \1.\n" ---ALIASES += matcher{1}="\1" ---ALIASES += matcher{2$}="\2" ---ALIASES += match{1}="\1" ---ALIASES += match{2$}="\2" ---ALIASES += nomatch{1}="\1" ---ALIASES += header{1}="\code" ---ALIASES += endheader="\endcode" --+ALIASES = -- -- # This tag can be used to specify a number of word-keyword mappings (TCL only). -- # A mapping has the form "name=value". For example adding "class=itcl::class" --diff -ruN --strip-trailing-cr a/clang/docs/LibASTMatchersReference.html b/clang/docs/LibASTMatchersReference.html ----- a/clang/docs/LibASTMatchersReference.html --+++ b/clang/docs/LibASTMatchersReference.html --@@ -586,36 +586,28 @@ -- -- #pragma omp declare simd -- int min(); --- ---The matcher attr() ---matches nodiscard, nonnull, noinline, and ---declare simd. --+attr() --+ matches "nodiscard", "nonnull", "noinline", and the whole "#pragma" line. -- -- -- -- Matcher<CXXBaseSpecifier>cxxBaseSpecifierMatcher<CXXBaseSpecifier>... --
Matches class bases.
-- 
---Given
--+Examples matches public virtual B.
--   class B {};
--   class C : public virtual B {};
---
---The matcher cxxRecordDecl(hasDirectBase(cxxBaseSpecifier()))
---matches C.
-- 
-- -- -- Matcher<CXXCtorInitializer>cxxCtorInitializerMatcher<CXXCtorInitializer>... --
Matches constructor initializers.
-- 
---Given
--+Examples matches i(42).
--   class C {
--     C() : i(42) {}
--     int i;
--   };
---
---The matcher cxxCtorInitializer()
---matches i(42).
-- 
-- -- --@@ -627,22 +619,17 @@ -- public: -- int a; -- }; --- ---The matcher accessSpecDecl() ---matches public:. --+accessSpecDecl() --+ matches 'public:' -- -- -- -- Matcher<Decl>bindingDeclMatcher<BindingDecl>... --
Matches binding declarations
--+Example matches foo and bar
--+(matcher = bindingDecl()
-- 
---Given
---  struct pair { int x; int y; };
---  pair make(int, int);
---  auto [foo, bar] = make(42, 42);
---
---The matcher bindingDecl()
---matches foo and bar.
--+  auto [foo, bar] = std::make_pair{42, 42};
-- 
-- -- --@@ -655,18 +642,14 @@ -- myFunc(^(int p) { -- printf("%d", p); -- }) --- -- -- -- -- Matcher<Decl>classTemplateDeclMatcher<ClassTemplateDecl>... --
Matches C++ class template declarations.
-- 
---Given
--+Example matches Z
--   template<class T> class Z {};
---
---The matcher classTemplateDecl()
---matches Z.
-- 
-- -- --@@ -677,14 +660,13 @@ -- template<class T1, class T2, int I> -- class A {}; -- --- template<class T, int I> class A<T, T*, I> {}; --+ template<class T, int I> --+ class A<T, T*, I> {}; -- -- template<> -- class A<int, int, 1> {}; --- ---The matcher classTemplatePartialSpecializationDecl() ---matches template<class T, int I> class A<T, T*, I> {}, ---but does not match A<int, int, 1>. --+classTemplatePartialSpecializationDecl() --+ matches the specialization A<T,T*,I> but not A<int,int,1> -- -- -- --@@ -695,128 +677,87 @@ -- template<typename T> class A {}; -- template<> class A<double> {}; -- A<int> a; --- ---The matcher classTemplateSpecializationDecl() ---matches class A<int> ---and class A<double>. --+classTemplateSpecializationDecl() --+ matches the specializations A<int> and A<double> -- -- -- -- Matcher<Decl>conceptDeclMatcher<ConceptDecl>... --
Matches concept declarations.
-- 
---Given
---  template<typename T> concept my_concept = true;
---
---
---The matcher conceptDecl()
---matches template<typename T>
---concept my_concept = true.
--+Example matches integral
--+  template<typename T>
--+  concept integral = std::is_integral_v<T>;
-- 
-- -- -- Matcher<Decl>cxxConstructorDeclMatcher<CXXConstructorDecl>... --
Matches C++ constructor declarations.
-- 
---Given
--+Example matches Foo::Foo() and Foo::Foo(int)
--   class Foo {
--    public:
--     Foo();
--     Foo(int);
--     int DoSomething();
--   };
---
---  struct Bar {};
---
---
---The matcher cxxConstructorDecl()
---matches Foo() and Foo(int).
-- 
-- -- -- Matcher<Decl>cxxConversionDeclMatcher<CXXConversionDecl>... --
Matches conversion operator declarations.
-- 
---Given
--+Example matches the operator.
--   class X { operator int() const; };
---
---
---The matcher cxxConversionDecl()
---matches operator int() const.
-- 
-- -- -- Matcher<Decl>cxxDeductionGuideDeclMatcher<CXXDeductionGuideDecl>... --
Matches user-defined and implicitly generated deduction guide.
-- 
---Given
--+Example matches the deduction guide.
--   template<typename T>
---  class X { X(int); };
--+  class X { X(int) };
--   X(int) -> X<int>;
---
---
---The matcher cxxDeductionGuideDecl()
---matches the written deduction guide
---auto (int) -> X<int>,
---the implicit copy deduction guide auto (int) -> X<T>
---and the implicitly declared deduction guide
---auto (X<T>) -> X<T>.
-- 
-- -- -- Matcher<Decl>cxxDestructorDeclMatcher<CXXDestructorDecl>... --
Matches explicit C++ destructor declarations.
-- 
---Given
--+Example matches Foo::~Foo()
--   class Foo {
--    public:
--     virtual ~Foo();
--   };
---
---  struct Bar {};
---
---
---The matcher cxxDestructorDecl()
---matches virtual ~Foo().
-- 
-- -- -- Matcher<Decl>cxxMethodDeclMatcher<CXXMethodDecl>... --
Matches method declarations.
-- 
---Given
--+Example matches y
--   class X { void y(); };
---
---
---The matcher cxxMethodDecl()
---matches void y().
-- 
-- -- -- Matcher<Decl>cxxRecordDeclMatcher<CXXRecordDecl>... --
Matches C++ class declarations.
-- 
---Given
--+Example matches X, Z
--   class X;
--   template<class T> class Z {};
---
---The matcher cxxRecordDecl()
---matches X and Z.
-- 
-- -- -- Matcher<Decl>declMatcher<Decl>... --
Matches declarations.
-- 
---Given
--+Examples matches X, C, and the friend declaration inside C;
--   void X();
--   class C {
---    friend void X();
--+    friend X;
--   };
---
---The matcher decl()
---matches void X(), C
---and friend void X().
-- 
-- -- --@@ -826,49 +767,40 @@ -- -- Given -- class X { int y; }; --- ---The matcher declaratorDecl() ---matches int y. --+declaratorDecl() --+ matches int y. -- -- -- -- Matcher<Decl>decompositionDeclMatcher<DecompositionDecl>... --
Matches decomposition-declarations.
-- 
---Given
---  struct pair { int x; int y; };
---  pair make(int, int);
---  int number = 42;
---  auto [foo, bar] = make(42, 42);
--+Examples matches the declaration node with foo and bar, but not
--+number.
--+(matcher = declStmt(has(decompositionDecl())))
-- 
---The matcher decompositionDecl()
---matches auto [foo, bar] = make(42, 42),
---but does not match number.
--+  int number = 42;
--+  auto [foo, bar] = std::make_pair{42, 42};
-- 
-- -- -- Matcher<Decl>enumConstantDeclMatcher<EnumConstantDecl>... --
Matches enum constants.
-- 
---Given
--+Example matches A, B, C
--   enum X {
--     A, B, C
--   };
---The matcher enumConstantDecl()
---matches A, B and C.
-- 
-- -- -- Matcher<Decl>enumDeclMatcher<EnumDecl>... --
Matches enum declarations.
-- 
---Given
--+Example matches X
--   enum X {
--     A, B, C
--   };
---
---The matcher enumDecl()
---matches the enum X.
-- 
-- -- --@@ -876,14 +808,9 @@ --
Matches field declarations.
-- 
-- Given
---  int a;
---  struct Foo {
---    int x;
---  };
---  void bar(int val);
---
---The matcher fieldDecl()
---matches int x.
--+  class X { int m; };
--+fieldDecl()
--+  matches 'm'.
-- 
-- -- --@@ -892,20 +819,16 @@ -- -- Given -- class X { friend void foo(); }; --- ---The matcher friendDecl() ---matches friend void foo(). --+friendDecl() --+ matches 'friend void foo()'. -- -- -- -- Matcher<Decl>functionDeclMatcher<FunctionDecl>... --
Matches function declarations.
-- 
---Given
--+Example matches f
--   void f();
---
---The matcher functionDecl()
---matches void f().
-- 
-- -- --@@ -914,10 +837,6 @@ -- -- Example matches f -- template<class T> void f(T t) {} --- --- ---The matcher functionTemplateDecl() ---matches template<class T> void f(T t) {}. -- -- -- --@@ -926,8 +845,8 @@ -- -- Given -- struct X { struct { int a; }; }; ---The matcher indirectFieldDecl() ---matches a. --+indirectFieldDecl() --+ matches 'a'. -- -- -- --@@ -935,13 +854,10 @@ --
Matches a declaration of label.
-- 
-- Given
---  void bar();
---  void foo() {
---    goto FOO;
---    FOO: bar();
---  }
---The matcher labelDecl()
---matches FOO: bar().
--+  goto FOO;
--+  FOO: bar();
--+labelDecl()
--+  matches 'FOO:'
-- 
-- -- --@@ -950,9 +866,8 @@ -- -- Given -- extern "C" {} --- ---The matcher linkageSpecDecl() ---matches extern "C" {}. --+linkageSpecDecl() --+ matches "extern "C" {}" -- -- -- --@@ -960,18 +875,12 @@ --
Matches a declaration of anything that could have a name.
-- 
-- Example matches X, S, the anonymous union type, i, and U;
---Given
--   typedef int X;
--   struct S {
--     union {
--       int i;
--     } U;
--   };
---The matcher namedDecl()
---matches typedef int X, S, int i
--- and U,
---with S matching twice in C++.
---Once for the injected class name and once for the declaration itself.
-- 
-- -- --@@ -981,10 +890,8 @@ -- Given -- namespace test {} -- namespace alias = ::test; --- ---The matcher namespaceAliasDecl() ---matches alias, ---but does not match test. --+namespaceAliasDecl() --+ matches "namespace alias" but not "namespace test" -- -- -- --@@ -994,9 +901,8 @@ -- Given -- namespace {} -- namespace test {} --- ---The matcher namespaceDecl() ---matches namespace {} and namespace test {}. --+namespaceDecl() --+ matches "namespace {}" and "namespace test {}" -- -- -- --@@ -1005,10 +911,8 @@ -- -- Given -- template <typename T, int N> struct C {}; --- ---The matcher nonTypeTemplateParmDecl() ---matches int N, ---but does not match typename T. --+nonTypeTemplateParmDecl() --+ matches 'N', but not 'T'. -- -- -- --@@ -1018,7 +922,6 @@ -- Example matches Foo (Additions) -- @interface Foo (Additions) -- @end --- -- -- -- --@@ -1028,7 +931,6 @@ -- Example matches Foo (Additions) -- @implementation Foo (Additions) -- @end --- -- -- -- --@@ -1038,7 +940,6 @@ -- Example matches Foo -- @implementation Foo -- @end --- -- -- -- --@@ -1048,7 +949,6 @@ -- Example matches Foo -- @interface Foo -- @end --- -- -- -- --@@ -1060,7 +960,6 @@ -- BOOL _enabled; -- } -- @end --- -- -- -- --@@ -1075,7 +974,6 @@ -- @implementation Foo -- - (void)method {} -- @end --- -- -- -- --@@ -1086,7 +984,6 @@ -- @interface Foo -- @property BOOL enabled; -- @end --- -- -- -- --@@ -1096,7 +993,6 @@ -- Example matches FooDelegate -- @protocol FooDelegate -- @end --- -- -- -- --@@ -1105,58 +1001,48 @@ -- -- Given -- void f(int x); ---The matcher parmVarDecl() ---matches int x. --+parmVarDecl() --+ matches int x. -- -- -- -- Matcher<Decl>recordDeclMatcher<RecordDecl>... --
Matches class, struct, and union declarations.
-- 
---Given
--+Example matches X, Z, U, and S
--   class X;
--   template<class T> class Z {};
--   struct S {};
--   union U {};
---
---The matcher recordDecl()
---matches X, Z,
---S and U.
-- 
-- -- -- Matcher<Decl>staticAssertDeclMatcher<StaticAssertDecl>... --
Matches a C++ static_assert declaration.
-- 
---Given
--+Example:
--+  staticAssertDecl()
--+matches
--+  static_assert(sizeof(S) == sizeof(int))
--+in
--   struct S {
--     int x;
--   };
--   static_assert(sizeof(S) == sizeof(int));
---
---
---The matcher staticAssertDecl()
---matches static_assert(sizeof(S) == sizeof(int)).
-- 
-- -- -- Matcher<Decl>tagDeclMatcher<TagDecl>... --
Matches tag declarations.
-- 
---Given
--+Example matches X, Z, U, S, E
--   class X;
--   template<class T> class Z {};
--   struct S {};
--   union U {};
---  enum E { A, B, C };
---
---
---The matcher tagDecl()
---matches class X, class Z {}, the injected class name
---class Z, struct S {},
---the injected class name struct S, union U {},
---the injected class name union U
---and enum E { A, B, C }.
--+  enum E {
--+    A, B, C
--+  };
-- 
-- -- --@@ -1165,10 +1051,8 @@ -- -- Given -- template <template <typename> class Z, int N> struct C {}; --- ---The matcher templateTemplateParmDecl() ---matches template <typename> class Z, ---but does not match int N. --+templateTypeParmDecl() --+ matches 'Z', but not 'N'. -- -- -- --@@ -1177,10 +1061,8 @@ -- -- Given -- template <typename T, int N> struct C {}; --- ---The matcher templateTypeParmDecl() ---matches typename T, ---but does not int N. --+templateTypeParmDecl() --+ matches 'T', but not 'N'. -- -- -- --@@ -1190,12 +1072,10 @@ -- Given -- int X; -- namespace NS { --- int Y; --+ int Y; -- } // namespace NS --- ---The matcher namedDecl(hasDeclContext(translationUnitDecl())) ---matches X and NS, ---but does not match Y. --+decl(hasDeclContext(translationUnitDecl())) --+ matches "int X", but not "int Y". -- -- -- --@@ -1205,22 +1085,17 @@ -- Given -- typedef int X; -- using Y = int; --- ---The matcher typeAliasDecl() ---matches using Y = int, ---but does not match typedef int X. --+typeAliasDecl() --+ matches "using Y = int", but not "typedef int X" -- -- -- -- Matcher<Decl>typeAliasTemplateDeclMatcher<TypeAliasTemplateDecl>... --
Matches type alias template declarations.
-- 
---Given
---  template <typename T> struct X {};
---  template <typename T> using Y = X<T>;
---
---The matcher typeAliasTemplateDecl()
---matches template <typename T> using Y = X<T>.
--+typeAliasTemplateDecl() matches
--+  template <typename T>
--+  using Y = X<T>;
-- 
-- -- --@@ -1230,10 +1105,8 @@ -- Given -- typedef int X; -- using Y = int; --- ---The matcher typedefDecl() ---matches typedef int X, ---but does not match using Y = int. --+typedefDecl() --+ matches "typedef int X", but not "using Y = int" -- -- -- --@@ -1243,9 +1116,8 @@ -- Given -- typedef int X; -- using Y = int; --- ---The matcher typedefNameDecl() ---matches typedef int X and using Y = int. --+typedefNameDecl() --+ matches "typedef int X" and "using Y = int" -- -- -- --@@ -1261,10 +1133,8 @@ -- struct S : private Base<T> { -- using typename Base<T>::Foo; -- }; --- ---The matcher unresolvedUsingTypenameDecl() --- matches using typename Base<T>::Foo --- --+unresolvedUsingTypenameDecl() --+ matches using Base<T>::Foo -- -- -- Matcher<Decl>unresolvedUsingValueDeclMatcher<UnresolvedUsingValueDecl>... --@@ -1275,10 +1145,8 @@ -- class C : private X { -- using X::x; -- }; --- ---The matcher unresolvedUsingValueDecl() --- matches using X::x --- --+unresolvedUsingValueDecl() --+ matches using X::x -- -- -- Matcher<Decl>usingDeclMatcher<UsingDecl>... --@@ -1287,10 +1155,8 @@ -- Given -- namespace X { int x; } -- using X::x; --- ---The matcher usingDecl() --- matches using X::x --- --+usingDecl() --+ matches using X::x -- -- -- Matcher<Decl>usingDirectiveDeclMatcher<UsingDirectiveDecl>... --@@ -1299,34 +1165,26 @@ -- Given -- namespace X { int x; } -- using namespace X; --- ---The matcher usingDirectiveDecl() --- matches using namespace X --- --+usingDirectiveDecl() --+ matches using namespace X -- -- -- Matcher<Decl>usingEnumDeclMatcher<UsingEnumDecl>... --
Matches using-enum declarations.
-- 
-- Given
---  namespace X { enum x { val1, val2 }; }
--+  namespace X { enum x {...}; }
--   using enum X::x;
---
---The matcher usingEnumDecl()
---  matches using enum X::x
---
--+usingEnumDecl() --+ matches using enum X::x -- -- -- Matcher<Decl>valueDeclMatcher<ValueDecl>... --
Matches any value declaration.
-- 
---Given
--+Example matches A, B, C and F
--   enum X { A, B, C };
--   void F();
---  int V = 0;
---The matcher valueDecl()
---matches A, B, C, void F()
---and int V = 0.
-- 
-- -- --@@ -1338,13 +1196,6 @@ -- -- Example matches a -- int a; --- struct Foo { --- int x; --- }; --- void bar(int val); --- ---The matcher varDecl() ---matches int a and int val, but not int x. -- -- -- --@@ -1357,29 +1208,13 @@ -- auto f = [x](){}; -- auto g = [x = 1](){}; -- } --- ---The matcher ---lambdaExpr(hasAnyCapture(lambdaCapture().bind("capture"))), ---matches [x](){} and [x = 1](){}, ---with lambdaCapture() matching ---x and x = 1. --+In the matcher `lambdaExpr(hasAnyCapture(lambdaCapture()))`, --+`lambdaCapture()` matches `x` and `x=1`. -- -- -- -- Matcher<NestedNameSpecifierLoc>nestedNameSpecifierLocMatcher<NestedNameSpecifierLoc>... --
Same as nestedNameSpecifier but matches NestedNameSpecifierLoc.
---
---Given
---  namespace ns {
---    struct A { static void f(); };
---    void A::f() {}
---    void g() { A::f(); }
---  }
---  ns::A a;
---
---
---The matcher nestedNameSpecifierLoc() matches
---A:: twice, and ns:: once.
-- 
-- -- --@@ -1393,9 +1228,8 @@ -- void g() { A::f(); } -- } -- ns::A a; --- ---The matcher nestedNameSpecifier() ---matches ns and both A --+nestedNameSpecifier() --+ matches "ns::" and both "A::" -- -- -- --@@ -1403,38 +1237,20 @@ --
Matches OpenMP ``default`` clause.
-- 
-- Given
---  void foo() {
---    #pragma omp parallel default(none)
---      ;
---    #pragma omp parallel default(shared)
---      ;
---    #pragma omp parallel default(private)
---      ;
---    #pragma omp parallel default(firstprivate)
---      ;
---    #pragma omp parallel
---      ;
---  }
-- 
--+  #pragma omp parallel default(none)
--+  #pragma omp parallel default(shared)
--+  #pragma omp parallel default(private)
--+  #pragma omp parallel default(firstprivate)
--+  #pragma omp parallel
-- 
---The matcher
---ompExecutableDirective(hasAnyClause(ompDefaultClause())) matches
---#pragma omp parallel default(none),
---#pragma omp parallel default(shared),
---#pragma omp parallel default(private) and
---#pragma omp parallel default(firstprivate).
--+``ompDefaultClause()`` matches ``default(none)``, ``default(shared)``,
--+`` default(private)`` and ``default(firstprivate)``
-- 
-- -- -- Matcher<QualType>qualTypeMatcher<QualType>... --
Matches QualTypes in the clang AST.
---
---Given
---  int a = 0;
---  const int b = 1;
---
---The matcher varDecl(hasType(qualType(isConstQualified())))
---matches const int b = 1, but not int a = 0.
-- 
-- -- --@@ -1442,39 +1258,34 @@ --
Matches address of label statements (GNU extension).
-- 
-- Given
---void bar();
---void foo() {
--   FOO: bar();
--   void *ptr = &&FOO;
---  goto *ptr;
---}
---The matcher addrLabelExpr()
---matches &&FOO
--+  goto *bar;
--+addrLabelExpr()
--+  matches '&&FOO'
-- 
-- -- -- Matcher<Stmt>arrayInitIndexExprMatcher<ArrayInitIndexExpr>... --
The arrayInitIndexExpr consists of two subexpressions: a common expression
---(the source array) that is evaluated once up-front, and a per-element
---initializer that runs once for each array element. Within the per-element
---initializer, the current index may be obtained via an ArrayInitIndexExpr.
--+(the source array) that is evaluated once up-front, and a per-element initializer
--+that runs once for each array element. Within the per-element initializer,
--+the current index may be obtained via an ArrayInitIndexExpr.
-- 
-- Given
---  void testStructuredBinding() {
--+  void testStructBinding() {
--     int a[2] = {1, 2};
--     auto [x, y] = a;
--   }
---
---
---The matcher arrayInitIndexExpr() matches the array index
---that implicitly iterates over the array `a` to copy each element to the
---anonymous array that backs the structured binding.
--+arrayInitIndexExpr() matches the array index that implicitly iterates
--+over the array `a` to copy each element to the anonymous array
--+that backs the structured binding `[x, y]` elements of which are
--+referred to by their aliases `x` and `y`.
-- 
-- -- -- Matcher<Stmt>arrayInitLoopExprMatcher<ArrayInitLoopExpr>... ---
Matches a loop initializing the elements of an array in a number of
---contexts:
--+
Matches a loop initializing the elements of an array in a number of contexts:
--  * in the implicit copy/move constructor for a class with an array member
--  * when a lambda-expression captures an array by value
--  * when a decomposition declaration decomposes an array
--@@ -1482,12 +1293,13 @@
-- Given
--   void testLambdaCapture() {
--     int a[10];
---    [a]() {};
--+    auto Lam1 = [a]() {
--+      return;
--+    };
--   }
---
---The matcher arrayInitLoopExpr() matches the implicit loop that
---initializes each element of the implicit array field inside the lambda
---object, that represents the array a captured by value.
--+arrayInitLoopExpr() matches the implicit loop that initializes each element of
--+the implicit array field inside the lambda object, that represents the array `a`
--+captured by value.
-- 
-- -- --@@ -1495,34 +1307,26 @@ --
Matches array subscript expressions.
-- 
-- Given
---  void foo() {
---    int a[2] = {0, 1};
---    int i = a[1];
---  }
---The matcher arraySubscriptExpr()
---matches a[1].
--+  int i = a[1];
--+arraySubscriptExpr()
--+  matches "a[1]"
-- 
-- -- -- Matcher<Stmt>asmStmtMatcher<AsmStmt>... --
Matches asm statements.
-- 
---void foo() {
--  int i = 100;
---  __asm("mov %al, 2");
---}
---The matcher asmStmt()
---matches __asm("mov %al, 2")
--+  __asm("mov al, 2");
--+asmStmt()
--+  matches '__asm("mov al, 2")'
-- 
-- -- -- Matcher<Stmt>atomicExprMatcher<AtomicExpr>... --
Matches atomic builtins.
---
---Given
--+Example matches __atomic_load_n(ptr, 1)
--   void foo() { int *ptr; __atomic_load_n(ptr, 1); }
---
---The matcher atomicExpr() matches __atomic_load_n(ptr, 1).
-- 
-- -- --@@ -1533,35 +1337,24 @@ -- @autoreleasepool { -- int x = 0; -- } --- ---The matcher autoreleasePoolStmt(stmt()) matches the declaration of ---int x = 0 inside the autorelease pool. --+autoreleasePoolStmt(stmt()) matches the declaration of "x" --+inside the autorelease pool. --
-- -- -- Matcher<Stmt>binaryConditionalOperatorMatcher<BinaryConditionalOperator>... --
Matches binary conditional operator expressions (GNU extension).
-- 
---Given
---  int f(int a, int b) {
---    return (a ?: b) + 42;
---  }
---
---The matcher binaryConditionalOperator() matches a ?: b.
--+Example matches a ?: b
--+  (a ?: b) + 42;
-- 
-- -- -- Matcher<Stmt>binaryOperatorMatcher<BinaryOperator>... --
Matches binary operator expressions.
-- 
---Given
---  void foo(bool a, bool b) {
---    !(a || b);
---  }
---
---
---The matcher binaryOperator() matches a || b.
---
--+Example matches a || b
--+  !(a || b)
-- See also the binaryOperation() matcher for more-general matching.
-- 
-- --@@ -1569,11 +1362,8 @@ -- Matcher<Stmt>blockExprMatcher<BlockExpr>... --
Matches a reference to a block.
-- 
---Given
--+Example: matches "^{}":
--   void f() { ^{}(); }
---
---
---The matcher blockExpr() matches ^{}.
-- 
-- -- --@@ -1581,23 +1371,17 @@ --
Matches break statements.
-- 
-- Given
---void foo() {
--   while (true) { break; }
---}
---
---The matcher breakStmt()
---matches break
--+breakStmt()
--+  matches 'break'
-- 
-- -- -- Matcher<Stmt>cStyleCastExprMatcher<CStyleCastExpr>... --
Matches a C-style cast expression.
-- 
---Given
--+Example: Matches (int) 2.2f in
--   int i = (int) 2.2f;
---
---The matcher cStyleCastExpr()
---matches (int) 2.2f.
-- 
-- -- --@@ -1605,16 +1389,9 @@ --
Matches call expressions.
-- 
-- Example matches x.y() and y()
---  struct X { void foo(); };
---  void bar();
---  void foobar() {
---    X x;
---    x.foo();
---    bar();
---  }
---
---The matcher callExpr()
---matches x.foo() and bar();
--+  X x;
--+  x.y();
--+  y();
-- 
-- -- --@@ -1622,41 +1399,22 @@ --
Matches case statements inside switch statements.
-- 
-- Given
---void foo(int a) {
--   switch(a) { case 42: break; default: break; }
---}
---The matcher caseStmt()
---matches case 42: break.
--+caseStmt()
--+  matches 'case 42:'.
-- 
-- -- -- Matcher<Stmt>castExprMatcher<CastExpr>... --
Matches any cast nodes of Clang's AST.
-- 
---Given
---  struct S {};
---  const S* s;
---  S* s2 = const_cast<S*>(s);
---
---  const int val = 0;
---  char val0 = 1;
---  char val1 = (char)2;
---  char val2 = static_cast<char>(3);
---  int* val3 = reinterpret_cast<int*>(4);
---  char val4 = char(5);
---
---
---The matcher castExpr()
---matches
---const_cast<S*>(s) and the implicit l- to r-value cast for s,
---the implicit cast to char for the initializer 1,
---the c-style cast (char)2 and it's implicit cast to char
---(part of the c-style cast) 2,
---static_cast<char>(3) and it's implicit cast to char
---(part of the static_cast) 3,
---reinterpret_cast<int*>(4),
---char(5) and it's implicit cast to char
---(part of the functional cast) 5.
--+Example: castExpr() matches each of the following:
--+  (int) 3;
--+  const_cast<Expr *>(SubExpr);
--+  char c = 0;
--+but does not match
--+  int i = (0);
--+  int k = 0;
-- 
-- -- --@@ -1666,24 +1424,14 @@ -- Not matching Hex-encoded chars (e.g. 0x1234, which is a IntegerLiteral), -- though. -- ---Given --+Example matches 'a', L'a' -- char ch = 'a'; -- wchar_t chw = L'a'; --- --- ---The matcher characterLiteral() matches 'a' and ---L'a'. -- -- -- -- Matcher<Stmt>chooseExprMatcher<ChooseExpr>... --
Matches GNU __builtin_choose_expr.
---
---Given
---  void f() { (void)__builtin_choose_expr(1, 2, 3); }
---
---The matcher chooseExpr() matches
---__builtin_choose_expr(1, 2, 3).
-- 
-- -- --@@ -1691,45 +1439,9 @@ --
Matches co_await expressions.
-- 
-- Given
---  namespace std {
---  template <typename T = void>
---  struct coroutine_handle {
---      static constexpr coroutine_handle from_address(void* addr) {
---        return {};
---      }
---  };
---
---  struct always_suspend {
---      bool await_ready() const noexcept;
---      bool await_resume() const noexcept;
---      template <typename T>
---      bool await_suspend(coroutine_handle<T>) const noexcept;
---  };
---
---  template <typename T>
---  struct coroutine_traits {
---      using promise_type = T::promise_type;
---  };
---  }  // namespace std
---
---  struct generator {
---      struct promise_type {
---          std::always_suspend yield_value(int&&);
---          std::always_suspend initial_suspend() const noexcept;
---          std::always_suspend final_suspend() const noexcept;
---          void return_void();
---          void unhandled_exception();
---          generator get_return_object();
---      };
---  };
---
---  std::always_suspend h();
---
---  generator g() { co_await h(); }
---
---The matcher
---coawaitExpr(has(callExpr(callee(functionDecl(hasName("h"))))))
---matches co_await h().
--+  co_await 1;
--+coawaitExpr()
--+  matches 'co_await 1'
-- 
-- -- --@@ -1737,48 +1449,35 @@ --
Matches compound (i.e. non-scalar) literals
-- 
-- Example match: {1}, (1, 2)
---  struct vector { int x; int y; };
---  struct vector myvec = (struct vector){ 1, 2 };
---
---The matcher compoundLiteralExpr()
---matches (struct vector){ 1, 2 }.
--+  int array[4] = {1};
--+  vector int myvec = (vector int)(1, 2);
-- 
-- -- -- Matcher<Stmt>compoundStmtMatcher<CompoundStmt>... --
Matches compound statements.
-- 
---Given
---void foo() { for (;;) {{}} }
---
---The matcher compoundStmt() matches
---{ for (;;) {{}} }, {{}} and {}.
--+Example matches '{}' and '{{}}' in 'for (;;) {{}}'
--+  for (;;) {{}}
-- 
-- -- -- Matcher<Stmt>conditionalOperatorMatcher<ConditionalOperator>... --
Matches conditional operator expressions.
-- 
---Given
---  int f(int a, int b, int c) {
---    return (a ? b : c) + 42;
---  }
---
---The matcher conditionalOperator() matches a ? b : c.
--+Example matches a ? b : c
--+  (a ? b : c) + 42
-- 
-- -- -- Matcher<Stmt>constantExprMatcher<ConstantExpr>... --
Matches a constant expression wrapper.
-- 
---Given
---  void f(int a) {
---    switch (a) {
---      case 37: break;
---    }
--+Example matches the constant in the case statement:
--+    (matcher = constantExpr())
--+  switch (a) {
--+  case 37: break;
--   }
---
---The matcher constantExpr() matches 37.
-- 
-- -- --@@ -1786,26 +1485,14 @@ --
Matches continue statements.
-- 
-- Given
---void foo() {
--   while (true) { continue; }
---}
---
---The matcher continueStmt()
---matches continue
--+continueStmt()
--+  matches 'continue'
-- 
-- -- -- Matcher<Stmt>convertVectorExprMatcher<ConvertVectorExpr>... --
Matches builtin function __builtin_convertvector.
---
---Given
---  typedef double vector4double __attribute__((__vector_size__(32)));
---  typedef float  vector4float  __attribute__((__vector_size__(16)));
---  vector4float vf;
---  void f() { (void)__builtin_convertvector(vf, vector4double); }
---
---The matcher convertVectorExpr() matches
---__builtin_convertvector(vf, vector4double).
-- 
-- -- --@@ -1813,85 +1500,19 @@ --
Matches co_return statements.
-- 
-- Given
---  namespace std {
---  template <typename T = void>
---  struct coroutine_handle {
---      static constexpr coroutine_handle from_address(void* addr) {
---        return {};
---      }
---  };
---
---  struct always_suspend {
---      bool await_ready() const noexcept;
---      bool await_resume() const noexcept;
---      template <typename T>
---      bool await_suspend(coroutine_handle<T>) const noexcept;
---  };
---
---  template <typename T>
---  struct coroutine_traits {
---      using promise_type = T::promise_type;
---  };
---  }  // namespace std
---
---  struct generator {
---      struct promise_type {
---          void return_value(int v);
---          std::always_suspend yield_value(int&&);
---          std::always_suspend initial_suspend() const noexcept;
---          std::always_suspend final_suspend() const noexcept;
---          void unhandled_exception();
---          generator get_return_object();
---      };
---  };
---
---  generator f() {
---      co_return 10;
---  }
---
---
---The matcher coreturnStmt(has(integerLiteral()))
---matches co_return 10
--+  while (true) { co_return; }
--+coreturnStmt()
--+  matches 'co_return'
-- 
-- -- -- Matcher<Stmt>coroutineBodyStmtMatcher<CoroutineBodyStmt>... --
Matches coroutine body statements.
-- 
---Given
---  namespace std {
---  template <typename T = void>
---  struct coroutine_handle {
---      static constexpr coroutine_handle from_address(void* addr) {
---        return {};
---      }
---  };
---
---  struct suspend_always {
---      bool await_ready() const noexcept;
---      bool await_resume() const noexcept;
---      template <typename T>
---      bool await_suspend(coroutine_handle<T>) const noexcept;
---  };
---
---  template <typename...>
---  struct coroutine_traits {
---      struct promise_type {
---          std::suspend_always initial_suspend() const noexcept;
---          std::suspend_always final_suspend() const noexcept;
---          void return_void();
---          void unhandled_exception();
---          coroutine_traits get_return_object();
---      };
---  };
---  }  // namespace std
---
---  void f() { while (true) { co_return; } }
---
---
---
---The matcher coroutineBodyStmt() matches
---{ while (true) { co_return; } }.
--+coroutineBodyStmt() matches the coroutine below
--+  generator<int> gen() {
--+    co_return;
--+  }
-- 
-- -- --@@ -1899,77 +1520,27 @@ --
Matches co_yield expressions.
-- 
-- Given
---  namespace std {
---  template <typename T = void>
---  struct coroutine_handle {
---      static constexpr coroutine_handle from_address(void* addr) {
---        return {};
---      }
---  };
---
---  struct always_suspend {
---      bool await_ready() const noexcept;
---      bool await_resume() const noexcept;
---      template <typename T>
---      bool await_suspend(coroutine_handle<T>) const noexcept;
---  };
---
---  template <typename T>
---  struct coroutine_traits {
---      using promise_type = T::promise_type;
---  };
---  }  // namespace std
---
---  struct generator {
---      struct promise_type {
---          std::always_suspend yield_value(int&&);
---          std::always_suspend initial_suspend() const noexcept;
---          std::always_suspend final_suspend() const noexcept;
---          void return_void();
---          void unhandled_exception();
---          generator get_return_object();
---      };
---  };
---
---  generator f() {
---      while (true) {
---          co_yield 10;
---      }
---  }
---
---The matcher coyieldExpr()
---matches co_yield 10
--+  co_yield 1;
--+coyieldExpr()
--+  matches 'co_yield 1'
-- 
-- -- -- Matcher<Stmt>cudaKernelCallExprMatcher<CUDAKernelCallExpr>... --
Matches CUDA kernel call expression.
-- 
---Given
---  __global__ void kernel() {}
---  void f() {
---    kernel<<<32,32>>>();
---  }
---
---The matcher cudaKernelCallExpr()
---matches kernel<<<i, k>>>()
--+Example matches,
--+  kernel<<<i,j>>>();
-- 
-- -- -- Matcher<Stmt>cxxBindTemporaryExprMatcher<CXXBindTemporaryExpr>... --
Matches nodes where temporaries are created.
-- 
---Given
---  struct S {
---    S() { }  // User defined constructor makes S non-POD.
---    ~S() { } // User defined destructor makes it non-trivial.
---  };
---  void test() {
---    const S &s_ref = S(); // Requires a CXXBindTemporaryExpr.
---  }
---
---The matcher cxxBindTemporaryExpr()
---matches the constructor call S().
--+Example matches FunctionTakesString(GetStringByValue())
--+    (matcher = cxxBindTemporaryExpr())
--+  FunctionTakesString(GetStringByValue());
--+  FunctionTakesStringByPointer(GetStringPointer());
-- 
-- -- --@@ -1977,71 +1548,49 @@ --
Matches bool literals.
-- 
-- Example matches true
---  bool Flag = true;
---
---
---The matcher cxxBoolLiteral() matches true.
--+  true
-- 
-- -- -- Matcher<Stmt>cxxCatchStmtMatcher<CXXCatchStmt>... --
Matches catch statements.
-- 
---void foo() {
--   try {} catch(int i) {}
---}
---
---The matcher cxxCatchStmt()
---matches catch(int i) {}
--+cxxCatchStmt()
--+  matches 'catch(int i)'
-- 
-- -- -- Matcher<Stmt>cxxConstCastExprMatcher<CXXConstCastExpr>... --
Matches a const_cast expression.
-- 
---Given
--+Example: Matches const_cast<int*>(&r) in
--   int n = 42;
--   const int &r(n);
--   int* p = const_cast<int*>(&r);
---
---
---The matcher cxxConstCastExpr()
---matches const_cast<int*>(&r).
-- 
-- -- -- Matcher<Stmt>cxxConstructExprMatcher<CXXConstructExpr>... --
Matches constructor call expressions (including implicit ones).
-- 
---Given
---  struct string {
---    string(const char*);
---    string(const char*s, int n);
---  };
--+Example matches string(ptr, n) and ptr within arguments of f
--+    (matcher = cxxConstructExpr())
--   void f(const string &a, const string &b);
---  void foo(char *ptr, int n) {
---    f(string(ptr, n), ptr);
---  }
---
---
---The matcher cxxConstructExpr() matches string(ptr, n)
---and ptr within arguments of f .
--+  char *ptr;
--+  int n;
--+  f(string(ptr, n), ptr);
-- 
-- -- -- Matcher<Stmt>cxxDefaultArgExprMatcher<CXXDefaultArgExpr>... --
Matches the value of a default argument at the call site.
-- 
---Given
--+Example matches the CXXDefaultArgExpr placeholder inserted for the
--+    default value of the second parameter in the call expression f(42)
--+    (matcher = cxxDefaultArgExpr())
--   void f(int x, int y = 0);
---  void g() {
---    f(42);
---  }
---
---
---The matcher callExpr(has(cxxDefaultArgExpr()))
---matches the CXXDefaultArgExpr placeholder inserted for the default value
---of the second parameter in the call expression f(42).
--+  f(42);
-- 
-- -- --@@ -2049,17 +1598,9 @@ --
Matches delete expressions.
-- 
-- Given
---  void* operator new(decltype(sizeof(void*)));
---  void operator delete(void*);
---  struct X {};
---  void foo() {
---    auto* x = new X;
---    delete x;
---  }
---
---
---The matcher cxxDeleteExpr()
---matches delete x.
--+  delete X;
--+cxxDeleteExpr()
--+  matches 'delete X'.
-- 
-- -- --@@ -2069,8 +1610,7 @@ -- -- Given -- template <class T> void f() { T t; t.g(); } --- ---The matcher cxxDependentScopeMemberExpr() --+cxxDependentScopeMemberExpr() -- matches t.g -- -- --@@ -2078,83 +1618,53 @@ -- Matcher<Stmt>cxxDynamicCastExprMatcher<CXXDynamicCastExpr>... --
Matches a dynamic_cast expression.
-- 
---Given
--+Example:
--+  cxxDynamicCastExpr()
--+matches
--+  dynamic_cast<D*>(&b);
--+in
--   struct B { virtual ~B() {} }; struct D : B {};
--   B b;
--   D* p = dynamic_cast<D*>(&b);
---
---
---The matcher cxxDynamicCastExpr()
---matches dynamic_cast<D*>(&b).
-- 
-- -- -- Matcher<Stmt>cxxFoldExprMatcher<CXXFoldExpr>... --
Matches C++17 fold expressions.
-- 
---Given
--+Example matches `(0 + ... + args)`:
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--   }
---
---
---The matcher cxxFoldExpr() matches (0 + ... + args).
-- 
-- -- -- Matcher<Stmt>cxxForRangeStmtMatcher<CXXForRangeStmt>... --
Matches range-based for statements.
-- 
---Given
---  void foo() {
---    int i[] =  {1, 2, 3}; for (auto a : i);
---    for(int j = 0; j < 5; ++j);
---  }
---
---The matcher cxxForRangeStmt()
---matches for (auto a : i);
--+cxxForRangeStmt() matches 'for (auto a : i)'
--+  int i[] =  {1, 2, 3}; for (auto a : i);
--+  for(int j = 0; j < 5; ++j);
-- 
-- -- -- Matcher<Stmt>cxxFunctionalCastExprMatcher<CXXFunctionalCastExpr>... --
Matches functional cast expressions
-- 
---Given
---  struct Foo {
---    Foo(int x);
---  };
---
---  void foo(int bar) {
---    Foo f = bar;
---    Foo g = (Foo) bar;
---    Foo h = Foo(bar);
---  }
---
---
---The matcher cxxFunctionalCastExpr()
---matches Foo(bar).
--+Example: Matches Foo(bar);
--+  Foo f = bar;
--+  Foo g = (Foo) bar;
--+  Foo h = Foo(bar);
-- 
-- -- -- Matcher<Stmt>cxxMemberCallExprMatcher<CXXMemberCallExpr>... --
Matches member call expressions.
-- 
---Given
---  struct X {
---    void y();
---    void m() { y(); }
---  };
---  void f();
---  void g() {
---    X x;
---    x.y();
---    f();
---  }
---
---
---The matcher cxxMemberCallExpr() matches x.y() and
---y(), but not f().
--+Example matches x.y()
--+  X x;
--+  x.y();
-- 
-- -- --@@ -2162,15 +1672,9 @@ --
Matches new expressions.
-- 
-- Given
---  void* operator new(decltype(sizeof(void*)));
---  struct X {};
---  void foo() {
---    auto* x = new X;
---  }
---
---
---The matcher cxxNewExpr()
---matches new X.
--+  new X;
--+cxxNewExpr()
--+  matches 'new X'.
-- 
-- -- --@@ -2183,24 +1687,14 @@ -- bool c() noexcept(false); -- bool d() noexcept(noexcept(a())); -- bool e = noexcept(b()) || noexcept(c()); --- ---The matcher cxxNoexceptExpr() ---matches noexcept(a()), noexcept(b()) and ---noexcept(c()), but does not match the noexcept specifier in the ---declarations a, b, c or d. --+cxxNoexceptExpr() --+ matches `noexcept(a())`, `noexcept(b())` and `noexcept(c())`. --+ doesn't match the noexcept specifier in the declarations a, b, c or d. -- -- -- -- Matcher<Stmt>cxxNullPtrLiteralExprMatcher<CXXNullPtrLiteralExpr>... --
Matches nullptr literal.
---
---Given
---  int a = 0;
---  int* b = 0;
---  int *c = nullptr;
---
---
---The matcher cxxNullPtrLiteralExpr() matches nullptr.
-- 
-- -- --@@ -2212,16 +1706,11 @@ -- Currently it does not match operators such as new delete. -- FIXME: figure out why these do not match? -- ---Given --- struct ostream; --+Example matches both operator<<((o << b), c) and operator<<(o, b) --+ (matcher = cxxOperatorCallExpr()) -- ostream &operator<< (ostream &out, int i) { }; --- void f(ostream& o, int b, int c) { --- o << b << c; --- } --- --- ---The matcher cxxOperatorCallExpr() matches o << b << c ---and o << b. --+ ostream &o; int b = 1, c = 1; --+ o << b << c; -- See also the binaryOperation() matcher for more-general matching of binary -- uses of this AST node. -- --@@ -2236,10 +1725,6 @@ -- -- Example matches reinterpret_cast<char*>(&p) in -- void* p = reinterpret_cast<char*>(&p); --- --- ---The matcher cxxReinterpretCastExpr() ---matches reinterpret_cast<char*>(&p). -- -- -- --@@ -2247,20 +1732,16 @@ --
Matches rewritten binary operators
-- 
-- Example matches use of "<":
--+  #include <compare>
--   struct HasSpaceshipMem {
--     int a;
---    constexpr bool operator==(const HasSpaceshipMem&) const = default;
--+    constexpr auto operator<=>(const HasSpaceshipMem&) const = default;
--   };
--   void compare() {
--     HasSpaceshipMem hs1, hs2;
---    if (hs1 != hs2)
--+    if (hs1 < hs2)
--         return;
--   }
---
---
---The matcher cxxRewrittenBinaryOperator() matches
---hs1 != hs2.
---
-- See also the binaryOperation() matcher for more-general matching
-- of this AST node.
-- 
--@@ -2272,12 +1753,12 @@ -- See also: hasDestinationType -- See also: reinterpretCast -- ---Given --+Example: --+ cxxStaticCastExpr() --+matches --+ static_cast<long>(8) --+in -- long eight(static_cast<long>(8)); --- --- ---The matcher cxxStaticCastExpr() ---matches static_cast<long>(8). -- -- -- --@@ -2285,110 +1766,69 @@ --
Matches C++ initializer list expressions.
-- 
-- Given
---  namespace std {
---    template <typename T>
---    class initializer_list {
---      const T* begin;
---      const T* end;
---    };
---  }
---  template <typename T> class vector {
---    public: vector(std::initializer_list<T>) {}
---  };
---
---  vector<int> a({ 1, 2, 3 });
---  vector<int> b = { 4, 5 };
--+  std::vector<int> a({ 1, 2, 3 });
--+  std::vector<int> b = { 4, 5 };
--   int c[] = { 6, 7 };
---  struct pair { int x; int y; };
---  pair d = { 8, 9 };
---
---The matcher cxxStdInitializerListExpr()
---matches { 1, 2, 3 } and { 4, 5 }.
--+  std::pair<int, int> d = { 8, 9 };
--+cxxStdInitializerListExpr()
--+  matches "{ 1, 2, 3 }" and "{ 4, 5 }"
-- 
-- -- -- Matcher<Stmt>cxxTemporaryObjectExprMatcher<CXXTemporaryObjectExpr>... --
Matches functional cast expressions having N != 1 arguments
-- 
---Given
---  struct Foo {
---    Foo(int x, int y);
---  };
---
---  void foo(int bar) {
---    Foo h = Foo(bar, bar);
---  }
---
---
---The matcher cxxTemporaryObjectExpr()
---matches Foo(bar, bar).
--+Example: Matches Foo(bar, bar)
--+  Foo h = Foo(bar, bar);
-- 
-- -- -- Matcher<Stmt>cxxThisExprMatcher<CXXThisExpr>... --
Matches implicit and explicit this expressions.
-- 
---Given
---  struct foo {
---    int i;
---    int f() { return i; }
---    int g() { return this->i; }
---  };
---
---
---The matcher cxxThisExpr()
---matches this of this->i and the implicit this expression
---of i.
--+Example matches the implicit this expression in "return i".
--+    (matcher = cxxThisExpr())
--+struct foo {
--+  int i;
--+  int f() { return i; }
--+};
-- 
-- -- -- Matcher<Stmt>cxxThrowExprMatcher<CXXThrowExpr>... --
Matches throw expressions.
-- 
---void foo() {
--   try { throw 5; } catch(int i) {}
---}
---
---The matcher cxxThrowExpr()
---matches throw 5
--+cxxThrowExpr()
--+  matches 'throw 5'
-- 
-- -- -- Matcher<Stmt>cxxTryStmtMatcher<CXXTryStmt>... --
Matches try statements.
-- 
---void foo() {
--   try {} catch(int i) {}
---}
---
---The matcher cxxTryStmt()
---matches try {} catch(int i) {}
--+cxxTryStmt()
--+  matches 'try {}'
-- 
-- -- -- Matcher<Stmt>cxxUnresolvedConstructExprMatcher<CXXUnresolvedConstructExpr>... --
Matches unresolved constructor call expressions.
-- 
---Given
--+Example matches T(t) in return statement of f
--+    (matcher = cxxUnresolvedConstructExpr())
--   template <typename T>
--   void f(const T& t) { return T(t); }
---
---
---The matcher cxxUnresolvedConstructExpr() matches
---T(t).
-- 
-- -- -- Matcher<Stmt>declRefExprMatcher<DeclRefExpr>... --
Matches expressions that refer to declarations.
-- 
---Given
---  void f(bool x) {
---    if (x) {}
---  }
---
---
---The matcher declRefExpr() matches x.
--+Example matches x in if (x)
--+  bool x;
--+  if (x) {}
-- 
-- -- --@@ -2396,11 +1836,9 @@ --
Matches declaration statements.
-- 
-- Given
---  void foo() {
---    int a;
---  }
---The matcher declStmt()
---matches int a;.
--+  int a;
--+declStmt()
--+  matches 'int a'.
-- 
-- -- --@@ -2408,75 +1846,22 @@ --
Matches default statements inside switch statements.
-- 
-- Given
---void foo(int a) {
--   switch(a) { case 42: break; default: break; }
---}
---The matcher defaultStmt()
---matches default: break.
--+defaultStmt()
--+  matches 'default:'.
-- 
-- -- -- Matcher<Stmt>dependentCoawaitExprMatcher<DependentCoawaitExpr>... --
Matches co_await expressions where the type of the promise is dependent
---
---Given
---  namespace std {
---  template <typename T = void>
---  struct coroutine_handle {
---      static constexpr coroutine_handle from_address(void* addr) {
---        return {};
---      }
---  };
---
---  struct always_suspend {
---      bool await_ready() const noexcept;
---      bool await_resume() const noexcept;
---      template <typename T>
---      bool await_suspend(coroutine_handle<T>) const noexcept;
---  };
---
---  template <typename T>
---  struct coroutine_traits {
---      using promise_type = T::promise_type;
---  };
---  }  // namespace std
---
---  template <typename T>
---  struct generator {
---      struct promise_type {
---          std::always_suspend yield_value(int&&);
---          std::always_suspend initial_suspend() const noexcept;
---          std::always_suspend final_suspend() const noexcept;
---          void return_void();
---          void unhandled_exception();
---          generator get_return_object();
---      };
---  };
---
---  template <typename T>
---  std::always_suspend h();
---
---  template <>
---  std::always_suspend h<void>();
---
---  template<typename T>
---  generator<T> g() { co_await h<T>(); }
---
---The matcher dependentCoawaitExpr()
---matches co_await h<T>().
-- 
-- -- -- Matcher<Stmt>designatedInitExprMatcher<DesignatedInitExpr>... --
Matches C99 designated initializer expressions [C99 6.7.8].
-- 
---Example: Given
---  struct point2 { double x; double y; };
---  struct point2 ptarray[10] = { [0].x = 1.0 };
---  struct point2 pt = { .x = 2.0 };
---
---The matcher designatedInitExpr()
---matches [0].x = 1.0 and .x = 2.0.
--+Example: Matches { [2].y = 1.0, [0].x = 1.0 }
--+  point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 };
-- 
-- -- --@@ -2484,12 +1869,9 @@ --
Matches do statements.
-- 
-- Given
---void foo() {
--   do {} while (true);
---}
---
---The matcher doStmt()
---matches do {} while (true)
--+doStmt()
--+  matches 'do {} while(true)'
-- 
-- -- --@@ -2507,36 +1889,18 @@ -- -- See also: hasDestinationType. -- --- struct S {}; --- const S* s; --- S* s2 = const_cast<S*>(s); --- --- const int val = 0; --- char val0 = val; --- char val1 = (char)val; --- char val2 = static_cast<char>(val); --- int* val3 = reinterpret_cast<int*>(val); --- char val4 = char(val); --- --- ---The matcher explicitCastExpr() ---matches (char)val, static_cast<char>(val), ---reinterpret_cast<int*>(val), const_cast<S*>(s) ---and char(val), but not the initialization of val0 with ---val. --+Example: matches all five of the casts in --+ int((int)(reinterpret_cast<int>(static_cast<int>(const_cast<int>(42))))) --+but does not match the implicit conversion in --+ long ell = 42; -- -- -- -- Matcher<Stmt>exprMatcher<Expr>... --
Matches expressions.
-- 
---Given
---  int f(int x, int y) { return x + y; }
---
---The matcher expr() matches x + y once,
---x twice and y twice, matching the
---DeclRefExpr , and the ImplicitCastExpr that does an l- to r-value
---cast.
--+Example matches x()
--+  void f() { x(); }
-- 
-- -- --@@ -2545,33 +1909,12 @@ -- of the sub-expression's evaluation. -- -- Example matches std::string() --- struct A { ~A(); }; --- void f(A); --- void g(A&); --- void h() { --- A a = A{}; --- f(A{}); --- f(a); --- g(a); --- } --- --- ---The matcher exprWithCleanups() matches A{}, ---f(A{}) and f(a), ---but does not match passing g(a). --+ const std::string str = std::string(); -- -- -- -- Matcher<Stmt>fixedPointLiteralMatcher<FixedPointLiteral>... --
Matches fixed point literals
---
---Given
---  void f() {
---    0.0k;
---  }
---
---
---The matcher fixedPointLiteral() matches 0.0k.
-- 
-- -- --@@ -2579,62 +1922,27 @@ --
Matches float literals of all sizes / encodings, e.g.
-- 1.0, 1.0f, 1.0L and 1e10.
-- 
---Given
---  int a = 1.0;
---  int b = 1.0F;
---  int c = 1.0L;
---  int d = 1e10;
---  int e = 1;
---
---The matcher floatLiteral() matches
---1.0, 1.0F, 1.0L and 1e10, but does not match
---1.
--+Does not match implicit conversions such as
--+  float a = 10;
-- 
-- -- -- Matcher<Stmt>forStmtMatcher<ForStmt>... --
Matches for statements.
-- 
---Given
---  void foo() {
---    for (;;) {}
---    int i[] =  {1, 2, 3}; for (auto a : i);
---  }
---
---
---The matcher forStmt() matches for (;;) {},
---but not for (auto a : i);.
--+Example matches 'for (;;) {}'
--+  for (;;) {}
--+  int i[] =  {1, 2, 3}; for (auto a : i);
-- 
-- -- -- Matcher<Stmt>genericSelectionExprMatcher<GenericSelectionExpr>... --
Matches C11 _Generic expression.
---
---Given
---  double fdouble(double);
---  float ffloat(float);
---  #define GENERIC_MACRO(X) _Generic((X), double: fdouble, float: ffloat)(X)
---
---  void f() {
---      GENERIC_MACRO(0.0);
---      GENERIC_MACRO(0.0F);
---  }
---
---
---The matcher genericSelectionExpr() matches
---the generic selection expression that is expanded in
---GENERIC_MACRO(0.0) and GENERIC_MACRO(0.0F).
-- 
-- -- -- Matcher<Stmt>gnuNullExprMatcher<GNUNullExpr>... --
Matches GNU __null expression.
---
---Given
---  auto val = __null;
---
---
---The matcher gnuNullExpr() matches __null.
-- 
-- -- --@@ -2642,39 +1950,24 @@ --
Matches goto statements.
-- 
-- Given
---void bar();
---void foo() {
--   goto FOO;
--   FOO: bar();
---}
---The matcher gotoStmt()
---matches goto FOO
--+gotoStmt()
--+  matches 'goto FOO'
-- 
-- -- -- Matcher<Stmt>ifStmtMatcher<IfStmt>... --
Matches if statements.
-- 
---Given
---  void foo(int x) {
---    if (x) {}
---  }
---
---The matcher ifStmt() matches if (x) {}.
--+Example matches 'if (x) {}'
--+  if (x) {}
-- 
-- -- -- Matcher<Stmt>imaginaryLiteralMatcher<ImaginaryLiteral>... --
Matches imaginary literals, which are based on integer and floating
-- point literals e.g.: 1i, 1.0i
---
---Given
---  auto a = 1i;
---  auto b = 1.0i;
---
---
---The matcher imaginaryLiteral() matches 1i and
---1.0i.
-- 
-- -- --@@ -2683,17 +1976,6 @@ -- -- This matches many different places, including function call return value -- eliding, as well as any type conversions. --- ---void f(int); ---void g(int val1, int val2) { --- unsigned int a = val1; --- f(val2); ---} --- ---The matcher implicitCastExpr() ---matches val1 for the implicit cast from an l- to an r-value ---and for the cast to int}, f for the function pointer ---decay, and val2 for the cast from an l- to an r-value. -- -- -- --@@ -2701,11 +1983,9 @@ --
Matches implicit initializers of init list expressions.
-- 
-- Given
---  struct point { double x; double y; };
---  struct point pt = { .x = 42.0 };
---The matcher
---initListExpr(has(implicitValueInitExpr().bind("implicit")))
---matches { .x = 42.0 }.
--+  point ptarray[10] = { [2].y = 1.0, [2].x = 2.0, [0].x = 1.0 };
--+implicitValueInitExpr()
--+  matches "[0].y" (implicitly)
-- 
-- -- --@@ -2715,9 +1995,9 @@ -- Given -- int a[] = { 1, 2 }; -- struct B { int x, y; }; --- struct B b = { 5, 6 }; ---The matcher initListExpr() ---matches { 1, 2 } and { 5, 6 } --+ B b = { 5, 6 }; --+initListExpr() --+ matches "{ 1, 2 }" and "{ 5, 6 }" -- -- -- --@@ -2726,17 +2006,6 @@ -- 1, 1L, 0x1 and 1U. -- -- Does not match character-encoded integers such as L'a'. --- ---Given --- int a = 1; --- int b = 1L; --- int c = 0x1; --- int d = 1U; --- int e = 1.0; --- ---The matcher integerLiteral() matches ---1, 1L, 0x1 and 1U, but does not match ---1.0. -- -- -- --@@ -2744,26 +2013,18 @@ --
Matches label statements.
-- 
-- Given
---void bar();
---void foo() {
--   goto FOO;
--   FOO: bar();
---}
---The matcher labelStmt()
---matches FOO: bar()
--+labelStmt()
--+  matches 'FOO:'
-- 
-- -- -- Matcher<Stmt>lambdaExprMatcher<LambdaExpr>... --
Matches lambda expressions.
-- 
---Given
---  void f() {
---    []() { return 5; };
---  }
---
---
---The matcher lambdaExpr() matches []() { return 5; }.
--+Example matches [&](){return 5;}
--+  [&](){return 5;}
-- 
-- -- --@@ -2774,17 +2035,12 @@ -- struct T {void func();}; -- T f(); -- void g(T); --- void foo() { --- T u(f()); --- g(f()); --- f().func(); --- f(); // does not match --- } --- ---The matcher materializeTemporaryExpr() matches ---f() three times before C++17 and it ---matches f() time with C++17 and later, but ---it does not match the f() in the last line in any version. --+materializeTemporaryExpr() matches 'f()' in these statements --+ T u(f()); --+ g(f()); --+ f().func(); --+but does not match --+ f(); -- -- -- --@@ -2796,20 +2052,17 @@ -- void x() { this->x(); x(); Y y; y.x(); a; this->b; Y::b; } -- int a; static int b; -- }; --- ---The matcher memberExpr() ---matches this->x, x, y.x, a, this->b. --+memberExpr() --+ matches this->x, x, y.x, a, this->b -- -- -- -- Matcher<Stmt>nullStmtMatcher<NullStmt>... --
Matches null statements.
-- 
---void foo() {
--   foo();;
---}
---The matcher nullStmt()
---matches the second ;
--+nullStmt()
--+  matches the second ';'
-- 
-- -- --@@ -2819,7 +2072,6 @@ -- Example matches @catch -- @try {} -- @catch (...) {} --- -- -- -- --@@ -2829,23 +2081,19 @@ -- Example matches @finally -- @try {} -- @finally {} --- -- -- -- -- Matcher<Stmt>objcIvarRefExprMatcher<ObjCIvarRefExpr>... --
Matches a reference to an ObjCIvar.
-- 
---Given
--+Example: matches "a" in "init" method:
-- @implementation A {
--   NSString *a;
-- }
-- - (void) init {
--   a = @"hello";
-- }
---
---
---The matcher objcIvarRefExpr() matches a.
-- 
-- -- --@@ -2857,10 +2105,6 @@ -- "initWithString" instance method on the object returned from -- NSString's "alloc". This matcher should match both message sends. -- [[NSString alloc] initWithString:@"Hello"] --- --- ---The matcher objcMessageExpr() matches ---[[NSString alloc] initWithString:@"Hello"] -- -- -- --@@ -2869,7 +2113,6 @@ -- -- Example matches @"abcd" -- NSString *s = @"abcd"; --- -- -- -- --@@ -2877,7 +2120,6 @@ --
Matches Objective-C statements.
-- 
-- Example matches @throw obj;
---
-- 
-- -- --@@ -2887,7 +2129,6 @@ -- Example matches @try -- @try {} -- @catch (...) {} --- -- -- -- --@@ -2895,19 +2136,13 @@ --
Matches any ``#pragma omp`` executable directive.
-- 
-- Given
---  void foo() {
---    #pragma omp parallel
---      {}
---    #pragma omp parallel default(none)
---      {
---        #pragma omp taskyield
---      }
---  }
-- 
---The matcher ompExecutableDirective()
---matches #pragma omp parallel,
---#pragma omp parallel default(none)
---and #pragma omp taskyield.
--+  #pragma omp parallel
--+  #pragma omp parallel default(none)
--+  #pragma omp taskyield
--+
--+``ompExecutableDirective()`` matches ``omp parallel``,
--+``omp parallel default(none)`` and ``omp taskyield``.
-- 
-- -- --@@ -2916,27 +2151,17 @@ -- to reference another expressions and can be met -- in BinaryConditionalOperators, for example. -- ---Given --- int f(int a, int b) { --- return (a ?: b) + 42; --- } --- --- ---The matcher opaqueValueExpr() matches a twice, ---once for the check and once for the expression of the true path. --+Example matches 'a' --+ (a ?: c) + 42; -- -- -- -- Matcher<Stmt>parenExprMatcher<ParenExpr>... --
Matches parentheses used in expressions.
-- 
---Given
--+Example matches (foo() + 1)
--   int foo() { return 1; }
---  int bar() {
---    int a = (foo() + 1);
---  }
---
---The matcher parenExpr() matches (foo() + 1).
--+  int a = (foo() + 1);
-- 
-- -- --@@ -2952,12 +2177,8 @@ -- int a = 0, b = 1; int i = (a, b); -- } -- }; --- ---The matcher parenListExpr() ---matches (*this), ---but does not match (a, b) ---because (a, b) has a predefined type and is a ParenExpr, not a ---ParenListExpr. --+parenListExpr() matches "*this" but NOT matches (a, b) because (a, b) --+has a predefined type and is a ParenExpr, not a ParenListExpr. -- -- -- --@@ -2965,12 +2186,7 @@ --
Matches predefined identifier expressions [C99 6.4.2.2].
-- 
-- Example: Matches __func__
---  void f() {
---    const char* func_name = __func__;
---  }
---
---The matcher predefinedExpr()
---matches __func__.
--+  printf("%s", __func__);
-- 
-- -- --@@ -2978,11 +2194,9 @@ --
Matches return statements.
-- 
-- Given
---int foo() {
--   return 1;
---}
---The matcher returnStmt()
---matches return 1
--+returnStmt()
--+  matches 'return 1'
-- 
-- -- --@@ -2990,35 +2204,26 @@ --
Matches statements.
-- 
-- Given
---  void foo(int a) { { ++a; } }
---The matcher stmt()
---matches the function body itself { { ++a; } }, the compound
---statement { ++a; }, the expression ++a and a.
--+  { ++a; }
--+stmt()
--+  matches both the compound statement '{ ++a; }' and '++a'.
-- 
-- -- -- Matcher<Stmt>stmtExprMatcher<StmtExpr>... --
Matches statement expression (GNU extension).
-- 
---Given
---  void f() {
---    int C = ({ int X = 4; X; });
---  }
---
---The matcher stmtExpr() matches ({ int X = 4; X; }).
--+Example match: ({ int X = 4; X; })
--+  int C = ({ int X = 4; X; });
-- 
-- -- -- Matcher<Stmt>stringLiteralMatcher<StringLiteral>... --
Matches string literals (also matches wide string literals).
-- 
---Given
--+Example matches "abcd", L"abcd"
--   char *s = "abcd";
--   wchar_t *ws = L"abcd";
---
---
---The matcher stringLiteral() matches "abcd" and
---L"abcd".
-- 
-- -- --@@ -3029,9 +2234,8 @@ -- template <int N> -- struct A { static const int n = N; }; -- struct B : public A<42> {}; --- ---The matcher substNonTypeTemplateParmExpr() ---matches N in the right-hand side of "static const int n = N;" --+substNonTypeTemplateParmExpr() --+ matches "N" in the right-hand side of "static const int n = N;" -- -- -- --@@ -3039,11 +2243,9 @@ --
Matches case and default statements inside switch statements.
-- 
-- Given
---void foo(int a) {
--   switch(a) { case 42: break; default: break; }
---}
---The matcher switchCase()
---matches case 42: break and default: break
--+switchCase()
--+  matches 'case 42:' and 'default:'.
-- 
-- -- --@@ -3051,11 +2253,9 @@ --
Matches switch statements.
-- 
-- Given
---void foo(int a) {
--   switch(a) { case 42: break; default: break; }
---}
---The matcher switchStmt()
---matches switch(a) { case 42: break; default: break; }.
--+switchStmt()
--+  matches 'switch(a)'.
-- 
-- -- --@@ -3063,11 +2263,10 @@ --
Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
-- 
-- Given
---  int x = 42;
--+  Foo x = bar;
--   int y = sizeof(x) + alignof(x);
---
---The matcher unaryExprOrTypeTraitExpr()
---matches sizeof(x) and alignof(x)
--+unaryExprOrTypeTraitExpr()
--+  matches sizeof(x) and alignof(x)
-- 
-- -- --@@ -3075,12 +2274,7 @@ --
Matches unary operator expressions.
-- 
-- Example matches !a
---  void foo(bool a, bool b) {
---    !a || b;
---  }
---
---
---The matcher unaryOperator() matches !a.
--+  !a || b
-- 
-- -- --@@ -3095,10 +2289,8 @@ -- void bar() { -- foo<T>(); -- } --- ---The matcher unresolvedLookupExpr() ---matches foo<T>. --- --+unresolvedLookupExpr() --+ matches foo<T>() -- -- -- Matcher<Stmt>unresolvedMemberExprMatcher<UnresolvedMemberExpr>... --@@ -3110,9 +2302,8 @@ -- void g(); -- }; -- template <class T> void h() { X x; x.f<T>(); x.g(); } --- ---The matcher unresolvedMemberExpr() ---matches x.f<T> --+unresolvedMemberExpr() --+ matches x.f<T> -- -- -- --@@ -3120,12 +2311,6 @@ --
Matches user defined literal operator call.
-- 
-- Example match: "foo"_suffix
---Given
---  float operator ""_foo(long double);
---  float a = 1234.5_foo;
---
---
---The matcher userDefinedLiteral() matches 1234.5_foo.
-- 
-- -- --@@ -3133,12 +2318,9 @@ --
Matches while statements.
-- 
-- Given
---void foo() {
--   while (true) {}
---}
---
---The matcher whileStmt()
---matches while (true) {}.
--+whileStmt()
--+  matches 'while (true) {}'.
-- 
-- -- --@@ -3148,9 +2330,8 @@ -- Given -- template <typename T> struct C {}; -- C<int> c; --- ---The matcher templateArgumentLoc() ---matches int in C<int>. --+templateArgumentLoc() --+ matches 'int' in C<int>. -- -- -- --@@ -3160,10 +2341,8 @@ -- Given -- template <typename T> struct C {}; -- C<int> c; --- ---The matcher ---templateSpecializationType(hasAnyTemplateArgument(templateArgument())) ---matches C<int>. --+templateArgument() --+ matches 'int' in C<int>. -- -- -- --@@ -3171,14 +2350,10 @@ --
Matches template name.
-- 
-- Given
---  template<template <typename> class S> class X {};
---  template<typename T> class Y {};
---  X<Y> xi;
---
---The matcher
---classTemplateSpecializationDecl(hasAnyTemplateArgument(
---              refersToTemplate(templateName())))
---matches the specialization class X<Y>
--+  template <typename T> class X { };
--+  X<int> xi;
--+templateName()
--+  matches 'X' in X<int>.
-- 
-- -- --@@ -3188,8 +2363,8 @@ -- Given -- struct s {}; -- struct s ss; ---The matcher elaboratedTypeLoc() ---matches the type struct s of ss. --+elaboratedTypeLoc() --+ matches the `TypeLoc` of the variable declaration of `ss`. -- -- -- --@@ -3198,8 +2373,8 @@ -- -- Given -- int* x; ---The matcher pointerTypeLoc() --- matches int*. --+pointerTypeLoc() --+ matches `int*`. -- -- -- --@@ -3208,11 +2383,8 @@ -- -- Given -- const int x = 0; --- ---The matcher qualifiedTypeLoc() ---matches the type of the variable declaration x . However, the ---current implementation of QualifiedTypeLoc does not store the source ---locations for the qualifiers of the type int. --+qualifiedTypeLoc() --+ matches `const int`. -- -- -- --@@ -3223,10 +2395,8 @@ -- int x = 3; -- int& l = x; -- int&& r = 3; --- --- ---The matcher referenceTypeLoc() --- matches int& and int&&. --+referenceTypeLoc() --+ matches `int&` and `int&&`. -- -- -- --@@ -3236,25 +2406,13 @@ -- Given -- template <typename T> class C {}; -- C<char> var; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(typeLoc()))))) ---matches C<char> var. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(typeLoc()))) --+ matches `C<char> var`. -- -- -- -- Matcher<TypeLoc>typeLocMatcher<TypeLoc>... --
Matches TypeLocs in the clang AST.
---
---That is, information about a type and where it was written.
---
---  void foo(int val);
---
---The matcher declaratorDecl(hasTypeLoc(typeLoc().bind("type")))
---matches void foo(int val) and int val, with
---typeLoc() matching void and
---int respectively.
-- 
-- -- --@@ -3265,9 +2423,8 @@ -- int a[] = { 2, 3 }; -- int b[4]; -- void f() { int c[a[0]]; } ---The matcher arrayType() ---int[4], int[a[0]] and ---int[]; --+arrayType() --+ matches "int a[]", "int b[4]" and "int c[a[0]]"; -- -- -- --@@ -3276,25 +2433,20 @@ -- -- Given -- _Atomic(int) i; ---The matcher atomicType() ---_Atomic(int) --+atomicType() --+ matches "_Atomic(int) i" -- -- -- -- Matcher<Type>autoTypeMatcher<AutoType>... --
Matches types nodes representing C++11 auto types.
-- 
---Given
---  void foo() {
---    auto n = 4;
---    int v[] = { 2, 3 };
---    for (auto i : v) { };
---  }
---
---The matcher autoType()
---matches the auto of n and i ,
---as well as the auto types for the implicitly generated code of the range-for
---loop (for the range, the begin iterator and the end iterator).
--+Given:
--+  auto n = 4;
--+  int v[] = { 2, 3 }
--+  for (auto i : v) { }
--+autoType()
--+  matches "auto n" and "auto i"
-- 
-- -- --@@ -3310,12 +2462,13 @@ --
Matches builtin Types.
-- 
-- Given
---  enum E { Ok };
---  enum E e;
--+  struct A {};
--+  A a;
--   int b;
--   float c;
---The matcher varDecl(hasType(builtinType()))
---matches int b and float c.
--+  bool d;
--+builtinType()
--+  matches "int b", "float c" and "bool d"
-- 
-- -- --@@ -3324,8 +2477,8 @@ -- -- Given -- _Complex float f; ---The matcher complexType() ---_Complex float --+complexType() --+ matches "_Complex float f" -- -- -- --@@ -3333,38 +2486,37 @@ --
Matches C arrays with a specified constant size.
-- 
-- Given
---  void foo() {
--+  void() {
--     int a[2];
--     int b[] = { 2, 3 };
--     int c[b[0]];
--   }
---The matcher constantArrayType()
---int[2]
--+constantArrayType()
--+  matches "int a[2]"
-- 
-- -- -- Matcher<Type>decayedTypeMatcher<DecayedType>... --
Matches decayed type
--+Example matches i[] in declaration of f.
--+    (matcher = valueDecl(hasType(decayedType(hasDecayedType(pointerType())))))
--+Example matches i[1].
--+    (matcher = expr(hasType(decayedType(hasDecayedType(pointerType())))))
--   void f(int i[]) {
--     i[1] = 0;
--   }
---The matcher
---valueDecl(hasType(decayedType(hasDecayedType(pointerType()))))
---matches int i[] in declaration of The matcher
---expr(hasType(decayedType(hasDecayedType(pointerType()))))
---matches i in 
--+ -- -- -- Matcher<Type>decltypeTypeMatcher<DecltypeType>... --
Matches types nodes representing C++11 decltype(<expr>) types.
-- 
---Given
--+Given:
--   short i = 1;
--   int j = 42;
--   decltype(i + j) result = i + j;
---
---The matcher decltypeType()
---decltype(i + j)
--+decltypeType()
--+  matches "decltype(i + j)"
-- 
-- -- --@@ -3377,9 +2529,8 @@ -- class C { public: C(T); }; -- -- C c(123); --- ---The matcher deducedTemplateSpecializationType() matches the type ---C of the declaration of the variable c. --+deducedTemplateSpecializationType() matches the type in the declaration --+of the variable c. -- -- -- --@@ -3391,9 +2542,8 @@ -- class array { -- T data[Size]; -- }; --- ---The matcher dependentSizedArrayType() ---T[Size] --+dependentSizedArrayType() --+ matches "T data[Size]" -- -- -- --@@ -3406,9 +2556,8 @@ -- class vector { -- typedef T __attribute__((ext_vector_type(Size))) type; -- }; --- ---The matcher dependentSizedExtVectorType() ---T __attribute__((ext_vector_type(Size))) --+dependentSizedExtVectorType() --+ matches "T __attribute__((ext_vector_type(Size)))" -- -- -- --@@ -3424,17 +2573,11 @@ -- } -- class C {}; -- --- C c; --+ class C c; -- N::M::D d; -- --- ---The matcher elaboratedType() matches the type ---C three times. Once for the type of the ---variable c, once for the type of the class definition and once for the ---type in the injected class name. For D}, it matches ---N::M::D of variable d and its class definition and ---injected class name ---D one time respectively. --+elaboratedType() matches the type of the variable declarations of both --+c and d. -- -- -- --@@ -3448,10 +2591,8 @@ -- C c; -- S s; -- --- ---The matcher enumType() matches the type ---enum C of c , ---and the type enum S of s . --+enumType() matches the type of the variable declarations of both c and --+s. -- -- -- --@@ -3461,11 +2602,9 @@ -- Given -- int (*f)(int); -- void g(); ---The matcher functionProtoType() ---matches the type int (int) of 'f' and the type ---void (void) of 'g' in C++ mode. ---In C, the type void () of 'g' is not ---matched because it does not contain a prototype. --+functionProtoType() --+ matches "int (*f)(int)" and the type of "g" in C++ mode. --+ In C mode, "g" is not matched because it does not contain a prototype. -- -- -- --@@ -3475,12 +2614,8 @@ -- Given -- int (*f)(int); -- void g(); ---The matcher functionType() ---int (int) and the type of ---void (void) in C++ and in C23 and ---later. Before C23, the function type for f will be matched the same way, ---but the function type for g will match ---void (). --+functionType() --+ matches "int (*f)(int)" and the type of "g". -- -- -- --@@ -3491,30 +2626,27 @@ -- int a[] = { 2, 3 }; -- int b[42]; -- void f(int c[]) { int d[a[0]]; }; ---The matcher incompleteArrayType() ---int[] and int[] --+incompleteArrayType() --+ matches "int a[]" and "int c[]" -- -- -- -- Matcher<Type>injectedClassNameTypeMatcher<InjectedClassNameType>... --
Matches injected class name types.
-- 
---Given
--+Example matches S s, but not S<T> s.
--+    (matcher = parmVarDecl(hasType(injectedClassNameType())))
--   template <typename T> struct S {
--     void f(S s);
--     void g(S<T> s);
--   };
---
---The matcher
---parmVarDecl(hasType(elaboratedType(namesType(injectedClassNameType()))))
---matches S s, but not s}
-- 
-- -- -- Matcher<Type>lValueReferenceTypeMatcher<LValueReferenceType>... --
Matches lvalue reference types.
-- 
---Given
--+Given:
--   int *a;
--   int &b = *a;
--   int &&c = 1;
--@@ -3523,11 +2655,8 @@
--   auto &&f = 2;
--   int g = 5;
-- 
---
---The matcher lValueReferenceType() matches the type
---int & of b and the type auto &
---of d.
---FIXME: figure out why auto changechange matches twice
--+lValueReferenceType() matches the types of b, d, and e. e is
--+matched since the type is deduced as int& by reference collapsing rules.
-- 
-- -- --@@ -3538,23 +2667,18 @@ -- #define CDECL __attribute__((cdecl)) -- typedef void (CDECL *X)(); -- typedef void (__attribute__((cdecl)) *Y)(); ---The matcher macroQualifiedType() ---matches the type CDECL void ---(void) of the typedef declaration of X , unless when in C98-C17, there ---CDECL void (), ---but it does not match the type ---__attribute((cdecl)) void () of Y . --+macroQualifiedType() --+ matches the type of the typedef declaration of X but not Y. -- -- -- -- Matcher<Type>memberPointerTypeMatcher<MemberPointerType>... --
Matches member pointer types.
-- Given
---  struct A { int i; };
---  int A::* ptr = &A::i;
---
---The matcher memberPointerType()
---matches int struct A::*.
--+  struct A { int i; }
--+  A::* ptr = A::i;
--+memberPointerType()
--+  matches "A::* ptr"
-- 
-- -- --@@ -3568,10 +2692,8 @@ -- @interface Foo -- @end -- Foo *f; --- ---The matcher pointerType() ---matches Foo *, but does not match ---int *. --+pointerType() --+ matches "Foo *f", but does not match "int *a". -- -- -- --@@ -3582,9 +2704,8 @@ -- int (*ptr_to_array)[4]; -- int *array_of_ptrs[4]; -- ---The matcher varDecl(hasType(pointsTo(parenType()))) --- matches ptr_to_array but not --- array_of_ptrs. --+varDecl(hasType(pointsTo(parenType()))) matches ptr_to_array but not --+array_of_ptrs. -- -- -- --@@ -3593,28 +2714,22 @@ -- types. -- -- Given --- typedef int* int_ptr; --- void foo(char *str, --- int val, --- int *val_ptr, --- int_ptr not_a_ptr, --- int_ptr *ptr); --- ---The matcher parmVarDecl(hasType(pointerType())) ---matches char *str, int *val_ptr and ---int_ptr *ptr. --+ int *a; --+ int &b = *a; --+ int c = 5; -- -- @interface Foo -- @end -- Foo *f; --- --+pointerType() --+ matches "int *a", but does not match "Foo *f". -- -- -- -- Matcher<Type>rValueReferenceTypeMatcher<RValueReferenceType>... --
Matches rvalue reference types.
-- 
---Given
--+Given:
--   int *a;
--   int &b = *a;
--   int &&c = 1;
--@@ -3623,10 +2738,8 @@
--   auto &&f = 2;
--   int g = 5;
-- 
---
---The matcher rValueReferenceType() matches the type
---int && of c and the type
---auto && of f.
--+rValueReferenceType() matches the types of c and f. e is not
--+matched as it is deduced to int& by reference collapsing rules.
-- 
-- -- --@@ -3640,14 +2753,8 @@ -- C c; -- S s; -- --- ---The matcher recordType() matches the type ---class C of the variable declaration of c and ---matches the type struct S of the variable ---declaration of s. ---Both of these types are matched three times, once for the type of the ---variable, once for the definition of the class, and once for the type of the ---injected class name. --+recordType() matches the type of the variable declarations of both c --+and s. -- -- -- --@@ -3663,12 +2770,7 @@ -- auto &&f = 2; -- int g = 5; -- --- ---The matcher referenceType() matches the type ---int & of b , the type int && of ---c, the type ---auto & d, and the type ---auto && of e and f. --+referenceType() matches the types of b, c, d, e, and f. -- -- -- --@@ -3679,17 +2781,10 @@ -- Given -- template <typename T> -- void F(T t) { --- T local; -- int i = 1 + t; -- } --- void f() { --- F(0); --- } --- -- ---The matcher varDecl(hasType(substTemplateTypeParmType())) ---matches T t and T local for the substituted template type ---int in the instantiation of F . --+substTemplateTypeParmType() matches the type of 't' but not '1' -- -- -- --@@ -3697,18 +2792,14 @@ --
Matches tag types (record and enum types).
-- 
-- Given
---  enum E { Ok };
--+  enum E {};
--   class C {};
-- 
--   E e;
--   C c;
-- 
---
---The matcher tagType() matches the type
---enum E of variable e and the type
---class C three times, once for the type
---of the variable c , once for the type of the class definition and once of
---the type in the injected class name.
--+tagType() matches the type of the variable declarations of both e
--+and c.
-- 
-- -- --@@ -3719,38 +2810,25 @@ -- template <typename T> -- class C { }; -- --- template class C<int>; --- C<int> intvar; --- C<char> charvar; --- --+ template class C<int>; // A --+ C<char> var; // B -- ---The matcher templateSpecializationType() matches the type ---C<int> of the explicit instantiation in A and the ---type C<char> of the variable declaration in ---B. --+templateSpecializationType() matches the type of the explicit --+instantiation in A and the type of the variable declaration in B. -- -- -- -- Matcher<Type>templateTypeParmTypeMatcher<TemplateTypeParmType>... --
Matches template type parameter types.
-- 
---Given
--+Example matches T, but not int.
--+    (matcher = templateTypeParmType())
--   template <typename T> void f(int i);
---
---The matcher templateTypeParmType() matches T,
---but does not match int.
-- 
-- -- -- Matcher<Type>typeMatcher<Type>... --
Matches Types in the clang AST.
---
---Given
---  const int b = 1;
---
---The matcher varDecl(hasType(type().bind("type")))
---matches const int b = 1, with type()
---matching int.
-- 
-- -- --@@ -3759,22 +2837,18 @@ -- -- Given -- typedef int X; --- X x = 0; ---The matcher typedefType() ---matches X. --+typedefType() --+ matches "typedef int X" -- -- -- -- Matcher<Type>unaryTransformTypeMatcher<UnaryTransformType>... --
Matches types nodes representing unary type transformations.
-- 
---Given
---  template <typename T> struct A {
---    typedef __underlying_type(T) type;
---  };
---
---The matcher unaryTransformType()
---matches __underlying_type(T)
--+Given:
--+  typedef __underlying_type(T) type;
--+unaryTransformType()
--+  matches "__underlying_type(T)"
-- 
-- -- --@@ -3786,9 +2860,7 @@ -- using a::S; -- S s; -- --- ---The matcher usingType() matches the type a::S ---of the variable declaration of s. --+usingType() matches the type of the variable declaration of s. -- -- -- --@@ -3798,12 +2870,12 @@ -- -- Given -- void f() { --- int a[] = { 2, 3 }; --+ int a[] = { 2, 3 } -- int b[42]; -- int c[a[0]]; -- } ---The matcher variableArrayType() ---int[a[0]] --+variableArrayType() --+ matches "int c[a[0]]" -- -- -- --@@ -3827,12 +2899,6 @@ --
Matches if all given matchers match.
-- 
-- Usable as: Any Matcher
---
---  int v0 = 0;
---  int v1 = 1;
---
---The matcher varDecl(allOf(hasName("v0"), hasType(isInteger())))
---matches int v0 = 0.
-- 
-- -- --@@ -3840,13 +2906,6 @@ --
Matches if any of the given matchers matches.
-- 
-- Usable as: Any Matcher
---
---  char v0 = 'a';
---  int v1 = 1;
---  float v2 = 2.0;
---
---The matcher varDecl(anyOf(hasName("v0"), hasType(isInteger())))
---matches char v0 = 'a' and int v1 = 1.
-- 
-- -- --@@ -3857,11 +2916,11 @@ -- additional constraint. This will often be used with an explicit conversion -- to an internal::Matcher<> type such as TypeMatcher. -- ---Given --+Example: DeclarationMatcher(anything()) matches all declarations, e.g., --+"int* p" and "void f()" in -- int* p; -- void f(); ---The matcher decl(anything()) ---matches int* p and void f(). --+ -- Usable as: Any Matcher -- -- --@@ -3870,25 +2929,21 @@ --
Matches any of the NodeMatchers with InnerMatchers nested within
-- 
-- Given
---  void f() {
---    if (true);
---    for (; true; );
---  }
---
---
---The matcher stmt(mapAnyOf(ifStmt, forStmt).with(
---    hasCondition(cxxBoolLiteral(equals(true)))
---    )),
---which is equivalent to
---stmt(anyOf(
---    ifStmt(hasCondition(cxxBoolLiteral(equals(true)))).bind("trueCond"),
---    forStmt(hasCondition(cxxBoolLiteral(equals(true)))).bind("trueCond")
---    )),
---matches if (true); and for (; true; );.
--+  if (true);
--+  for (; true; );
--+with the matcher
--+  mapAnyOf(ifStmt, forStmt).with(
--+    hasCondition(cxxBoolLiteralExpr(equals(true)))
--+    ).bind("trueCond")
--+matches the if and the for. It is equivalent to:
--+  auto trueCond = hasCondition(cxxBoolLiteralExpr(equals(true)));
--+  anyOf(
--+    ifStmt(trueCond).bind("trueCond"),
--+    forStmt(trueCond).bind("trueCond")
--+    );
-- 
-- The with() chain-call accepts zero or more matchers which are combined
-- as-if with allOf() in each of the node matchers.
---
-- Usable as: Any Matcher
-- 
-- --@@ -3896,13 +2951,10 @@ -- Matcher<*>unlessMatcher<*> --
Matches if the provided matcher does not match.
-- 
---Given
--+Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
--   class X {};
--   class Y {};
-- 
---The matcher cxxRecordDecl(unless(hasName("X")))
---matches Y
---
-- Usable as: Any Matcher
-- 
-- --@@ -3910,20 +2962,6 @@ -- Matcher<Attr>isImplicit --
Matches an entity that has been implicitly added by the compiler (e.g.
-- implicit default/copy constructors).
---
---Given
---  struct S {};
---  void f(S obj) {
---    S copy = obj;
---    [&](){ return copy; };
---  }
---
---
---The matcher cxxConstructorDecl(isImplicit(), isCopyConstructor())
---matches the implicit copy constructor of S.
---The matcher lambdaExpr(forEachLambdaCapture(
---    lambdaCapture(isImplicit()))) matches [&](){ return copy; },
---because it implicitly captures copy .
-- 
-- -- --@@ -3931,26 +2969,9 @@ --
Matches operator expressions (binary or unary) that have any of the
-- specified names.
-- 
---It provides a compact way of writing if an operator has any of the specified
---names:
---The matcher
--    hasAnyOperatorName("+", "-")
---Is equivalent to
---   hasOperatorName("-"))}
---
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
---
---void bar(bool a, bool b) {
---  a && b;
--- }
---
---The matcher binaryOperator(hasAnyOperatorName("||", "&&"))
---matches a || b and a && b.
---The matcher unaryOperator(hasAnyOperatorName("-", "!"))
---matches !(a || b).
--+ Is equivalent to
--+   anyOf(hasOperatorName("+"), hasOperatorName("-"))
-- 
-- -- --@@ -3958,62 +2979,43 @@ --
Matches the operator Name of operator expressions and fold expressions
-- (binary or unary).
-- 
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
--+Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
--+  !(a || b)
-- 
---The matcher binaryOperator(hasOperatorName("||"))
---matches a || b
---
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(hasOperatorName("+")))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--   }
---
---The matcher cxxFoldExpr(hasOperatorName("+"))
--- matches (0 + ... + args).
-- 
-- -- -- Matcher<BinaryOperator>isAssignmentOperator --
Matches all kinds of assignment operators.
-- 
---Given
---void foo(int a, int b) {
--+Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
--   if (a == b)
--     a += b;
---}
---The matcher binaryOperator(isAssignmentOperator())
---matches a += b.
-- 
---Given
--+Example 2: matches s1 = s2
--+           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
--   struct S { S& operator=(const S&); };
--   void x() { S s1, s2; s1 = s2; }
---
---The matcher cxxOperatorCallExpr(isAssignmentOperator())
---matches s1 = s2.
-- 
-- -- -- Matcher<BinaryOperator>isComparisonOperator --
Matches comparison operators.
-- 
---Given
---void foo(int a, int b) {
--+Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
--   if (a == b)
--     a += b;
---}
---The matcher binaryOperator(isComparisonOperator())
---matches a == b
-- 
---Given
--+Example 2: matches s1 < s2
--+           (matcher = cxxOperatorCallExpr(isComparisonOperator()))
--   struct S { bool operator<(const S& other); };
--   void x(S s1, S s2) { bool b1 = s1 < s2; }
---
---The matcher cxxOperatorCallExpr(isComparisonOperator())
---matches s1 < s2
-- 
-- -- --@@ -4021,25 +3023,16 @@ --
Matches private C++ declarations and C++ base specifers that specify private
-- inheritance.
-- 
---Given
--+Examples:
--   class C {
--   public:    int a;
--   protected: int b;
---  private:   int c;
--+  private:   int c; // fieldDecl(isPrivate()) matches 'c'
--   };
-- 
---The matcher fieldDecl(isPrivate())
---matches c.
---
--   struct Base {};
---  struct Derived1 : private Base {}; // Base
---  class Derived2 : Base {}; // Base
---
---The matcher
---cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(isPrivate()).bind("base")))
---matches Derived1 and Derived2, with
---cxxBaseSpecifier(isPrivate()) matching
---Base.
--+  struct Derived1 : private Base {}; // matches 'Base'
--+  class Derived2 : Base {}; // matches 'Base'
-- 
-- -- --@@ -4047,24 +3040,15 @@ --
Matches protected C++ declarations and C++ base specifers that specify
-- protected inheritance.
-- 
---Given
--+Examples:
--   class C {
--   public:    int a;
---  protected: int b;
--+  protected: int b; // fieldDecl(isProtected()) matches 'b'
--   private:   int c;
--   };
-- 
---The matcher fieldDecl(isProtected())
---matches b.
---
--   class Base {};
---  class Derived : protected Base {};
---
---The matcher
---cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(isProtected()).bind("base")))
---matches Derived, with
---cxxBaseSpecifier(isProtected()) matching
---Base.
--+  class Derived : protected Base {}; // matches 'Base'
-- 
-- -- --@@ -4072,26 +3056,16 @@ --
Matches public C++ declarations and C++ base specifers that specify public
-- inheritance.
-- 
---Given
--+Examples:
--   class C {
---  public:    int a;
--+  public:    int a; // fieldDecl(isPublic()) matches 'a'
--   protected: int b;
--   private:   int c;
--   };
-- 
---The matcher fieldDecl(isPublic())
---matches a.
---
---Given
--   class Base {};
---  class Derived1 : public Base {};
---  struct Derived2 : Base {};
---
---The matcher
---cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(isPublic()).bind("base")))
---matches Derived1 and Derived2,
---with cxxBaseSpecifier(isPublic()) matching
---public Base and Base.
--+  class Derived1 : public Base {}; // matches 'Base'
--+  struct Derived2 : Base {}; // matches 'Base'
-- 
-- -- --@@ -4099,23 +3073,16 @@ --
Matches declarations of virtual methods and C++ base specifers that specify
-- virtual inheritance.
-- 
---Given
--+Example:
--   class A {
--    public:
--     virtual void x(); // matches x
--   };
-- 
---The matcher cxxMethodDecl(isVirtual())
---matches x.
---
---Given
---  struct Base {};
---  struct DirectlyDerived : virtual Base {}; // matches Base
---  struct IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
---
---The matcher
---cxxRecordDecl(hasDirectBase(cxxBaseSpecifier(isVirtual())))
---matches DirectlyDerived.
--+Example:
--+  class Base {};
--+  class DirectlyDerived : virtual Base {}; // matches Base
--+  class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
-- 
-- Usable as: Matcher<CXXMethodDecl>, Matcher<CXXBaseSpecifier>
-- 
--@@ -4129,27 +3096,22 @@ --
Matches literals that are equal to the given value of type ValueT.
-- 
-- Given
---void f(char, bool, double, int);
---void foo() {
--   f('false, 3.14, 42);
---}
---
---The matcher characterLiteral(equals(0U)) matches 'The matchers cxxBoolLiteral(equals(false)) and
---cxxBoolLiteral(equals(0)) match false.
---The matcher floatLiteral(equals(3.14)) matches 3.14.
---The matcher integerLiteral(equals(42)) matches 42.
--+characterLiteral(equals(0))
--+  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
--+  match false
--+floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
--+  match 3.14
--+integerLiteral(equals(42))
--+  matches 42
-- 
-- Note that you cannot directly match a negative numeric literal because the
-- minus sign is not part of the literal: It is a unary operator whose operand
-- is the positive numeric literal. Instead, you must use a unaryOperator()
-- matcher to match the minus sign:
-- 
---Given
---  int val = -1;
---
---The matcher unaryOperator(hasOperatorName("-"),
---              hasUnaryOperand(integerLiteral(equals(1))))
---matches -1.
--+unaryOperator(hasOperatorName("-"),
--+              hasUnaryOperand(integerLiteral(equals(13))))
-- 
-- Usable as: Matcher<CharacterLiteral>, Matcher<CXXBoolLiteralExpr>,
--            Matcher<FloatingLiteral>, Matcher<IntegerLiteral>
--@@ -4168,15 +3130,14 @@
-- 
Matches a C++ catch statement that has a catch-all handler.
-- 
-- Given
---  void foo() {
---    try {}
---    catch (int) {}
---    catch (...) {}
--+  try {
--+    // ...
--+  } catch (int) {
--+    // ...
--+  } catch (...) {
--+    // ...
--   }
---
---The matcher cxxCatchStmt(isCatchAll())
---matches catch (...) {}
---but does not match catch(int)
--+cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
-- 
-- -- --@@ -4184,15 +3145,12 @@ --
Checks that a call expression or a constructor call expression has at least
-- the specified number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) and g(0, 0, 0)
--+(matcher = callExpr(argumentCountAtLeast(2)))
--   void f(int x, int y);
--   void g(int x, int y, int z);
---  void foo() {
---    f(0, 0);
---    g(0, 0, 0);
---  }
---The matcher callExpr(argumentCountAtLeast(2))
---matches f(0, 0) and g(0, 0, 0)
--+  f(0, 0);
--+  g(0, 0, 0);
-- 
-- -- --@@ -4200,39 +3158,14 @@ --
Checks that a call expression or a constructor call expression has
-- a specific number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
--   void f(int x, int y);
---  void foo() {
---    f(0, 0);
---  }
---The matcher callExpr(argumentCountIs(2))
---matches f(0, 0)
--+  f(0, 0);
-- 
-- -- -- Matcher<CXXConstructExpr>isListInitialization --
Matches a constructor call expression which uses list initialization.
---
---Given
---  namespace std {
---    template <typename T>
---    class initializer_list {
---      const T* begin;
---      const T* end;
---    };
---  }
---  template <typename T> class vector {
---    public: vector(std::initializer_list<T>) {}
---  };
---
---  vector<int> a({ 1, 2, 3 });
---  vector<int> b = { 4, 5 };
---  int c[] = { 6, 7 };
---  struct pair { int x; int y; };
---  pair d = { 8, 9 };
---
---The matcher cxxConstructExpr(isListInitialization())
---matches { 4, 5 }.
-- 
-- -- --@@ -4242,15 +3175,11 @@ -- -- Given -- void foo() { --- struct Foo { --- double x; --- }; --- auto Val = Foo(); --+ struct point { double x; double y; }; --+ point pt[2] = { { 1.0, 2.0 } }; -- } --- ---The matcher ---cxxConstructExpr(requiresZeroInitialization()) ---matches Foo() because the x member has to be zero initialized. --+initListExpr(has(cxxConstructExpr(requiresZeroInitialization())) --+will match the implicit array filler for pt[1]. --
-- -- --@@ -4263,10 +3192,7 @@ -- S(const S &); // #2 -- S(S &&); // #3 -- }; --- ---The matcher cxxConstructorDecl(isCopyConstructor()) ---matches S(const S &), ---but does not match S() or S(S &&). --+cxxConstructorDecl(isCopyConstructor()) will match #2, but not #1 or #3. -- -- -- --@@ -4279,10 +3205,7 @@ -- S(const S &); // #2 -- S(S &&); // #3 -- }; --- ---The matcher cxxConstructorDecl(isDefaultConstructor()) ---matches S() ---but does not match S(const S &); or S(S &&);. --+cxxConstructorDecl(isDefaultConstructor()) will match #1, but not #2 or #3. -- -- -- --@@ -4296,10 +3219,8 @@ -- S(S &&) : S() {} // #3 -- }; -- S::S() : S(0) {} // #4 --- ---The matcher cxxConstructorDecl(isDelegatingConstructor()) ---matches S(S &&) : S() {} and S::S() : S(0) {}, ---but does not match S() or S(int). --+cxxConstructorDecl(isDelegatingConstructor()) will match #3 and #4, but not --+#1 or #2. -- -- -- --@@ -4315,27 +3236,15 @@ -- explicit S(double); // #2 -- operator int(); // #3 -- explicit operator bool(); // #4 --- explicit(false) S(bool); // # 7 --- explicit(true) S(char); // # 8 --- explicit(b) S(float); // # 9 --- }; --- S(int) -> S<true>; // #5 --- explicit S(double) -> S<false>; // #6 --- ---The matcher cxxConstructorDecl(isExplicit()) ---matches explicit S(double) ---and explicit(true) S(char) ---but does not match S(int);, explicit(false) S(bool); or ---explicit(b) S(float) ---The matcher cxxConversionDecl(isExplicit()) ---matches explicit operator bool() ---but does not match operator int(). ---The matcher cxxDeductionGuideDecl(isExplicit()) ---matches the deduction guide explicit S(double) -> S<false>, ---the implicit copy deduction candiate ---auto (double) -> S<b> and ---the implicitly generated deduction guide for explicit(true) S(char), ---but does not match S(int) -> S<true>. --+ explicit(false) S(bool) // # 7 --+ explicit(true) S(char) // # 8 --+ explicit(b) S(S) // # 9 --+ }; --+ S(int) -> S<true> // #5 --+ explicit S(double) -> S<false> // #6 --+cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9. --+cxxConversionDecl(isExplicit()) will match #4, but not #3. --+cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5. -- -- -- --@@ -4352,10 +3261,7 @@ -- S(const S &); // #2 -- S(S &&); // #3 -- }; --- ---The matcher cxxConstructorDecl(isMoveConstructor()) ---matches S(S &&) ---but does not match S(); or S(S &&); --+cxxConstructorDecl(isMoveConstructor()) will match #3, but not #1 or #2. -- -- -- --@@ -4371,27 +3277,15 @@ -- explicit S(double); // #2 -- operator int(); // #3 -- explicit operator bool(); // #4 --- explicit(false) S(bool); // # 7 --- explicit(true) S(char); // # 8 --- explicit(b) S(float); // # 9 --- }; --- S(int) -> S<true>; // #5 --- explicit S(double) -> S<false>; // #6 --- ---The matcher cxxConstructorDecl(isExplicit()) ---matches explicit S(double) ---and explicit(true) S(char) ---but does not match S(int);, explicit(false) S(bool); or ---explicit(b) S(float) ---The matcher cxxConversionDecl(isExplicit()) ---matches explicit operator bool() ---but does not match operator int(). ---The matcher cxxDeductionGuideDecl(isExplicit()) ---matches the deduction guide explicit S(double) -> S<false>, ---the implicit copy deduction candiate ---auto (double) -> S<b> and ---the implicitly generated deduction guide for explicit(true) S(char), ---but does not match S(int) -> S<true>. --+ explicit(false) S(bool) // # 7 --+ explicit(true) S(char) // # 8 --+ explicit(b) S(S) // # 9 --+ }; --+ S(int) -> S<true> // #5 --+ explicit S(double) -> S<false> // #6 --+cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9. --+cxxConversionDecl(isExplicit()) will match #4, but not #3. --+cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5. -- -- -- --@@ -4408,12 +3302,8 @@ -- struct E : B { -- E() : B() {} -- }; --- ---The matcher -- cxxConstructorDecl(hasAnyConstructorInitializer(isBaseInitializer())) ---matches E() : B() {} and D(int i) : I(i) {}. ---The constructor of D is matched, because it implicitly has a constructor ---initializer for B . --+ will match E(), but not match D(int). -- -- -- --@@ -4430,11 +3320,8 @@ -- struct E : B { -- E() : B() {} -- }; --- ---The matcher -- cxxConstructorDecl(hasAnyConstructorInitializer(isMemberInitializer())) --- will match D(int i) : I(i) {}, but not match E() : B() --- {}. --+ will match D(int), but not match E(). -- -- -- --@@ -4443,16 +3330,13 @@ -- code (as opposed to implicitly added by the compiler). -- -- Given --- struct Bar { explicit Bar(const char*); }; -- struct Foo { -- Foo() { } -- Foo(int) : foo_("A") { } --- Bar foo_{""}; --+ string foo_; -- }; --- ---The matcher ---cxxConstructorDecl(hasAnyConstructorInitializer(isWritten())) will ---match Foo(int) : foo_("A") { }, but not Foo() { } --+cxxConstructorDecl(hasAnyConstructorInitializer(isWritten())) --+ will match Foo(int), but not Foo() -- -- -- --@@ -4468,27 +3352,15 @@ -- explicit S(double); // #2 -- operator int(); // #3 -- explicit operator bool(); // #4 --- explicit(false) S(bool); // # 7 --- explicit(true) S(char); // # 8 --- explicit(b) S(float); // # 9 --- }; --- S(int) -> S<true>; // #5 --- explicit S(double) -> S<false>; // #6 --- ---The matcher cxxConstructorDecl(isExplicit()) ---matches explicit S(double) ---and explicit(true) S(char) ---but does not match S(int);, explicit(false) S(bool); or ---explicit(b) S(float) ---The matcher cxxConversionDecl(isExplicit()) ---matches explicit operator bool() ---but does not match operator int(). ---The matcher cxxDeductionGuideDecl(isExplicit()) ---matches the deduction guide explicit S(double) -> S<false>, ---the implicit copy deduction candiate ---auto (double) -> S<b> and ---the implicitly generated deduction guide for explicit(true) S(char), ---but does not match S(int) -> S<true>. --+ explicit(false) S(bool) // # 7 --+ explicit(true) S(char) // # 8 --+ explicit(b) S(S) // # 9 --+ }; --+ S(int) -> S<true> // #5 --+ explicit S(double) -> S<false> // #6 --+cxxConstructorDecl(isExplicit()) will match #2 and #8, but not #1, #7 or #9. --+cxxConversionDecl(isExplicit()) will match #4, but not #3. --+cxxDeductionGuideDecl(isExplicit()) will match #6, but not #5. -- -- -- --@@ -4510,9 +3382,7 @@ -- S<T> s; -- s.mem(); -- } --- ---The matcher cxxDependentScopeMemberExpr(hasMemberName("mem")) ---matches s.mem. --+cxxDependentScopeMemberExpr(hasMemberName("mem")) matches `s.mem()` -- -- -- --@@ -4531,25 +3401,14 @@ -- }; -- template <class T> -- class Z { --- void x() { --- this->m; --- this->t; --- this->t->m; --- } --- int m; --- T* t; --+ void x() { this->m; } -- }; --- ---The matcher memberExpr(isArrow()) ---matches this->x, x, a, ---this->b, this->m and two times this->t, ---once for the standalone member expression, and once for the member ---expression that later accesses m . ---Additionally, it does not match this->t->t. ---The matcher cxxDependentScopeMemberExpr(isArrow()) ---matches this->t->m, but not this->m or this->t. ---The matcher unresolvedMemberExpr(isArrow()) ---matches this->f<T>, f<T> --+memberExpr(isArrow()) --+ matches this->x, x, y.x, a, this->b --+cxxDependentScopeMemberExpr(isArrow()) --+ matches this->m --+unresolvedMemberExpr(isArrow()) --+ matches this->f<T>, f<T> -- -- -- --@@ -4573,20 +3432,19 @@ -- S<T> s; -- s.mem(); -- } --- ---The matcher cxxDependentScopeMemberExpr( --- hasObjectExpression(declRefExpr(hasType( --- elaboratedType(namesType(templateSpecializationType( --+The matcher --+@code --+cxxDependentScopeMemberExpr( --+ hasObjectExpression(declRefExpr(hasType(templateSpecializationType( -- hasDeclaration(classTemplateDecl(has(cxxRecordDecl(has( -- cxxMethodDecl(hasName("mem")).bind("templMem") -- ))))) --- ))) --- ))), --+ )))), -- memberHasSameNameAsBoundNode("templMem") ---) ---matches s.mem, with the inner matcher ---cxxMethodDecl(hasName("mem")) matching ---void mem() of the S template. --+ ) --+@endcode --+first matches and binds the @c mem member of the @c S template, then --+compares its name to the usage in @c s.mem() in the @c x function template -- -- -- --@@ -4594,29 +3452,23 @@ --
Matches the operator Name of operator expressions and fold expressions
-- (binary or unary).
-- 
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
---
---The matcher binaryOperator(hasOperatorName("||"))
---matches a || b
--+Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
--+  !(a || b)
-- 
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(hasOperatorName("+")))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--   }
---
---The matcher cxxFoldExpr(hasOperatorName("+"))
--- matches (0 + ... + args).
-- 
-- -- -- Matcher<CXXFoldExpr>isBinaryFold --
Matches binary fold expressions, i.e. fold expressions with an initializer.
-- 
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(isBinaryFold()))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--@@ -4626,17 +3478,14 @@
--   auto multiply(Args... args) {
--       return (args * ...);
--   }
---
---
---The matcher cxxFoldExpr(isBinaryFold())
---matches (0 + ... + args).
-- 
-- -- -- Matcher<CXXFoldExpr>isLeftFold --
Matches left-folding fold expressions.
-- 
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(isLeftFold()))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--@@ -4646,17 +3495,14 @@
--   auto multiply(Args... args) {
--       return (args * ... * 1);
--   }
---
---
---The matcher cxxFoldExpr(isLeftFold())
---matches (0 + ... + args).
-- 
-- -- -- Matcher<CXXFoldExpr>isRightFold --
Matches right-folding fold expressions.
-- 
---Given
--+Example matches `(args * ... * 1)`
--+    (matcher = cxxFoldExpr(isRightFold()))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--@@ -4666,10 +3512,6 @@
--   auto multiply(Args... args) {
--       return (args * ... * 1);
--   }
---
---
---The matcher cxxFoldExpr(isRightFold())
---matches (args * ... * 1).
-- 
-- -- --@@ -4677,7 +3519,8 @@ --
Matches unary fold expressions, i.e. fold expressions without an
-- initializer.
-- 
---Given
--+Example matches `(args * ...)`
--+    (matcher = cxxFoldExpr(isUnaryFold()))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--@@ -4687,10 +3530,6 @@
--   auto multiply(Args... args) {
--       return (args * ...);
--   }
---
---
---The matcher cxxFoldExpr(isUnaryFold())
---matches (args * ...), but not (0 + ... + args).
-- 
-- -- --@@ -4703,9 +3542,7 @@ -- void bar(); -- }; -- --- ---The matcher cxxMethodDecl(isConst()) ---matches foo but not bar --+cxxMethodDecl(isConst()) matches A::foo() but not A::bar() -- -- -- --@@ -4719,10 +3556,8 @@ -- A &operator=(A &&); -- }; -- --- ---The matcher cxxMethodDecl(isCopyAssignmentOperator()) ---matches A &operator=(const A &) ---but does not match A &operator=(A &&) --+cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not --+the second one. -- -- -- --@@ -4738,19 +3573,15 @@ -- int operator+(int); -- }; -- --- ---The matcher cxxMethodDecl(isExplicitObjectMemberFunction()) ---matches int operator-(this A, int) and ---void fun(this A &&self), ---but not static int operator()(int) or ---int operator+(int). --+cxxMethodDecl(isExplicitObjectMemberFunction()) matches the first two --+methods but not the last two. -- -- -- -- Matcher<CXXMethodDecl>isFinal --
Matches if the given method or class declaration is final.
-- 
---Given
--+Given:
--   class A final {};
-- 
--   struct B {
--@@ -4760,13 +3591,7 @@
--   struct C : B {
--     void f() final;
--   };
---
---The matcher cxxRecordDecl(isFinal())
---matches A,
---but does not match B or C.
---The matcher cxxMethodDecl(isFinal())
---matches void f() final in C ,
---but does not match virtual void f() in B .
--+matches A and C::f, but not B, C, or B::f
-- 
-- -- --@@ -4780,10 +3605,8 @@ -- A &operator=(A &&); -- }; -- --- ---The matcher cxxMethodDecl(isMoveAssignmentOperator()) ---matches A &operator=(A &&) ---but does not match A &operator=(const A &) --+cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not --+the first one. -- -- -- --@@ -4797,11 +3620,9 @@ -- }; -- class B : public A { -- public: --- void x() override; --+ virtual void x(); -- }; --- ---The matcher cxxMethodDecl(isOverride()) --- matches void x() override --+ matches B::x -- -- -- --@@ -4813,9 +3634,7 @@ -- public: -- virtual void x() = 0; -- }; --- ---The matcher cxxMethodDecl(isPure()) ---matches virtual void x() = 0 --+ matches A::x -- -- -- --@@ -4828,10 +3647,7 @@ -- S(const S &) = default; // #2 -- S(S &&) = delete; // #3 -- }; --- ---The matcher cxxConstructorDecl(isUserProvided()) ---will match S(), but not S &) = default} or ---&&) = delete} --+cxxConstructorDecl(isUserProvided()) will match #1, but not #2 or #3. -- -- -- --@@ -4839,23 +3655,16 @@ --
Matches declarations of virtual methods and C++ base specifers that specify
-- virtual inheritance.
-- 
---Given
--+Example:
--   class A {
--    public:
--     virtual void x(); // matches x
--   };
-- 
---The matcher cxxMethodDecl(isVirtual())
---matches x.
---
---Given
---  struct Base {};
---  struct DirectlyDerived : virtual Base {}; // matches Base
---  struct IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
---
---The matcher
---cxxRecordDecl(hasDirectBase(cxxBaseSpecifier(isVirtual())))
---matches DirectlyDerived.
--+Example:
--+  class Base {};
--+  class DirectlyDerived : virtual Base {}; // matches Base
--+  class IndirectlyDerived : DirectlyDerived, Base {}; // matches Base
-- 
-- Usable as: Matcher<CXXMethodDecl>, Matcher<CXXBaseSpecifier>
-- 
--@@ -4873,22 +3682,17 @@ -- public: -- void x(); -- }; --- ---The matcher cxxMethodDecl(isVirtualAsWritten()) ---matches virtual void x() of A, ---but does not match x()} of B . --+ matches A::x but not B::x -- -- -- -- Matcher<CXXNewExpr>isArray --
Matches array new expressions.
-- 
---Given
---  struct MyClass { int x; };
--+Given:
--   MyClass *p1 = new MyClass[10];
---
---The matcher cxxNewExpr(isArray())
---matches new MyClass[10].
--+cxxNewExpr(isArray())
--+  matches the expression 'new MyClass[10]'.
-- 
-- -- --@@ -4896,26 +3700,9 @@ --
Matches operator expressions (binary or unary) that have any of the
-- specified names.
-- 
---It provides a compact way of writing if an operator has any of the specified
---names:
---The matcher
--    hasAnyOperatorName("+", "-")
---Is equivalent to
---   hasOperatorName("-"))}
---
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
---
---void bar(bool a, bool b) {
---  a && b;
--- }
---
---The matcher binaryOperator(hasAnyOperatorName("||", "&&"))
---matches a || b and a && b.
---The matcher unaryOperator(hasAnyOperatorName("-", "!"))
---matches !(a || b).
--+ Is equivalent to
--+   anyOf(hasOperatorName("+"), hasOperatorName("-"))
-- 
-- -- --@@ -4926,30 +3713,6 @@ -- "operator" prefix: e.g. "<<". -- -- hasAnyOverloadedOperatorName("+", "-") --- ---Given --- struct Point { double x; double y; }; --- Point operator+(const Point&, const Point&); --- Point operator-(const Point&, const Point&); --- --- Point sub(Point a, Point b) { --- return b - a; --- } --- --- ---The matcher functionDecl(hasAnyOverloadedOperatorName("+", "-")), ---which is equivalent to ---functionDecl(anyOf(hasAnyOverloadedOperatorName("+"), ---hasOverloadedOperatorName("-"))), ---matches Point operator+(const Point&, const Point&) and ---Point operator-(const Point&, const Point&). ---The matcher ---cxxOperatorCallExpr(hasAnyOverloadedOperatorName("+", "-")), ---which is equivalent to ---cxxOperatorCallExpr(anyOf(hasOverloadedOperatorName("+"), ---hasOverloadedOperatorName("-"))), ---matches b - a. --- -- Is equivalent to -- anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-")) -- --@@ -4959,22 +3722,15 @@ --
Matches the operator Name of operator expressions and fold expressions
-- (binary or unary).
-- 
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
--+Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
--+  !(a || b)
-- 
---The matcher binaryOperator(hasOperatorName("||"))
---matches a || b
---
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(hasOperatorName("+")))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--   }
---
---The matcher cxxFoldExpr(hasOperatorName("+"))
--- matches (0 + ... + args).
-- 
-- -- --@@ -4984,19 +3740,16 @@ -- Matches overloaded operator names specified in strings without the -- "operator" prefix: e.g. "<<". -- ---Given --- struct A { int operator*(); }; --+Given: --+ class A { int operator*(); }; -- const A &operator<<(const A &a, const A &b); --- void f(A a) { --- a << a; // <-- This matches --- } --- --+ A a; --+ a << a; // <-- This matches -- ---The matcher cxxOperatorCallExpr(hasOverloadedOperatorName("<<")) ---matches a << a. ---The matcher --+cxxOperatorCallExpr(hasOverloadedOperatorName("<<"))) matches the --+specified line and -- cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*"))) ---matches struct A { int operator*(); }. --+matches the declaration of A. -- -- Usable as: Matcher<CXXOperatorCallExpr>, Matcher<FunctionDecl> -- --@@ -5005,104 +3758,47 @@ -- Matcher<CXXOperatorCallExpr>isAssignmentOperator --
Matches all kinds of assignment operators.
-- 
---Given
---void foo(int a, int b) {
--+Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
--   if (a == b)
--     a += b;
---}
---The matcher binaryOperator(isAssignmentOperator())
---matches a += b.
-- 
---Given
--+Example 2: matches s1 = s2
--+           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
--   struct S { S& operator=(const S&); };
--   void x() { S s1, s2; s1 = s2; }
---
---The matcher cxxOperatorCallExpr(isAssignmentOperator())
---matches s1 = s2.
-- 
-- -- -- Matcher<CXXOperatorCallExpr>isComparisonOperator --
Matches comparison operators.
-- 
---Given
---void foo(int a, int b) {
--+Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
--   if (a == b)
--     a += b;
---}
---The matcher binaryOperator(isComparisonOperator())
---matches a == b
-- 
---Given
--+Example 2: matches s1 < s2
--+           (matcher = cxxOperatorCallExpr(isComparisonOperator()))
--   struct S { bool operator<(const S& other); };
--   void x(S s1, S s2) { bool b1 = s1 < s2; }
---
---The matcher cxxOperatorCallExpr(isComparisonOperator())
---matches s1 < s2
-- 
-- -- -- Matcher<CXXRecordDecl>hasDefinition --
Matches a class declaration that is defined.
-- 
---Given
--+Example matches x (matcher = cxxRecordDecl(hasDefinition()))
-- class x {};
-- class y;
---
---The matcher cxxRecordDecl(hasDefinition())
---matches class x {}
-- 
-- -- -- Matcher<CXXRecordDecl>isDerivedFromstd::string BaseName --
Overloaded method as shortcut for isDerivedFrom(hasName(...)).
---
---Matches C++ classes that are directly or indirectly derived from a class
---matching Base, or Objective-C classes that directly or indirectly
---subclass a class matching Base.
---
---Note that a class is not considered to be derived from itself.
---
---Example matches Y, Z, C (Base == hasName("X"))
---  class X {};
---  class Y : public X {};  // directly derived
---  class Z : public Y {};  // indirectly derived
---  typedef X A;
---  typedef A B;
---  class C : public B {};  // derived from a typedef of X
---
---  class Foo {};
---  typedef Foo Alias;
---  class Bar : public Alias {};  // derived from Alias, which is a
---                                // typedef of Foo
---
---
---The matcher cxxRecordDecl(isDerivedFrom("X"))
---matches Y, Z and C.
---The matcher cxxRecordDecl(isDerivedFrom("Foo"))
---matches Bar.
---
---In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
---  @interface NSObject @end
---  @interface Bar : NSObject @end
---
---
---Usable as: Matcher<CXXRecordDecl>, Matcher<ObjCInterfaceDecl>
-- 
-- -- -- Matcher<CXXRecordDecl>isDirectlyDerivedFromstd::string BaseName --
Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
---
---Given
---  struct Base {};
---  struct DirectlyDerived : public Base {};
---  struct IndirectlyDerived : public DirectlyDerived {};
---
---
---The matcher cxxRecordDecl(isDirectlyDerivedFrom("Base"))
---matches DirectlyDerived, but not
---IndirectlyDerived.
-- 
-- -- --@@ -5113,9 +3809,8 @@ -- Given -- template<typename T> void A(T t) { } -- template<> void A(int N) { } --- ---The matcher functionDecl(isExplicitTemplateSpecialization()) --- matches the specialization template<> void A(int N) { }. --+functionDecl(isExplicitTemplateSpecialization()) --+ matches the specialization A<int>(). -- -- Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl> -- --@@ -5124,7 +3819,7 @@ -- Matcher<CXXRecordDecl>isFinal --
Matches if the given method or class declaration is final.
-- 
---Given
--+Given:
--   class A final {};
-- 
--   struct B {
--@@ -5134,46 +3829,24 @@
--   struct C : B {
--     void f() final;
--   };
---
---The matcher cxxRecordDecl(isFinal())
---matches A,
---but does not match B or C.
---The matcher cxxMethodDecl(isFinal())
---matches void f() final in C ,
---but does not match virtual void f() in B .
--+matches A and C::f, but not B, C, or B::f
-- 
-- -- -- Matcher<CXXRecordDecl>isLambda --
Matches the generated class of lambda expressions.
-- 
---Given
--+Given:
--   auto x = []{};
-- 
---
---The matcher varDecl(hasType(cxxRecordDecl(isLambda())))
---matches auto x = []{}.
--+cxxRecordDecl(isLambda()) matches the implicit class declaration of
--+decltype(x)
-- 
-- -- -- Matcher<CXXRecordDecl>isSameOrDerivedFromstd::string BaseName ---
Similar to isDerivedFrom(), but also matches classes that directly
---match Base.
---Overloaded method as shortcut for
--+
Overloaded method as shortcut for
-- isSameOrDerivedFrom(hasName(...)).
---
---Given
---  class X {};
---  class Y : public X {};  // directly derived
---  class Z : public Y {};  // indirectly derived
---  typedef X A;
---  typedef A B;
---  class C : public B {};  // derived from a typedef of X
---
---The matcher
---cxxRecordDecl(isSameOrDerivedFrom("X"), isDefinition())
---matches class X {}, class Y : public X {},
---class Z : public Y {} and class C : public B {}.
-- 
-- -- --@@ -5182,36 +3855,18 @@ -- member variable template instantiations. -- -- Given --- template <typename T> class X {}; --- class A {}; --- X<A> x; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches class X<class A>. --- template <typename T> class X {}; --- class A {}; --- template class X<A>; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches template class X<A> --- template <typename T> class X {}; --- class A {}; --- extern template class X<A>; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches extern template class X<A> --+ template <typename T> class X {}; class A {}; X<A> x; --+or --+ template <typename T> class X {}; class A {}; template class X<A>; --+or --+ template <typename T> class X {}; class A {}; extern template class X<A>; --+cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) --+ matches the template instantiation of X<A>. -- -- But given --- template <typename T> class X {}; --- class A {}; --- template <> class X<A> {}; --- X<A> x; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) --+ template <typename T> class X {}; class A {}; --+ template <> class X<A> {}; X<A> x; --+cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) -- does not match, as X<A> is an explicit template specialization. -- -- Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl> --@@ -5222,26 +3877,9 @@ --
Matches operator expressions (binary or unary) that have any of the
-- specified names.
-- 
---It provides a compact way of writing if an operator has any of the specified
---names:
---The matcher
--    hasAnyOperatorName("+", "-")
---Is equivalent to
---   hasOperatorName("-"))}
---
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
---
---void bar(bool a, bool b) {
---  a && b;
--- }
---
---The matcher binaryOperator(hasAnyOperatorName("||", "&&"))
---matches a || b and a && b.
---The matcher unaryOperator(hasAnyOperatorName("-", "!"))
---matches !(a || b).
--+ Is equivalent to
--+   anyOf(hasOperatorName("+"), hasOperatorName("-"))
-- 
-- -- --@@ -5249,62 +3887,43 @@ --
Matches the operator Name of operator expressions and fold expressions
-- (binary or unary).
-- 
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
---
---The matcher binaryOperator(hasOperatorName("||"))
---matches a || b
--+Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
--+  !(a || b)
-- 
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(hasOperatorName("+")))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--   }
---
---The matcher cxxFoldExpr(hasOperatorName("+"))
--- matches (0 + ... + args).
-- 
-- -- -- Matcher<CXXRewrittenBinaryOperator>isAssignmentOperator --
Matches all kinds of assignment operators.
-- 
---Given
---void foo(int a, int b) {
--+Example 1: matches a += b (matcher = binaryOperator(isAssignmentOperator()))
--   if (a == b)
--     a += b;
---}
---The matcher binaryOperator(isAssignmentOperator())
---matches a += b.
-- 
---Given
--+Example 2: matches s1 = s2
--+           (matcher = cxxOperatorCallExpr(isAssignmentOperator()))
--   struct S { S& operator=(const S&); };
--   void x() { S s1, s2; s1 = s2; }
---
---The matcher cxxOperatorCallExpr(isAssignmentOperator())
---matches s1 = s2.
-- 
-- -- -- Matcher<CXXRewrittenBinaryOperator>isComparisonOperator --
Matches comparison operators.
-- 
---Given
---void foo(int a, int b) {
--+Example 1: matches a == b (matcher = binaryOperator(isComparisonOperator()))
--   if (a == b)
--     a += b;
---}
---The matcher binaryOperator(isComparisonOperator())
---matches a == b
-- 
---Given
--+Example 2: matches s1 < s2
--+           (matcher = cxxOperatorCallExpr(isComparisonOperator()))
--   struct S { bool operator<(const S& other); };
--   void x(S s1, S s2) { bool b1 = s1 < s2; }
---
---The matcher cxxOperatorCallExpr(isComparisonOperator())
---matches s1 < s2
-- 
-- -- --@@ -5312,15 +3931,12 @@ --
Checks that a call expression or a constructor call expression has at least
-- the specified number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) and g(0, 0, 0)
--+(matcher = callExpr(argumentCountAtLeast(2)))
--   void f(int x, int y);
--   void g(int x, int y, int z);
---  void foo() {
---    f(0, 0);
---    g(0, 0, 0);
---  }
---The matcher callExpr(argumentCountAtLeast(2))
---matches f(0, 0) and g(0, 0, 0)
--+  f(0, 0);
--+  g(0, 0, 0);
-- 
-- -- --@@ -5328,13 +3944,9 @@ --
Checks that a call expression or a constructor call expression has
-- a specific number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
--   void f(int x, int y);
---  void foo() {
---    f(0, 0);
---  }
---The matcher callExpr(argumentCountIs(2))
---matches f(0, 0)
--+  f(0, 0);
-- 
-- -- --@@ -5342,15 +3954,12 @@ --
Checks that a call expression or a constructor call expression has at least
-- the specified number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) and g(0, 0, 0)
--+(matcher = callExpr(argumentCountAtLeast(2)))
--   void f(int x, int y);
--   void g(int x, int y, int z);
---  void foo() {
---    f(0, 0);
---    g(0, 0, 0);
---  }
---The matcher callExpr(argumentCountAtLeast(2))
---matches f(0, 0) and g(0, 0, 0)
--+  f(0, 0);
--+  g(0, 0, 0);
-- 
-- -- --@@ -5358,20 +3967,16 @@ --
Checks that a call expression or a constructor call expression has
-- a specific number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
--   void f(int x, int y);
---  void foo() {
---    f(0, 0);
---  }
---The matcher callExpr(argumentCountIs(2))
---matches f(0, 0)
--+  f(0, 0);
-- 
-- -- -- Matcher<CallExpr>usesADL --
Matches call expressions which were resolved using ADL.
-- 
---Given
--+Example matches y(x) but not y(42) or NS::y(x).
--   namespace NS {
--     struct X {};
--     void y(X);
--@@ -5387,20 +3992,15 @@
--     using NS::y;
--     y(x); // Found by both unqualified lookup and ADL, doesn't match
--    }
---
---
---The matcher callExpr(usesADL())
---matches y(x), but not y(42) or NS::y(x).
-- 
-- -- -- Matcher<CastExpr>hasCastKindCastKind Kind --
Matches casts that has a given cast kind.
-- 
---Given
--+Example: matches the implicit cast around 0
--+(matcher = castExpr(hasCastKind(CK_NullToPointer)))
--   int *p = 0;
---The matcher castExpr(hasCastKind(CK_NullToPointer))
---matches the implicit cast around 0
-- 
-- If the matcher is use from clang-query, CastKind parameter
-- should be passed as a quoted string. e.g., hasCastKind("CK_NullToPointer").
--@@ -5415,27 +4015,22 @@
-- 
Matches literals that are equal to the given value of type ValueT.
-- 
-- Given
---void f(char, bool, double, int);
---void foo() {
--   f('false, 3.14, 42);
---}
---
---The matcher characterLiteral(equals(0U)) matches 'The matchers cxxBoolLiteral(equals(false)) and
---cxxBoolLiteral(equals(0)) match false.
---The matcher floatLiteral(equals(3.14)) matches 3.14.
---The matcher integerLiteral(equals(42)) matches 42.
--+characterLiteral(equals(0))
--+  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
--+  match false
--+floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
--+  match 3.14
--+integerLiteral(equals(42))
--+  matches 42
-- 
-- Note that you cannot directly match a negative numeric literal because the
-- minus sign is not part of the literal: It is a unary operator whose operand
-- is the positive numeric literal. Instead, you must use a unaryOperator()
-- matcher to match the minus sign:
-- 
---Given
---  int val = -1;
---
---The matcher unaryOperator(hasOperatorName("-"),
---              hasUnaryOperand(integerLiteral(equals(1))))
---matches -1.
--+unaryOperator(hasOperatorName("-"),
--+              hasUnaryOperand(integerLiteral(equals(13))))
-- 
-- Usable as: Matcher<CharacterLiteral>, Matcher<CXXBoolLiteralExpr>,
--            Matcher<FloatingLiteral>, Matcher<IntegerLiteral>
--@@ -5456,10 +4051,8 @@
-- Given
--   template<typename T> struct C {};
--   C<int> c;
---
---The matcher
-- classTemplateSpecializationDecl(templateArgumentCountIs(1))
---matches struct C<int>.
--+  matches C<int>.
-- 
-- -- --@@ -5468,11 +4061,9 @@ -- child statements. -- -- Example: Given ---void foo() { -- { for (;;) {} } ---} ---The matcher compoundStmt(statementCountIs(0)) ---{} --+compoundStmt(statementCountIs(0))) --+ matches '{}' -- but does not match the outer compound statement. --
-- --@@ -5487,11 +4078,10 @@ -- char *s = "abcd"; -- wchar_t *ws = L"abcd"; -- char *w = "a"; --- ---The matcher constantArrayType(hasSize(42)) ---matches int[42] twice. ---The matcher stringLiteral(hasSize(4)) ---matches "abcd" and L"abcd". --+constantArrayType(hasSize(42)) --+ matches "int a[42]" and "int b[2 * 21]" --+stringLiteral(hasSize(4)) --+ matches "abcd", L"abcd" --
-- -- --@@ -5499,15 +4089,12 @@ --
Matches declaration statements that contain a specific number of
-- declarations.
-- 
---Given
---  void foo() {
---    int a, b;
---    int c;
---    int d = 2, e;
---  }
---The matcher declStmt(declCountIs(2))
---matches int a, b; and int d = 2, e;,
---but does not match int c;
--+Example: Given
--+  int a, b;
--+  int c;
--+  int d = 2, e;
--+declCountIs(2)
--+  matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
-- 
-- -- --@@ -5518,11 +4105,10 @@ -- -- Given -- class X { int a; int b; }; --- ---The matcher cxxRecordDecl( --+cxxRecordDecl( -- has(fieldDecl(hasName("a"), hasType(type().bind("t")))), -- has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) --- matches X, as a and b have the same type. --+ matches the class X, as a and b have the same type. -- -- Note that when multiple matches are involved via forEach* matchers, -- equalsBoundNodes acts as a filter. --@@ -5546,13 +4132,10 @@ --
Matches declaration that has a given attribute.
-- 
-- Given
---  __attribute__((device)) void f() {}
---
---The matcher decl(hasAttr(clang::attr::CUDADevice))
---matches f.
---If the matcher is used from clang-query, attr::Kind
---parameter should be passed as a quoted string. e.g.,
---hasAttr("attr::CUDADevice").
--+  __attribute__((device)) void f() { ... }
--+decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
--+f. If the matcher is used from clang-query, attr::Kind parameter should be
--+passed as a quoted string. e.g., hasAttr("attr::CUDADevice").
-- 
-- -- --@@ -5561,15 +4144,6 @@ -- Does not match if only part of the statement is expanded from that macro or -- if different parts of the statement are expanded from different -- appearances of the macro. --- ---Given --- #define A 0 --- #define B A --- int c = B; --- ---The matcher integerLiteral(isExpandedFromMacro("A")) ---matches the literal expanded at the initializer B of the variable ---c . -- -- -- --@@ -5577,25 +4151,12 @@ --
Matches AST nodes that were expanded within files whose name is
-- partially matching a given regex.
-- 
---Given the headers Y.h
---  #pragma once
---  typedef int my_y_int;
---and X.h
---  #pragma once
---  typedef int my_x_int;
---and the source code
---  #include "X.h"
---  #include "Y.h"
---  typedef int my_main_file_int;
---  my_main_file_int a = 0;
---  my_x_int b = 1;
---  my_y_int c = 2;
---
---The matcher
---typedefDecl(isExpansionInFileMatching("Y.h"))
---matches typedef int my_y_int,
---but does not match typedef int my_main_file_int or
---typedef int my_x_int.
--+Example matches Y but not X
--+    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
--+  #include "ASTMatcher.h"
--+  class X {};
--+ASTMatcher.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -5608,18 +4169,12 @@
-- Matcher<Decl>isExpansionInMainFile
-- 
Matches AST nodes that were expanded within the main-file.
-- 
---Given the header Y.h
---  #pragma once
---  typedef int my_header_int;
---and the source file
---  #include "Y.h"
---  typedef int my_main_file_int;
---  my_main_file_int a = 0;
---  my_header_int b = 1;
---
---The matcher typedefDecl(isExpansionInMainFile())
---matches typedef int my_main_file_int,
---but does not match typedef int my_header_int.
--+Example matches X but not Y
--+  (matcher = cxxRecordDecl(isExpansionInMainFile())
--+  #include <Y.h>
--+  class X {};
--+Y.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -5628,17 +4183,12 @@ -- Matcher<Decl>isExpansionInSystemHeader --
Matches AST nodes that were expanded within system-header-files.
-- 
---Given the header SystemHeader.h
---  #pragma once
---  int header();
---and the source code
--+Example matches Y but not X
--+    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
--   #include <SystemHeader.h>
---  static int main_file();
---
---
---The matcher functionDecl(isExpansionInSystemHeader())
---matches int header(),
---but does not match static int main_file().
--+  class X {};
--+SystemHeader.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -5647,20 +4197,6 @@ -- Matcher<Decl>isImplicit --
Matches an entity that has been implicitly added by the compiler (e.g.
-- implicit default/copy constructors).
---
---Given
---  struct S {};
---  void f(S obj) {
---    S copy = obj;
---    [&](){ return copy; };
---  }
---
---
---The matcher cxxConstructorDecl(isImplicit(), isCopyConstructor())
---matches the implicit copy constructor of S.
---The matcher lambdaExpr(forEachLambdaCapture(
---    lambdaCapture(isImplicit()))) matches [&](){ return copy; },
---because it implicitly captures copy .
-- 
-- -- --@@ -5678,14 +4214,11 @@ -- namespace { -- class vector {}; // #2 -- namespace foo { --- class vector {}; // #3 --+ class vector{}; // #3 -- } -- } --- ---The matcher cxxRecordDecl(hasName("vector"), --- isInAnonymousNamespace()) ---matches vector, ---twice per declaration at #1, #2 and #3. --+cxxRecordDecl(hasName("vector"), isInAnonymousNamespace()) will match --+#1, #2 and #3. --
-- -- --@@ -5708,9 +4241,7 @@ -- } -- } -- } --- ---The matcher cxxRecordDecl(hasName("vector"), isInStdNamespace()) ---matches class vector {} inside of namespace std. --+cxxRecordDecl(hasName("vector"), isInStdNamespace()) will match only #1. -- -- -- --@@ -5720,14 +4251,10 @@ -- -- Given -- template<typename T> void A(T t) { T i; } --- void foo() { --- A(0); --- A(0U); --- } --- ---The matcher functionDecl(isInstantiated()) ---matches the two instantiations of void A(T t) { T i; } that ---are generated for int , and for int}. --+ A(0); --+ A(0U); --+functionDecl(isInstantiated()) --+ matches 'A(int) {...};' and 'A(unsigned) {...}'. -- -- -- --@@ -5735,25 +4262,16 @@ --
Matches private C++ declarations and C++ base specifers that specify private
-- inheritance.
-- 
---Given
--+Examples:
--   class C {
--   public:    int a;
--   protected: int b;
---  private:   int c;
--+  private:   int c; // fieldDecl(isPrivate()) matches 'c'
--   };
-- 
---The matcher fieldDecl(isPrivate())
---matches c.
---
--   struct Base {};
---  struct Derived1 : private Base {}; // Base
---  class Derived2 : Base {}; // Base
---
---The matcher
---cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(isPrivate()).bind("base")))
---matches Derived1 and Derived2, with
---cxxBaseSpecifier(isPrivate()) matching
---Base.
--+  struct Derived1 : private Base {}; // matches 'Base'
--+  class Derived2 : Base {}; // matches 'Base'
-- 
-- -- --@@ -5761,24 +4279,15 @@ --
Matches protected C++ declarations and C++ base specifers that specify
-- protected inheritance.
-- 
---Given
--+Examples:
--   class C {
--   public:    int a;
---  protected: int b;
--+  protected: int b; // fieldDecl(isProtected()) matches 'b'
--   private:   int c;
--   };
-- 
---The matcher fieldDecl(isProtected())
---matches b.
---
--   class Base {};
---  class Derived : protected Base {};
---
---The matcher
---cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(isProtected()).bind("base")))
---matches Derived, with
---cxxBaseSpecifier(isProtected()) matching
---Base.
--+  class Derived : protected Base {}; // matches 'Base'
-- 
-- -- --@@ -5786,26 +4295,16 @@ --
Matches public C++ declarations and C++ base specifers that specify public
-- inheritance.
-- 
---Given
--+Examples:
--   class C {
---  public:    int a;
--+  public:    int a; // fieldDecl(isPublic()) matches 'a'
--   protected: int b;
--   private:   int c;
--   };
-- 
---The matcher fieldDecl(isPublic())
---matches a.
---
---Given
--   class Base {};
---  class Derived1 : public Base {};
---  struct Derived2 : Base {};
---
---The matcher
---cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(isPublic()).bind("base")))
---matches Derived1 and Derived2,
---with cxxBaseSpecifier(isPublic()) matching
---public Base and Base.
--+  class Derived1 : public Base {}; // matches 'Base'
--+  struct Derived2 : Base {}; // matches 'Base'
-- 
-- -- --@@ -5814,24 +4313,20 @@ -- a specific number of designators. -- -- Example: Given --- struct point2 { double x; double y; }; --- struct point2 ptarray[10] = { [0].x = 1.0 }; --- struct point2 pt = { .x = 2.0 }; --- ---The matcher designatedInitExpr(designatorCountIs(2)) ---matches [0].x = 1.0, but not .x = 2.0. --+ point ptarray[10] = { [2].y = 1.0, [0].x = 1.0 }; --+ point ptarray2[10] = { [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }; --+designatorCountIs(2) --+ matches '{ [2].y = 1.0, [0].x = 1.0 }', --+ but not '{ [2].y = 1.0, [2].x = 0.0, [0].x = 1.0 }'. -- -- -- -- Matcher<EnumDecl>isScoped --
Matches C++11 scoped enum declaration.
-- 
---Given
--+Example matches Y (matcher = enumDecl(isScoped()))
-- enum X {};
-- enum class Y {};
---
---The matcher enumDecl(isScoped())
---matches enum class Y {}
-- 
-- -- --@@ -5845,12 +4340,8 @@ -- sizeof is known (std::size_t) and therefore the size of the outer -- sizeof is known. -- template<typename T> --- void f(T x, T y) { sizeof(T() + T()); } --- ---The matcher expr(isInstantiationDependent()) ---matches sizeof(T() + T()), ---(T() + T()), ---T() + T() and T(). --+ void f(T x, T y) { sizeof(sizeof(T() + T()); } --+expr(isInstantiationDependent()) matches sizeof(sizeof(T() + T()) -- -- -- --@@ -5864,9 +4355,7 @@ -- void add(T x, int y) { -- x + y; -- } --- ---The matcher expr(isTypeDependent()) ---matches x + y and x. --+expr(isTypeDependent()) matches x + y -- -- -- --@@ -5877,9 +4366,7 @@ -- For example, the array bound of "Chars" in the following example is -- value-dependent. -- template<int Size> int f() { return Size; } --- ---The matcher expr(isValueDependent()) ---matches the return value Size. --+expr(isValueDependent()) matches return Size -- -- -- --@@ -5887,22 +4374,16 @@ --
Matches expressions that resolve to a null pointer constant, such as
-- GNU's __null, C++11's nullptr, or C's NULL macro.
-- 
---Given
---  #define NULL 0
--+Given:
--   void *v1 = NULL;
--   void *v2 = nullptr;
--   void *v3 = __null; // GNU extension
--   char *cp = (char *)0;
--   int *ip = 0;
--   int i = 0;
---
---The matcher expr(nullPointerConstant())
---matches the initializer NULL of v1,
---matches the initializer nullptr of v2,
---matches the initializer __null of v3,
---matches the initializer 0 of cp and
---matches the initializer 0 of ip,
---but does not match the initializer i of i.
--+expr(nullPointerConstant())
--+  matches the initializer for v1, v2, v3, cp, and ip. Does not match the
--+  initializer for i.
-- 
-- -- --@@ -5916,10 +4397,8 @@ -- int b : 4; -- int c : 2; -- }; --- ---The matcher fieldDecl(hasBitWidth(2)) ---matches a and c, ---but not b. --+fieldDecl(hasBitWidth(2)) --+ matches 'int a;' and 'int c;' but not 'int b;'. -- -- -- --@@ -5931,10 +4410,8 @@ -- int a : 2; -- int b; -- }; --- ---The matcher fieldDecl(isBitField()) ---matches a, ---but does not match b. --+fieldDecl(isBitField()) --+ matches 'int a;' but not 'int b;'. -- -- -- --@@ -5942,27 +4419,22 @@ --
Matches literals that are equal to the given value of type ValueT.
-- 
-- Given
---void f(char, bool, double, int);
---void foo() {
--   f('false, 3.14, 42);
---}
---
---The matcher characterLiteral(equals(0U)) matches 'The matchers cxxBoolLiteral(equals(false)) and
---cxxBoolLiteral(equals(0)) match false.
---The matcher floatLiteral(equals(3.14)) matches 3.14.
---The matcher integerLiteral(equals(42)) matches 42.
--+characterLiteral(equals(0))
--+  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
--+  match false
--+floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
--+  match 3.14
--+integerLiteral(equals(42))
--+  matches 42
-- 
-- Note that you cannot directly match a negative numeric literal because the
-- minus sign is not part of the literal: It is a unary operator whose operand
-- is the positive numeric literal. Instead, you must use a unaryOperator()
-- matcher to match the minus sign:
-- 
---Given
---  int val = -1;
---
---The matcher unaryOperator(hasOperatorName("-"),
---              hasUnaryOperand(integerLiteral(equals(1))))
---matches -1.
--+unaryOperator(hasOperatorName("-"),
--+              hasUnaryOperand(integerLiteral(equals(13))))
-- 
-- Usable as: Matcher<CharacterLiteral>, Matcher<CXXBoolLiteralExpr>,
--            Matcher<FloatingLiteral>, Matcher<IntegerLiteral>
--@@ -5980,30 +4452,6 @@
-- "operator" prefix: e.g. "<<".
-- 
--   hasAnyOverloadedOperatorName("+", "-")
---
---Given
---  struct Point { double x; double y; };
---  Point operator+(const Point&, const Point&);
---  Point operator-(const Point&, const Point&);
---
---  Point sub(Point a, Point b) {
---    return b - a;
---  }
---
---
---The matcher functionDecl(hasAnyOverloadedOperatorName("+", "-")),
---which is equivalent to
---functionDecl(anyOf(hasAnyOverloadedOperatorName("+"),
---hasOverloadedOperatorName("-"))),
---matches Point operator+(const Point&, const Point&) and
---Point operator-(const Point&, const Point&).
---The matcher
---cxxOperatorCallExpr(hasAnyOverloadedOperatorName("+", "-")),
---which is equivalent to
---cxxOperatorCallExpr(anyOf(hasOverloadedOperatorName("+"),
---hasOverloadedOperatorName("-"))),
---matches b - a.
---
-- Is equivalent to
--   anyOf(hasOverloadedOperatorName("+"), hasOverloadedOperatorName("-"))
-- 
--@@ -6012,32 +4460,17 @@ -- Matcher<FunctionDecl>hasDynamicExceptionSpec --
Matches functions that have a dynamic exception specification.
-- 
---Given
---  void f(int);
---  void g(int) noexcept;
---  void h(int) noexcept(true);
---  void i(int) noexcept(false);
---  void j(int) throw();
---  void k(int) throw(int);
---  void l(int) throw(...);
---
---The matcher functionDecl(hasDynamicExceptionSpec())
---matches the declarations void j(int) throw(),
---void k(int) throw(int)
---and void l(int) throw(...),
---but does not match void f(int), void g(int) noexcept,
---void h(int) noexcept(true)
---or void i(int) noexcept(true).
---The matcher
---functionProtoType(hasDynamicExceptionSpec()) matches
---the type void (int) throw() of j ,
---the type void (int) throw(int) of k and
---the type void (int) throw(...) of l .
---It does not match
---the type void (int) noexcept of f ,
---the type void (int) noexcept of g ,
---the type void (int) noexcept(int) of h or
---the type void (int) noexcept(...) of i .
--+Given:
--+  void f();
--+  void g() noexcept;
--+  void h() noexcept(true);
--+  void i() noexcept(false);
--+  void j() throw();
--+  void k() throw(int);
--+  void l() throw(...);
--+functionDecl(hasDynamicExceptionSpec()) and
--+  functionProtoType(hasDynamicExceptionSpec())
--+  match the declarations of j, k, and l, but not f, g, h, or i.
-- 
-- -- --@@ -6047,19 +4480,16 @@ -- Matches overloaded operator names specified in strings without the -- "operator" prefix: e.g. "<<". -- ---Given --- struct A { int operator*(); }; --+Given: --+ class A { int operator*(); }; -- const A &operator<<(const A &a, const A &b); --- void f(A a) { --- a << a; // <-- This matches --- } --- --+ A a; --+ a << a; // <-- This matches -- ---The matcher cxxOperatorCallExpr(hasOverloadedOperatorName("<<")) ---matches a << a. ---The matcher --+cxxOperatorCallExpr(hasOverloadedOperatorName("<<"))) matches the --+specified line and -- cxxRecordDecl(hasMethod(hasOverloadedOperatorName("*"))) ---matches struct A { int operator*(); }. --+matches the declaration of A. -- -- Usable as: Matcher<CXXOperatorCallExpr>, Matcher<FunctionDecl> -- --@@ -6068,12 +4498,9 @@ -- Matcher<FunctionDecl>hasTrailingReturn --
Matches a function declared with a trailing return type.
-- 
---Given
--+Example matches Y (matcher = functionDecl(hasTrailingReturn()))
-- int X() {}
-- auto Y() -> int {}
---
---The matcher functionDecl(hasTrailingReturn())
---matches auto Y() -> int {}.
-- 
-- -- --@@ -6081,18 +4508,15 @@ --
Matches consteval function declarations and if consteval/if ! consteval
-- statements.
-- 
---Given
--+Given:
--   consteval int a();
--   void b() { if consteval {} }
--   void c() { if ! consteval {} }
--   void d() { if ! consteval {} else {} }
---
---The matcher functionDecl(isConsteval())
---matches a.
---The matcher ifStmt(isConsteval())
---matches the if statements
---if consteval {}, if ! consteval {} and
---if ! consteval {} else {}.
--+functionDecl(isConsteval())
--+  matches the declaration of "int a()".
--+ifStmt(isConsteval())
--+  matches the if statement in "void b()", "void c()", "void d()".
-- 
-- -- --@@ -6100,30 +4524,27 @@ --
Matches constexpr variable and function declarations,
--        and if constexpr.
-- 
---Given
--+Given:
--   constexpr int foo = 42;
--   constexpr int bar();
--   void baz() { if constexpr(1 > 0) {} }
---
---The matcher varDecl(isConstexpr())
---matches foo.
---The matcher functionDecl(isConstexpr())
---matches bar.
---The matcher ifStmt(isConstexpr())
---matches if constexpr(1 > 0) {}.
--+varDecl(isConstexpr())
--+  matches the declaration of foo.
--+functionDecl(isConstexpr())
--+  matches the declaration of bar.
--+ifStmt(isConstexpr())
--+  matches the if statement in baz.
-- 
-- -- -- Matcher<FunctionDecl>isDefaulted --
Matches defaulted function declarations.
-- 
---Given
--+Given:
--   class A { ~A(); };
--   class B { ~B() = default; };
---
---The matcher functionDecl(isDefaulted())
---  matches ~B() = default,
---but does not match ~A().
--+functionDecl(isDefaulted())
--+  matches the declaration of ~B, but not ~A.
-- 
-- -- --@@ -6137,14 +4558,6 @@ -- extern int vb; // Doesn't match, as it doesn't define the variable. -- void fa() {} -- void fb(); // Doesn't match, as it has no body. --- ---The matcher tagDecl(isDefinition()) ---matches A ---The matcher varDecl(isDefinition()) ---matches va ---The matcher functionDecl(isDefinition()) ---matches fa --- -- @interface X -- - (void)ma; // Doesn't match, interface is declaration. -- @end --@@ -6152,9 +4565,6 @@ -- - (void)ma {} -- @end -- ---The matcher objcMethodDecl(isDefinition()) ---matches - (void)ma {} --- -- Usable as: Matcher<TagDecl>, Matcher<VarDecl>, Matcher<FunctionDecl>, -- Matcher<ObjCMethodDecl> -- --@@ -6163,13 +4573,11 @@ -- Matcher<FunctionDecl>isDeleted --
Matches deleted function declarations.
-- 
---Given
--+Given:
--   void Func();
--   void DeletedFunc() = delete;
---
---The matcher functionDecl(isDeleted())
---matches DeletedFunc,
---but does not match Func.
--+functionDecl(isDeleted())
--+  matches the declaration of DeletedFunc, but not Func.
-- 
-- -- --@@ -6180,9 +4588,8 @@ -- Given -- template<typename T> void A(T t) { } -- template<> void A(int N) { } --- ---The matcher functionDecl(isExplicitTemplateSpecialization()) --- matches the specialization template<> void A(int N) { }. --+functionDecl(isExplicitTemplateSpecialization()) --+ matches the specialization A<int>(). -- -- Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl> -- --@@ -6191,21 +4598,17 @@ -- Matcher<FunctionDecl>isExternC --
Matches extern "C" function or variable declarations.
-- 
---Given
--+Given:
--   extern "C" void f() {}
--   extern "C" { void g() {} }
--   void h() {}
--   extern "C" int x = 1;
--   extern "C" int y = 2;
--   int z = 3;
---
---The matcher functionDecl(isExternC())
---matches f
---and g.
---The matcher varDecl(isExternC())
---matches x
---and y,
---but does not match z.
--+functionDecl(isExternC())
--+  matches the declaration of f and g, but not the declaration of h.
--+varDecl(isExternC())
--+  matches the declaration of x and y, but not the declaration of z.
-- 
-- -- --@@ -6220,22 +4623,15 @@ -- inline namespace m {} -- } -- inline int Foo = 5; --- ---The matcher functionDecl(isInline()) matches f. ---The matcher namespaceDecl(isInline()) matches m. ---The matcher varDecl(isInline()) matches Foo --+functionDecl(isInline()) will match ::f(). --+namespaceDecl(isInline()) will match n::m. --+varDecl(isInline()) will match Foo; -- -- -- -- Matcher<FunctionDecl>isMain --
Determines whether the function is "main", which is the entry point
-- into an executable program.
---
---Given
---  void f();
---  int main() {}
---
---The matcher functionDecl(isMain()) matches int main() {}.
-- 
-- -- --@@ -6247,38 +4643,23 @@ -- [[noreturn]] void a(); -- __attribute__((noreturn)) void b(); -- struct c { [[noreturn]] c(); }; --- ---The matcher functionDecl(isNoReturn()) ---match a, b ---and c ---but do not match nope --+functionDecl(isNoReturn()) --+ matches all of those except --+ void nope(); -- -- -- -- Matcher<FunctionDecl>isNoThrow --
Matches functions that have a non-throwing exception specification.
-- 
---Given
---  void f(int);
---  void g(int) noexcept;
---  void h(int) noexcept(false);
---  void i(int) throw();
---  void j(int) throw(int);
---
---The matcher functionDecl(isNoThrow())
---matches the declaration void g(int) noexcept
---and void i(int) throw(),
---but does not match void f(int),
---void h(int) noexcept(false)
---or void j(int) throw(int).
---The matcher
---functionProtoType(isNoThrow())
---matches the type void (int) throw() of i
---and the type void (int) noexcept of g,
---but does not match
---the type void (int) of f ,
---the type void (int) noexcept(false) of h or
---the type void (int) throw(int) of j .
--+Given:
--+  void f();
--+  void g() noexcept;
--+  void h() throw();
--+  void i() throw(int);
--+  void j() noexcept(false);
--+functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
--+  match the declarations of g, and h, but not f, i or j.
-- 
-- -- --@@ -6286,15 +4667,15 @@ --
Matches variable/function declarations that have "static" storage
-- class specifier ("static" keyword) written in the source.
-- 
---Given
--+Given:
--   static void f() {}
--   static int i = 0;
--   extern int j;
--   int k;
---The matcher functionDecl(isStaticStorageClass())
---  matches f
---The matcher varDecl(isStaticStorageClass())
---  matches i
--+functionDecl(isStaticStorageClass())
--+  matches the function declaration f.
--+varDecl(isStaticStorageClass())
--+  matches the variable declaration i.
-- 
-- -- --@@ -6303,36 +4684,18 @@ -- member variable template instantiations. -- -- Given --- template <typename T> class X {}; --- class A {}; --- X<A> x; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches class X<class A>. --- template <typename T> class X {}; --- class A {}; --- template class X<A>; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches template class X<A> --- template <typename T> class X {}; --- class A {}; --- extern template class X<A>; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches extern template class X<A> --+ template <typename T> class X {}; class A {}; X<A> x; --+or --+ template <typename T> class X {}; class A {}; template class X<A>; --+or --+ template <typename T> class X {}; class A {}; extern template class X<A>; --+cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) --+ matches the template instantiation of X<A>. -- -- But given --- template <typename T> class X {}; --- class A {}; --- template <> class X<A> {}; --- X<A> x; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) --+ template <typename T> class X {}; class A {}; --+ template <> class X<A> {}; X<A> x; --+cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) -- does not match, as X<A> is an explicit template specialization. -- -- Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl> --@@ -6348,25 +4711,17 @@ -- void g(int); -- template <typename... Ts> void h(Ts...); -- void i(); --- ---The matcher functionDecl(isVariadic()) ---matches void f(...), ---but does not match void g(int), ---template <typename... Ts> void h(Ts...), ---or void i(). -- -- -- -- Matcher<FunctionDecl>isWeak --
Matches weak function declarations.
-- 
---Given
---  static void f();
---  void g() __attribute__((weak));
---The matcher functionDecl(isWeak())
---  matches the weak declaration
---void g() __attribute__((weak)),
---but does not match static void foo_v1().
--+Given:
--+  void foo() __attribute__((__weakref__("__foo")));
--+  void bar();
--+functionDecl(isWeak())
--+  matches the weak declaration "foo", but not "bar".
-- 
-- -- --@@ -6380,71 +4735,43 @@ -- void h(int i, int j); -- void j(int i); -- void k(int x, int y, int z, ...); ---The matcher functionDecl(parameterCountIs(2)) ---matches g and h ---The matcher functionProtoType(parameterCountIs(1)) ---matches the type void (int) of f and j. ---The matcher functionProtoType(parameterCountIs(3)) matches the ---type void (int, int, int, ...) of k. --+functionDecl(parameterCountIs(2)) --+ matches g and h --+functionProtoType(parameterCountIs(2)) --+ matches g and h --+functionProtoType(parameterCountIs(3)) --+ matches k -- -- -- -- Matcher<FunctionProtoType>hasDynamicExceptionSpec --
Matches functions that have a dynamic exception specification.
-- 
---Given
---  void f(int);
---  void g(int) noexcept;
---  void h(int) noexcept(true);
---  void i(int) noexcept(false);
---  void j(int) throw();
---  void k(int) throw(int);
---  void l(int) throw(...);
---
---The matcher functionDecl(hasDynamicExceptionSpec())
---matches the declarations void j(int) throw(),
---void k(int) throw(int)
---and void l(int) throw(...),
---but does not match void f(int), void g(int) noexcept,
---void h(int) noexcept(true)
---or void i(int) noexcept(true).
---The matcher
---functionProtoType(hasDynamicExceptionSpec()) matches
---the type void (int) throw() of j ,
---the type void (int) throw(int) of k and
---the type void (int) throw(...) of l .
---It does not match
---the type void (int) noexcept of f ,
---the type void (int) noexcept of g ,
---the type void (int) noexcept(int) of h or
---the type void (int) noexcept(...) of i .
--+Given:
--+  void f();
--+  void g() noexcept;
--+  void h() noexcept(true);
--+  void i() noexcept(false);
--+  void j() throw();
--+  void k() throw(int);
--+  void l() throw(...);
--+functionDecl(hasDynamicExceptionSpec()) and
--+  functionProtoType(hasDynamicExceptionSpec())
--+  match the declarations of j, k, and l, but not f, g, h, or i.
-- 
-- -- -- Matcher<FunctionProtoType>isNoThrow --
Matches functions that have a non-throwing exception specification.
-- 
---Given
---  void f(int);
---  void g(int) noexcept;
---  void h(int) noexcept(false);
---  void i(int) throw();
---  void j(int) throw(int);
---
---The matcher functionDecl(isNoThrow())
---matches the declaration void g(int) noexcept
---and void i(int) throw(),
---but does not match void f(int),
---void h(int) noexcept(false)
---or void j(int) throw(int).
---The matcher
---functionProtoType(isNoThrow())
---matches the type void (int) throw() of i
---and the type void (int) noexcept of g,
---but does not match
---the type void (int) of f ,
---the type void (int) noexcept(false) of h or
---the type void (int) throw(int) of j .
--+Given:
--+  void f();
--+  void g() noexcept;
--+  void h() throw();
--+  void i() throw(int);
--+  void j() noexcept(false);
--+functionDecl(isNoThrow()) and functionProtoType(isNoThrow())
--+  match the declarations of g, and h, but not f, i or j.
-- 
-- -- --@@ -6458,12 +4785,12 @@ -- void h(int i, int j); -- void j(int i); -- void k(int x, int y, int z, ...); ---The matcher functionDecl(parameterCountIs(2)) ---matches g and h ---The matcher functionProtoType(parameterCountIs(1)) ---matches the type void (int) of f and j. ---The matcher functionProtoType(parameterCountIs(3)) matches the ---type void (int, int, int, ...) of k. --+functionDecl(parameterCountIs(2)) --+ matches g and h --+functionProtoType(parameterCountIs(2)) --+ matches g and h --+functionProtoType(parameterCountIs(3)) --+ matches k -- -- -- --@@ -6471,18 +4798,15 @@ --
Matches consteval function declarations and if consteval/if ! consteval
-- statements.
-- 
---Given
--+Given:
--   consteval int a();
--   void b() { if consteval {} }
--   void c() { if ! consteval {} }
--   void d() { if ! consteval {} else {} }
---
---The matcher functionDecl(isConsteval())
---matches a.
---The matcher ifStmt(isConsteval())
---matches the if statements
---if consteval {}, if ! consteval {} and
---if ! consteval {} else {}.
--+functionDecl(isConsteval())
--+  matches the declaration of "int a()".
--+ifStmt(isConsteval())
--+  matches the if statement in "void b()", "void c()", "void d()".
-- 
-- -- --@@ -6490,17 +4814,16 @@ --
Matches constexpr variable and function declarations,
--        and if constexpr.
-- 
---Given
--+Given:
--   constexpr int foo = 42;
--   constexpr int bar();
--   void baz() { if constexpr(1 > 0) {} }
---
---The matcher varDecl(isConstexpr())
---matches foo.
---The matcher functionDecl(isConstexpr())
---matches bar.
---The matcher ifStmt(isConstexpr())
---matches if constexpr(1 > 0) {}.
--+varDecl(isConstexpr())
--+  matches the declaration of foo.
--+functionDecl(isConstexpr())
--+  matches the declaration of bar.
--+ifStmt(isConstexpr())
--+  matches the if statement in baz.
-- 
-- -- --@@ -6512,27 +4835,22 @@ --
Matches literals that are equal to the given value of type ValueT.
-- 
-- Given
---void f(char, bool, double, int);
---void foo() {
--   f('false, 3.14, 42);
---}
---
---The matcher characterLiteral(equals(0U)) matches 'The matchers cxxBoolLiteral(equals(false)) and
---cxxBoolLiteral(equals(0)) match false.
---The matcher floatLiteral(equals(3.14)) matches 3.14.
---The matcher integerLiteral(equals(42)) matches 42.
--+characterLiteral(equals(0))
--+  matches 'cxxBoolLiteral(equals(false)) and cxxBoolLiteral(equals(0))
--+  match false
--+floatLiteral(equals(3.14)) and floatLiteral(equals(314e-2))
--+  match 3.14
--+integerLiteral(equals(42))
--+  matches 42
-- 
-- Note that you cannot directly match a negative numeric literal because the
-- minus sign is not part of the literal: It is a unary operator whose operand
-- is the positive numeric literal. Instead, you must use a unaryOperator()
-- matcher to match the minus sign:
-- 
---Given
---  int val = -1;
---
---The matcher unaryOperator(hasOperatorName("-"),
---              hasUnaryOperand(integerLiteral(equals(1))))
---matches -1.
--+unaryOperator(hasOperatorName("-"),
--+              hasUnaryOperand(integerLiteral(equals(13))))
-- 
-- Usable as: Matcher<CharacterLiteral>, Matcher<CXXBoolLiteralExpr>,
--            Matcher<FloatingLiteral>, Matcher<IntegerLiteral>
--@@ -6558,30 +4876,14 @@
--     return l();
--   }
-- };
---
---The matcher
-- lambdaExpr(hasAnyCapture(lambdaCapture(capturesThis())))
---matches [this]() { return cc; }.
--+  matches `[this]() { return cc; }`.
-- 
-- -- -- Matcher<LambdaCapture>isImplicit --
Matches an entity that has been implicitly added by the compiler (e.g.
-- implicit default/copy constructors).
---
---Given
---  struct S {};
---  void f(S obj) {
---    S copy = obj;
---    [&](){ return copy; };
---  }
---
---
---The matcher cxxConstructorDecl(isImplicit(), isCopyConstructor())
---matches the implicit copy constructor of S.
---The matcher lambdaExpr(forEachLambdaCapture(
---    lambdaCapture(isImplicit()))) matches [&](){ return copy; },
---because it implicitly captures copy .
-- 
-- -- --@@ -6600,25 +4902,14 @@ -- }; -- template <class T> -- class Z { --- void x() { --- this->m; --- this->t; --- this->t->m; --- } --- int m; --- T* t; --+ void x() { this->m; } -- }; --- ---The matcher memberExpr(isArrow()) ---matches this->x, x, a, ---this->b, this->m and two times this->t, ---once for the standalone member expression, and once for the member ---expression that later accesses m . ---Additionally, it does not match this->t->t. ---The matcher cxxDependentScopeMemberExpr(isArrow()) ---matches this->t->m, but not this->m or this->t. ---The matcher unresolvedMemberExpr(isArrow()) ---matches this->f<T>, f<T> --+memberExpr(isArrow()) --+ matches this->x, x, y.x, a, this->b --+cxxDependentScopeMemberExpr(isArrow()) --+ matches this->m --+unresolvedMemberExpr(isArrow()) --+ matches this->f<T>, f<T> -- -- -- --@@ -6626,43 +4917,29 @@ --
Matches NamedDecl nodes that have any of the specified names.
-- 
-- This matcher is only provided as a performance optimization of hasName.
---
---Given
---  void f(int a, int b);
---
---The matcher namedDecl(hasAnyName("a", "b")),
---which is equivalent to the matcher
---namedDecl(hasAnyName("a", "b")),
---matches int a and int b, but not
---void f(int a, int b).
--+    hasAnyName(a, b, c)
--+ is equivalent to, but faster than
--+    anyOf(hasName(a), hasName(b), hasName(c))
-- 
-- -- -- Matcher<NamedDecl>hasExternalFormalLinkage --
Matches a declaration that has external formal linkage.
-- 
---Given
--+Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
-- void f() {
---  int a;
---  static int b;
--+  int x;
--+  static int y;
-- }
---int c;
---static int d;
---The matcher varDecl(hasExternalFormalLinkage())
---matches int c,
---but not int a, static int b or int d.
---
---Given
---  namespace {
---    void f() {}
---  }
---  void g() {}
---  static void h() {}
--+int z;
-- 
--+Example matches f() because it has external formal linkage despite being
--+unique to the translation unit as though it has internal likage
--+(matcher = functionDecl(hasExternalFormalLinkage()))
-- 
---The matcher functionDecl(hasExternalFormalLinkage())
---matches void g() {}, but not void f() {} or
---static void h() {}.
--+namespace {
--+void f() {}
--+}
-- 
-- -- --@@ -6673,22 +4950,11 @@ -- with '<enclosing>::'. -- Does not match typedefs of an underlying type with the given name. -- ---Given --+Example matches X (Name == "X") -- class X; -- --- ---The matcher namedDecl(hasName("X")) ---matches class X. --- ---Given --+Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X") -- namespace a { namespace b { class X; } } --- --- ---The matchers namedDecl(hasName("::a::b::X")), ---namedDecl(hasName("a::b::X")), ---namedDecl(hasName("b::X")) and ---namedDecl(hasName("X")) ---match class X. -- -- -- --@@ -6700,12 +4966,11 @@ -- prefixing the name with '<enclosing>::'. Does not match typedefs -- of an underlying type with the given name. -- ---Given --- namespace foo { namespace bar { class X; } } --- --+Example matches X (regexp == "::X") --+ class X; -- ---The matcher namedDecl(matchesName("^::foo:.*X")) ---matches class X. --+Example matches X (regexp is one of "::X", "^foo::.*X", among others) --+ namespace foo { namespace bar { class X; } } -- -- If the matcher is used in clang-query, RegexFlags parameter -- should be passed as a quoted string. e.g: "NoFlags". --@@ -6720,9 +4985,7 @@ -- namespace n { -- namespace {} // #1 -- } --- ---The matcher namespaceDecl(isAnonymous()) ---matches namespace {}, but not namespace n. --+namespaceDecl(isAnonymous()) will match #1 but not ::n. -- -- -- --@@ -6737,10 +5000,9 @@ -- inline namespace m {} -- } -- inline int Foo = 5; --- ---The matcher functionDecl(isInline()) matches f. ---The matcher namespaceDecl(isInline()) matches m. ---The matcher varDecl(isInline()) matches Foo --+functionDecl(isInline()) will match ::f(). --+namespaceDecl(isInline()) will match n::m. --+varDecl(isInline()) will match Foo; -- -- -- --@@ -6749,23 +5011,15 @@ -- specified. -- -- Given --- void foo() { --- #pragma omp parallel --- ; --- #pragma omp parallel default(none) --- ; --- #pragma omp parallel default(shared) --- ; --- #pragma omp parallel default(private) --- ; --- #pragma omp parallel default(firstprivate) --- ; --- } -- --+ #pragma omp parallel --+ #pragma omp parallel default(none) --+ #pragma omp parallel default(shared) --+ #pragma omp parallel default(private) --+ #pragma omp parallel default(firstprivate) -- ---The matcher ---ompExecutableDirective(hasAnyClause(ompDefaultClause(isFirstPrivateKind()))) ---matches #pragma omp parallel default(firstprivate). --+``ompDefaultClause(isFirstPrivateKind())`` matches only --+``default(firstprivate)``. -- -- -- --@@ -6773,23 +5027,14 @@ --
Matches if the OpenMP ``default`` clause has ``none`` kind specified.
-- 
-- Given
---  void foo() {
---    #pragma omp parallel
---      ;
---    #pragma omp parallel default(none)
---      ;
---    #pragma omp parallel default(shared)
---      ;
---    #pragma omp parallel default(private)
---      ;
---    #pragma omp parallel default(firstprivate)
---      ;
---  }
-- 
--+  #pragma omp parallel
--+  #pragma omp parallel default(none)
--+  #pragma omp parallel default(shared)
--+  #pragma omp parallel default(private)
--+  #pragma omp parallel default(firstprivate)
-- 
---The matcher
---ompExecutableDirective(hasAnyClause(ompDefaultClause(isNoneKind())))
---matches only #pragma omp parallel default(none).
--+``ompDefaultClause(isNoneKind())`` matches only ``default(none)``.
-- 
-- -- --@@ -6798,23 +5043,15 @@ -- specified. -- -- Given --- void foo() { --- #pragma omp parallel --- ; --+ --+ #pragma omp parallel -- #pragma omp parallel default(none) --- ; -- #pragma omp parallel default(shared) --- ; -- #pragma omp parallel default(private) --- ; -- #pragma omp parallel default(firstprivate) --- ; --- } -- --- ---The matcher ---ompExecutableDirective(hasAnyClause(ompDefaultClause(isPrivateKind()))) ---matches #pragma omp parallel default(private). --+``ompDefaultClause(isPrivateKind())`` matches only --+``default(private)``. -- -- -- --@@ -6822,23 +5059,14 @@ --
Matches if the OpenMP ``default`` clause has ``shared`` kind specified.
-- 
-- Given
---  void foo() {
---    #pragma omp parallel
---      ;
---    #pragma omp parallel default(none)
---      ;
--+
--+  #pragma omp parallel
--+  #pragma omp parallel default(none)
--   #pragma omp parallel default(shared)
---      ;
--   #pragma omp parallel default(private)
---      ;
--   #pragma omp parallel default(firstprivate)
---      ;
---  }
---
-- 
---The matcher
---ompExecutableDirective(hasAnyClause(ompDefaultClause(isSharedKind())))
---matches #pragma omp parallel default(shared).
--+``ompDefaultClause(isSharedKind())`` matches only ``default(shared)``.
-- 
-- -- --@@ -6847,21 +5075,13 @@ -- clause kind. -- -- Given --- void foo() { --- #pragma omp parallel --- ; --- #pragma omp parallel for --- for (int i = 0; i < 10; ++i) {} --- #pragma omp for --- for (int i = 0; i < 10; ++i) {} --- } -- --+ #pragma omp parallel --+ #pragma omp parallel for --+ #pragma omp for -- ---The matcher ---ompExecutableDirective(isAllowedToContainClauseKind( ---OpenMPClauseKind::OMPC_default)) ---matches #pragma omp parallel ---and #pragma omp parallel for. --+`ompExecutableDirective(isAllowedToContainClause(OMPC_default))`` matches --+``omp parallel`` and ``omp parallel for``. -- -- If the matcher is use from clang-query, ``OpenMPClauseKind`` parameter -- should be passed as a quoted string. e.g., --@@ -6874,89 +5094,29 @@ -- i.e., directives that can't have a structured block. -- -- Given --- void foo() { --- #pragma omp parallel --- { --- #pragma omp taskyield --- } --- } -- --+ #pragma omp parallel --+ {} --+ #pragma omp taskyield -- ---The matcher ompExecutableDirective(isStandaloneDirective()) ---matches #pragma omp taskyield. --+``ompExecutableDirective(isStandaloneDirective()))`` matches --+``omp taskyield``. -- -- -- -- Matcher<ObjCInterfaceDecl>isDerivedFromstd::string BaseName --
Overloaded method as shortcut for isDerivedFrom(hasName(...)).
---
---Matches C++ classes that are directly or indirectly derived from a class
---matching Base, or Objective-C classes that directly or indirectly
---subclass a class matching Base.
---
---Note that a class is not considered to be derived from itself.
---
---Example matches Y, Z, C (Base == hasName("X"))
---  class X {};
---  class Y : public X {};  // directly derived
---  class Z : public Y {};  // indirectly derived
---  typedef X A;
---  typedef A B;
---  class C : public B {};  // derived from a typedef of X
---
---  class Foo {};
---  typedef Foo Alias;
---  class Bar : public Alias {};  // derived from Alias, which is a
---                                // typedef of Foo
---
---
---The matcher cxxRecordDecl(isDerivedFrom("X"))
---matches Y, Z and C.
---The matcher cxxRecordDecl(isDerivedFrom("Foo"))
---matches Bar.
---
---In the following example, Bar matches isDerivedFrom(hasName("NSObject"))
---  @interface NSObject @end
---  @interface Bar : NSObject @end
---
---
---Usable as: Matcher<CXXRecordDecl>, Matcher<ObjCInterfaceDecl>
-- 
-- -- -- Matcher<ObjCInterfaceDecl>isDirectlyDerivedFromstd::string BaseName --
Overloaded method as shortcut for isDirectlyDerivedFrom(hasName(...)).
---
---Given
---  struct Base {};
---  struct DirectlyDerived : public Base {};
---  struct IndirectlyDerived : public DirectlyDerived {};
---
---
---The matcher cxxRecordDecl(isDirectlyDerivedFrom("Base"))
---matches DirectlyDerived, but not
---IndirectlyDerived.
-- 
-- -- -- Matcher<ObjCInterfaceDecl>isSameOrDerivedFromstd::string BaseName ---
Similar to isDerivedFrom(), but also matches classes that directly
---match Base.
---Overloaded method as shortcut for
--+
Overloaded method as shortcut for
-- isSameOrDerivedFrom(hasName(...)).
---
---Given
---  class X {};
---  class Y : public X {};  // directly derived
---  class Z : public Y {};  // indirectly derived
---  typedef X A;
---  typedef A B;
---  class C : public B {};  // derived from a typedef of X
---
---The matcher
---cxxRecordDecl(isSameOrDerivedFrom("X"), isDefinition())
---matches class X {}, class Y : public X {},
---class Z : public Y {} and class C : public B {}.
-- 
-- -- --@@ -6964,15 +5124,12 @@ --
Checks that a call expression or a constructor call expression has at least
-- the specified number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) and g(0, 0, 0)
--+(matcher = callExpr(argumentCountAtLeast(2)))
--   void f(int x, int y);
--   void g(int x, int y, int z);
---  void foo() {
---    f(0, 0);
---    g(0, 0, 0);
---  }
---The matcher callExpr(argumentCountAtLeast(2))
---matches f(0, 0) and g(0, 0, 0)
--+  f(0, 0);
--+  g(0, 0, 0);
-- 
-- -- --@@ -6980,13 +5137,9 @@ --
Checks that a call expression or a constructor call expression has
-- a specific number of arguments (including absent default arguments).
-- 
---Given
--+Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
--   void f(int x, int y);
---  void foo() {
---    f(0, 0);
---  }
---The matcher callExpr(argumentCountIs(2))
---matches f(0, 0)
--+  f(0, 0);
-- 
-- -- --@@ -6994,27 +5147,24 @@ --
Matches when at least one of the supplied string equals to the
-- Selector.getAsString()
-- 
--+ matcher = objCMessageExpr(hasSelector("methodA:", "methodB:"));
--+ matches both of the expressions below:
--     [myObj methodA:argA];
--     [myObj methodB:argB];
---
--- The matcher objCMessageExpr(hasSelector("methodA:", "methodB:"));
--- matches [myObj methodA:argA]; and [myObj methodB:argB];
-- 
-- -- -- Matcher<ObjCMessageExpr>hasKeywordSelector --
Matches when the selector is a keyword selector
-- 
---Given
--+objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
--+message expression in
--+
--   UIWebView *webView = ...;
--   CGRect bodyFrame = webView.frame;
--   bodyFrame.size.height = self.bodyContentHeight;
--   webView.frame = bodyFrame;
--   //     ^---- matches here
---
---
---The matcher objCMessageExpr(hasKeywordSelector()) matches the
---generated setFrame message expression in
-- 
-- -- --@@ -7029,68 +5179,56 @@ -- Matcher<ObjCMessageExpr>hasSelectorstd::string BaseName --
Matches when BaseName == Selector.getAsString()
-- 
--+ matcher = objCMessageExpr(hasSelector("loadHTMLString:baseURL:"));
--+ matches the outer message expr in the code below, but NOT the message
--+ invocation for self.bodyView.
--     [self.bodyView loadHTMLString:html baseURL:NULL];
---
---The matcher
---objCMessageExpr(hasSelector("loadHTMLString:baseURL:")); matches
---the outer message expr in the code below, but NOT the message invocation
---for self.bodyView.
-- 
-- -- -- Matcher<ObjCMessageExpr>hasUnarySelector --
Matches when the selector is a Unary Selector
-- 
---Given
---    [self.bodyView loadHTMLString:html baseURL:NULL];
---
---
--- The matcher objCMessageExpr(matchesSelector(hasUnarySelector());
--- matches self.bodyView, but does not match the outer message
--+ matcher = objCMessageExpr(matchesSelector(hasUnarySelector());
--+ matches self.bodyView in the code below, but NOT the outer message
--  invocation of "loadHTMLString:baseURL:".
--+    [self.bodyView loadHTMLString:html baseURL:NULL];
-- 
-- -- -- Matcher<ObjCMessageExpr>isClassMessage --
Returns true when the Objective-C message is sent to a class.
-- 
---Given
--+Example
--+matcher = objcMessageExpr(isClassMessage())
--+matches
--   [NSString stringWithFormat:@"format"];
--+but not
--   NSString *x = @"hello";
--   [x containsString:@"h"];
---
---The matcher objcMessageExpr(isClassMessage())
---matches [NSString stringWithFormat:@"format"];
---but does not match [[x containsString:@"h"]
-- 
-- -- -- Matcher<ObjCMessageExpr>isInstanceMessage --
Returns true when the Objective-C message is sent to an instance.
-- 
---Given
--+Example
--+matcher = objcMessageExpr(isInstanceMessage())
--+matches
--   NSString *x = @"hello";
--   [x containsString:@"h"];
--+but not
--   [NSString stringWithFormat:@"format"];
---
---The matcher objcMessageExpr(isInstanceMessage())
---matches [x containsString:@"h"];
---but does not match [NSString stringWithFormat:@"format"];
-- 
-- -- -- Matcher<ObjCMessageExpr>matchesSelectorStringRef RegExp, Regex::RegexFlags Flags = NoFlags --
Matches ObjC selectors whose name contains
-- a substring matched by the given RegExp.
---
---Given
--+ matcher = objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
--+ invocation for self.bodyView.
--     [self.bodyView loadHTMLString:html baseURL:NULL];
-- 
---
---The matcher
---objCMessageExpr(matchesSelector("loadHTMLStringmatches the outer message expr in the code below, but NOT the message
---invocation for self.bodyView.
---
-- If the matcher is used in clang-query, RegexFlags parameter
-- should be passed as a quoted string. e.g: "NoFlags".
-- Flags can be combined with '|' example "IgnoreCase | BasicRegex"
--@@ -7100,26 +5238,25 @@
-- Matcher<ObjCMessageExpr>numSelectorArgsunsigned N
-- 
Matches when the selector has the specified number of arguments
-- 
---    [self.bodyView loadHTMLString:html baseURL:NULL];
--+ matcher = objCMessageExpr(numSelectorArgs(0));
--+ matches self.bodyView in the code below
-- 
---The matcher objCMessageExpr(numSelectorArgs(0))
---matches self.bodyView.
---The matcher objCMessageExpr(numSelectorArgs(2))
---matches the invocation of loadHTMLString:baseURL:
---but does not match self.bodyView
--+ matcher = objCMessageExpr(numSelectorArgs(2));
--+ matches the invocation of "loadHTMLString:baseURL:" but not that
--+ of self.bodyView
--+    [self.bodyView loadHTMLString:html baseURL:NULL];
-- 
-- -- -- Matcher<ObjCMethodDecl>isClassMethod --
Returns true when the Objective-C method declaration is a class method.
-- 
---Given
--+Example
--+matcher = objcMethodDecl(isClassMethod())
--+matches
-- @interface I + (void)foo; @end
--+but not
-- @interface I - (void)bar; @end
---
---The matcher objcMethodDecl(isClassMethod())
---matches @interface I + (void)foo; @end
---but does not match interface I + (void)foo; @end
-- 
-- -- --@@ -7133,14 +5270,6 @@ -- extern int vb; // Doesn't match, as it doesn't define the variable. -- void fa() {} -- void fb(); // Doesn't match, as it has no body. --- ---The matcher tagDecl(isDefinition()) ---matches A ---The matcher varDecl(isDefinition()) ---matches va ---The matcher functionDecl(isDefinition()) ---matches fa --- -- @interface X -- - (void)ma; // Doesn't match, interface is declaration. -- @end --@@ -7148,9 +5277,6 @@ -- - (void)ma {} -- @end -- ---The matcher objcMethodDecl(isDefinition()) ---matches - (void)ma {} --- -- Usable as: Matcher<TagDecl>, Matcher<VarDecl>, Matcher<FunctionDecl>, -- Matcher<ObjCMethodDecl> --
--@@ -7159,39 +5285,33 @@ -- Matcher<ObjCMethodDecl>isInstanceMethod --
Returns true when the Objective-C method declaration is an instance method.
-- 
---Given
--+Example
--+matcher = objcMethodDecl(isInstanceMethod())
--+matches
-- @interface I - (void)bar; @end
--+but not
-- @interface I + (void)foo; @end
---
---The matcher objcMethodDecl(isInstanceMethod())
---matches @interface I - (void)bar; @end
---but does not match @interface I - (void)foo; @end
---
-- 
-- -- -- Matcher<ParmVarDecl>hasDefaultArgument --
Matches a declaration that has default arguments.
-- 
---Given
---  void x(int val) {}
---  void y(int val = 0) {}
---
---
---The matcher parmVarDecl(hasDefaultArgument())
---matches int val = 0.
--+Example matches y (matcher = parmVarDecl(hasDefaultArgument()))
--+void x(int val) {}
--+void y(int val = 0) {}
-- 
-- Deprecated. Use hasInitializer() instead to be able to
-- match on the contents of the default argument.  For example:
-- 
---Given
---  void x(int val = 7) {}
---  void y(int val = 42) {}
---
---
---The matcher
---parmVarDecl(hasInitializer(integerLiteral(equals(42)))),
---matches int val = 42.
--+void x(int val = 7) {}
--+void y(int val = 42) {}
--+parmVarDecl(hasInitializer(integerLiteral(equals(42))))
--+  matches the parameter of y
--+
--+A matcher such as
--+  parmVarDecl(hasInitializer(anything()))
--+is equivalent to parmVarDecl(hasDefaultArgument()).
-- 
-- -- --@@ -7206,9 +5326,9 @@ -- void f(int a, int b, int c) { -- } -- ---The matcher parmVarDecl(isAtPosition(0)) matches ---a. The matcher parmVarDecl(isAtPosition(1)) ---matches b. --+``parmVarDecl(isAtPosition(0))`` matches ``int a``. --+ --+``parmVarDecl(isAtPosition(1))`` matches ``int b``. --
-- -- --@@ -7218,9 +5338,8 @@ -- Given -- class Y { public: void x(); }; -- void z() { Y* y; y->x(); } --- ---The matcher cxxMemberCallExpr(on(hasType(asString("Y *")))) ---matches y->x() --+cxxMemberCallExpr(on(hasType(asString("class Y *")))) --+ matches y->x() -- -- -- --@@ -7231,11 +5350,10 @@ -- -- Given -- class X { int a; int b; }; --- ---The matcher cxxRecordDecl( --+cxxRecordDecl( -- has(fieldDecl(hasName("a"), hasType(type().bind("t")))), -- has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) --- matches X, as a and b have the same type. --+ matches the class X, as a and b have the same type. -- -- Note that when multiple matches are involved via forEach* matchers, -- equalsBoundNodes acts as a filter. --@@ -7254,15 +5372,12 @@ -- -- Given -- typedef const int const_int; --- const_int i = 0; --- int *const j = nullptr; --+ const_int i; --+ int *const j; -- int *volatile k; -- int m; --- --- ---The matcher varDecl(hasType(hasLocalQualifiers())) matches only ---j and k. is ---const-qualified but the qualifier is not local. --+varDecl(hasType(hasLocalQualifiers())) matches only j and k. --+i is const-qualified but the qualifier is not local. -- -- -- --@@ -7273,11 +5388,9 @@ -- void a(char); -- void b(wchar_t); -- void c(double); --- --- ---The matcher -- functionDecl(hasAnyParameter(hasType(isAnyCharacter()))) ---a, b, but not --+matches "a(char)", "b(wchar_t)", but not "c(double)". --+ -- -- -- Matcher<QualType>isAnyPointer --@@ -7293,9 +5406,8 @@ -- Foo *f; -- -- int j; --- ---The matcher varDecl(hasType(isAnyPointer())) ---int *i and Foo *f, but not int j. --+varDecl(hasType(isAnyPointer())) --+ matches "int *i" and "Foo *f", but not "int j". -- -- -- --@@ -7309,11 +5421,9 @@ -- void c(const int); -- void d(const int*); -- void e(int const) {}; ---The matcher -- functionDecl(hasAnyParameter(hasType(isConstQualified()))) --- matches b, c and --- e. --- It does not match as there --+ matches "void b(int const)", "void c(const int)" and --+ "void e(int const) {}". It does not match d as there -- is no top-level const on the parameter type "const int *". -- -- --@@ -7325,8 +5435,8 @@ -- void a(int); -- void b(long); -- void c(double); ---The matcher functionDecl(hasAnyParameter(hasType(isInteger()))) ---a, b, but not c. --+functionDecl(hasAnyParameter(hasType(isInteger()))) --+matches "a(int)", "b(long)", but not "c(double)". -- -- -- --@@ -7337,9 +5447,8 @@ -- void a(int); -- void b(unsigned long); -- void c(double); ---The matcher ---functionDecl(hasAnyParameter(hasType(isSignedInteger()))) matches ---a, but not and not --+functionDecl(hasAnyParameter(hasType(isSignedInteger()))) --+matches "a(int)", but not "b(unsigned long)" and "c(double)". -- -- -- --@@ -7350,10 +5459,8 @@ -- void a(int); -- void b(unsigned long); -- void c(double); ---The matcher -- functionDecl(hasAnyParameter(hasType(isUnsignedInteger()))) ---matches b, ---but does not match a and c. --+matches "b(unsigned long)", but not "a(int)" and "c(double)". -- -- -- --@@ -7367,11 +5474,9 @@ -- void c(volatile int); -- void d(volatile int*); -- void e(int volatile) {}; ---The matcher -- functionDecl(hasAnyParameter(hasType(isVolatileQualified()))) --- matches b, c and --- e. --- It does not match as there --+ matches "void b(int volatile)", "void c(volatile int)" and --+ "void e(int volatile) {}". It does not match d as there -- is no top-level volatile on the parameter type "volatile int *". -- -- --@@ -7383,11 +5488,10 @@ -- -- Given -- class X { int a; int b; }; --- ---The matcher cxxRecordDecl( --+cxxRecordDecl( -- has(fieldDecl(hasName("a"), hasType(type().bind("t")))), -- has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) --- matches X, as a and b have the same type. --+ matches the class X, as a and b have the same type. -- -- Note that when multiple matches are involved via forEach* matchers, -- equalsBoundNodes acts as a filter. --@@ -7412,15 +5516,6 @@ -- Does not match if only part of the statement is expanded from that macro or -- if different parts of the statement are expanded from different -- appearances of the macro. --- ---Given --- #define A 0 --- #define B A --- int c = B; --- ---The matcher integerLiteral(isExpandedFromMacro("A")) ---matches the literal expanded at the initializer B of the variable ---c . -- -- -- --@@ -7428,25 +5523,12 @@ --
Matches AST nodes that were expanded within files whose name is
-- partially matching a given regex.
-- 
---Given the headers Y.h
---  #pragma once
---  typedef int my_y_int;
---and X.h
---  #pragma once
---  typedef int my_x_int;
---and the source code
---  #include "X.h"
---  #include "Y.h"
---  typedef int my_main_file_int;
---  my_main_file_int a = 0;
---  my_x_int b = 1;
---  my_y_int c = 2;
---
---The matcher
---typedefDecl(isExpansionInFileMatching("Y.h"))
---matches typedef int my_y_int,
---but does not match typedef int my_main_file_int or
---typedef int my_x_int.
--+Example matches Y but not X
--+    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
--+  #include "ASTMatcher.h"
--+  class X {};
--+ASTMatcher.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -7459,18 +5541,12 @@
-- Matcher<Stmt>isExpansionInMainFile
-- 
Matches AST nodes that were expanded within the main-file.
-- 
---Given the header Y.h
---  #pragma once
---  typedef int my_header_int;
---and the source file
---  #include "Y.h"
---  typedef int my_main_file_int;
---  my_main_file_int a = 0;
---  my_header_int b = 1;
---
---The matcher typedefDecl(isExpansionInMainFile())
---matches typedef int my_main_file_int,
---but does not match typedef int my_header_int.
--+Example matches X but not Y
--+  (matcher = cxxRecordDecl(isExpansionInMainFile())
--+  #include <Y.h>
--+  class X {};
--+Y.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -7479,17 +5555,12 @@ -- Matcher<Stmt>isExpansionInSystemHeader --
Matches AST nodes that were expanded within system-header-files.
-- 
---Given the header SystemHeader.h
---  #pragma once
---  int header();
---and the source code
--+Example matches Y but not X
--+    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
--   #include <SystemHeader.h>
---  static int main_file();
---
---
---The matcher functionDecl(isExpansionInSystemHeader())
---matches int header(),
---but does not match static int main_file().
--+  class X {};
--+SystemHeader.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -7500,18 +5571,14 @@ -- -- Given -- int j; --- template<typename T> void A(T t) { T i; } --- void foo() { --- A(0); --- A(0U); --- } --- ---The matcher declStmt(isInTemplateInstantiation()) ---matches T i; twice, once for int and once for ---int}. ---The matcher declStmt(unless(isInTemplateInstantiation())) will ---match T i; once inside the template definition, but not for any of ---the instantiated bodies. --+ template<typename T> void A(T t) { T i; j += 42;} --+ A(0); --+ A(0U); --+declStmt(isInTemplateInstantiation()) --+ matches 'int i;' and 'unsigned i'. --+unless(stmt(isInTemplateInstantiation())) --+ will NOT match j += 42; as it's shared between the template definition and --+ instantiation. --
-- -- --@@ -7525,28 +5592,21 @@ -- char *s = "abcd"; -- wchar_t *ws = L"abcd"; -- char *w = "a"; --- ---The matcher constantArrayType(hasSize(42)) ---matches int[42] twice. ---The matcher stringLiteral(hasSize(4)) ---matches "abcd" and L"abcd". --+constantArrayType(hasSize(42)) --+ matches "int a[42]" and "int b[2 * 21]" --+stringLiteral(hasSize(4)) --+ matches "abcd", L"abcd" -- -- -- -- Matcher<TagDecl>isClass --
Matches TagDecl object that are spelled with "class."
-- 
---Given
--+Example matches C, but not S, U or E.
--   struct S {};
--   class C {};
--   union U {};
---  enum E { Ok };
---
---The matcher tagDecl(isClass())
---matches class C,
---but does not match struct S,
---union U
---or enum E.
--+  enum E {};
-- 
-- -- --@@ -7560,14 +5620,6 @@ -- extern int vb; // Doesn't match, as it doesn't define the variable. -- void fa() {} -- void fb(); // Doesn't match, as it has no body. --- ---The matcher tagDecl(isDefinition()) ---matches A ---The matcher varDecl(isDefinition()) ---matches va ---The matcher functionDecl(isDefinition()) ---matches fa --- -- @interface X -- - (void)ma; // Doesn't match, interface is declaration. -- @end --@@ -7575,9 +5627,6 @@ -- - (void)ma {} -- @end -- ---The matcher objcMethodDecl(isDefinition()) ---matches - (void)ma {} --- -- Usable as: Matcher<TagDecl>, Matcher<VarDecl>, Matcher<FunctionDecl>, -- Matcher<ObjCMethodDecl> -- --@@ -7586,16 +5635,11 @@ -- Matcher<TagDecl>isEnum --
Matches TagDecl object that are spelled with "enum."
-- 
---Given
--+Example matches E, but not C, S or U.
--   struct S {};
--   class C {};
--   union U {};
---  enum E { Ok };
---
---The matcher tagDecl(isEnum())
---matches enum E { Ok },
---but does not match struct S {},
---class C {} or union U {}.
--+  enum E {};
-- 
-- -- --@@ -7606,30 +5650,18 @@ -- struct S {}; -- class C {}; -- union U {}; --- enum E { Ok }; --- ---The matcher tagDecl(isStruct()) ---matches struct S, ---but does not match class C, ---union U ---or enum E. --+ enum E {}; -- -- -- -- Matcher<TagDecl>isUnion --
Matches TagDecl object that are spelled with "union."
-- 
---Given
--+Example matches U, but not C, S or E.
--   struct S {};
--   class C {};
--   union U {};
---  enum E { Ok };
---
---The matcher tagDecl(isUnion())
---matches union U,
---does not match struct S,
---class C
---or enum E.
--+  enum E {};
-- 
-- -- --@@ -7643,12 +5675,9 @@ -- Given -- template<int T> struct C {}; -- C<42> c; --- ---The matcher classTemplateSpecializationDecl( --+classTemplateSpecializationDecl( -- hasAnyTemplateArgument(equalsIntegralValue("42"))) ---matches the implicitly declared specialization ---struct C<42> from the instantiation for the type of the ---variable c . --+ matches the implicit instantiation of C in C<42>. -- -- -- --@@ -7658,12 +5687,10 @@ -- Given -- template<int T> struct C {}; -- C<42> c; --- ---The matcher classTemplateSpecializationDecl( --+classTemplateSpecializationDecl( -- hasAnyTemplateArgument(isIntegral())) ---matches the implicitly declared specialization ---struct C<42> from the instantiation for the type of the ---variable c . --+ matches the implicit instantiation of C in C<42> --+ with isIntegral() matching 42. -- -- -- --@@ -7673,10 +5700,8 @@ -- Given -- template<typename T> struct C {}; -- C<int> c; --- ---The matcher -- classTemplateSpecializationDecl(templateArgumentCountIs(1)) ---matches struct C<int>. --+ matches C<int>. -- -- -- --@@ -7685,15 +5710,6 @@ -- Does not match if only part of the statement is expanded from that macro or -- if different parts of the statement are expanded from different -- appearances of the macro. --- ---Given --- #define A 0 --- #define B A --- int c = B; --- ---The matcher integerLiteral(isExpandedFromMacro("A")) ---matches the literal expanded at the initializer B of the variable ---c . -- -- -- --@@ -7701,25 +5717,12 @@ --
Matches AST nodes that were expanded within files whose name is
-- partially matching a given regex.
-- 
---Given the headers Y.h
---  #pragma once
---  typedef int my_y_int;
---and X.h
---  #pragma once
---  typedef int my_x_int;
---and the source code
---  #include "X.h"
---  #include "Y.h"
---  typedef int my_main_file_int;
---  my_main_file_int a = 0;
---  my_x_int b = 1;
---  my_y_int c = 2;
---
---The matcher
---typedefDecl(isExpansionInFileMatching("Y.h"))
---matches typedef int my_y_int,
---but does not match typedef int my_main_file_int or
---typedef int my_x_int.
--+Example matches Y but not X
--+    (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*"))
--+  #include "ASTMatcher.h"
--+  class X {};
--+ASTMatcher.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -7732,18 +5735,12 @@
-- Matcher<TypeLoc>isExpansionInMainFile
-- 
Matches AST nodes that were expanded within the main-file.
-- 
---Given the header Y.h
---  #pragma once
---  typedef int my_header_int;
---and the source file
---  #include "Y.h"
---  typedef int my_main_file_int;
---  my_main_file_int a = 0;
---  my_header_int b = 1;
---
---The matcher typedefDecl(isExpansionInMainFile())
---matches typedef int my_main_file_int,
---but does not match typedef int my_header_int.
--+Example matches X but not Y
--+  (matcher = cxxRecordDecl(isExpansionInMainFile())
--+  #include <Y.h>
--+  class X {};
--+Y.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -7752,17 +5749,12 @@ -- Matcher<TypeLoc>isExpansionInSystemHeader --
Matches AST nodes that were expanded within system-header-files.
-- 
---Given the header SystemHeader.h
---  #pragma once
---  int header();
---and the source code
--+Example matches Y but not X
--+    (matcher = cxxRecordDecl(isExpansionInSystemHeader())
--   #include <SystemHeader.h>
---  static int main_file();
---
---
---The matcher functionDecl(isExpansionInSystemHeader())
---matches int header(),
---but does not match static int main_file().
--+  class X {};
--+SystemHeader.h:
--+  class Y {};
-- 
-- Usable as: Matcher<Decl>, Matcher<Stmt>, Matcher<TypeLoc>
-- 
--@@ -7773,9 +5765,8 @@ -- -- Given -- struct S { bool func(); }; --- ---The matcher functionDecl(returns(booleanType())) ---func --+functionDecl(returns(booleanType())) --+ matches "bool func();" --
-- -- --@@ -7786,11 +5777,10 @@ -- -- Given -- class X { int a; int b; }; --- ---The matcher cxxRecordDecl( --+cxxRecordDecl( -- has(fieldDecl(hasName("a"), hasType(type().bind("t")))), -- has(fieldDecl(hasName("b"), hasType(type(equalsBoundNode("t")))))) --- matches X, as a and b have the same type. --+ matches the class X, as a and b have the same type. -- -- Note that when multiple matches are involved via forEach* matchers, -- equalsBoundNodes acts as a filter. --@@ -7816,9 +5806,8 @@ -- Given -- int i; -- float f; ---The matcher type(realFloatingPointType()) ---matches float ---but does not match int. --+realFloatingPointType() --+ matches "float f" but not "int i" -- -- -- --@@ -7827,10 +5816,8 @@ -- -- Given -- struct S { void func(); }; --- --- ---The matcher functionDecl(returns(voidType())) ---func --+functionDecl(returns(voidType())) --+ matches "void func();" -- -- -- --@@ -7839,10 +5826,9 @@ -- -- Given -- int x; --- int s = sizeof(x) + alignof(x); --- ---The matcher unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf)) ---matches sizeof(x) --+ int s = sizeof(x) + alignof(x) --+unaryExprOrTypeTraitExpr(ofKind(UETT_SizeOf)) --+ matches sizeof(x) -- -- If the matcher is use from clang-query, UnaryExprOrTypeTrait parameter -- should be passed as a quoted string. e.g., ofKind("UETT_SizeOf"). --@@ -7853,26 +5839,9 @@ --
Matches operator expressions (binary or unary) that have any of the
-- specified names.
-- 
---It provides a compact way of writing if an operator has any of the specified
---names:
---The matcher
--    hasAnyOperatorName("+", "-")
---Is equivalent to
---   hasOperatorName("-"))}
---
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
---
---void bar(bool a, bool b) {
---  a && b;
--- }
---
---The matcher binaryOperator(hasAnyOperatorName("||", "&&"))
---matches a || b and a && b.
---The matcher unaryOperator(hasAnyOperatorName("-", "!"))
---matches !(a || b).
--+ Is equivalent to
--+   anyOf(hasOperatorName("+"), hasOperatorName("-"))
-- 
-- -- --@@ -7880,22 +5849,15 @@ --
Matches the operator Name of operator expressions and fold expressions
-- (binary or unary).
-- 
---Given
---void foo(bool a, bool b) {
---  !(a || b);
--- }
--+Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
--+  !(a || b)
-- 
---The matcher binaryOperator(hasOperatorName("||"))
---matches a || b
---
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(hasOperatorName("+")))
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--   }
---
---The matcher cxxFoldExpr(hasOperatorName("+"))
--- matches (0 + ... + args).
-- 
-- -- --@@ -7914,57 +5876,40 @@ -- }; -- template <class T> -- class Z { --- void x() { --- this->m; --- this->t; --- this->t->m; --- } --- int m; --- T* t; --+ void x() { this->m; } -- }; --- ---The matcher memberExpr(isArrow()) ---matches this->x, x, a, ---this->b, this->m and two times this->t, ---once for the standalone member expression, and once for the member ---expression that later accesses m . ---Additionally, it does not match this->t->t. ---The matcher cxxDependentScopeMemberExpr(isArrow()) ---matches this->t->m, but not this->m or this->t. ---The matcher unresolvedMemberExpr(isArrow()) ---matches this->f<T>, f<T> --+memberExpr(isArrow()) --+ matches this->x, x, y.x, a, this->b --+cxxDependentScopeMemberExpr(isArrow()) --+ matches this->m --+unresolvedMemberExpr(isArrow()) --+ matches this->f<T>, f<T> -- -- -- -- Matcher<VarDecl>hasAutomaticStorageDuration --
Matches a variable declaration that has automatic storage duration.
-- 
---Given
--+Example matches x, but not y, z, or a.
--+(matcher = varDecl(hasAutomaticStorageDuration())
-- void f() {
--   int x;
--   static int y;
--   thread_local int z;
-- }
-- int a;
---
---The matcher varDecl(hasAutomaticStorageDuration())
---matches x
---but does not match y, z or
---a
-- 
-- -- -- Matcher<VarDecl>hasGlobalStorage --
Matches a variable declaration that does not have local storage.
-- 
---Given
--+Example matches y and z (matcher = varDecl(hasGlobalStorage())
-- void f() {
--   int x;
--   static int y;
-- }
-- int z;
---The matcher varDecl(hasGlobalStorage())
---matches y and z
-- 
-- -- --@@ -7972,14 +5917,12 @@ --
Matches a variable declaration that has function scope and is a
-- non-static local variable.
-- 
---Given
--+Example matches x (matcher = varDecl(hasLocalStorage())
-- void f() {
--   int x;
--   static int y;
-- }
-- int z;
---The matcher varDecl(hasLocalStorage())
---matches x
-- 
-- -- --@@ -7996,28 +5939,22 @@ -- int a; -- static int b; -- extern int c; --- ---The matcher varDecl(hasStaticStorageDuration()) ---matches y, a, b and ---c --+varDecl(hasStaticStorageDuration()) --+ matches the function declaration y, a, b and c. -- -- -- -- Matcher<VarDecl>hasThreadStorageDuration --
Matches a variable declaration that has thread storage duration.
-- 
---Given
--+Example matches z, but not x, z, or a.
--+(matcher = varDecl(hasThreadStorageDuration())
-- void f() {
--   int x;
--   static int y;
--   thread_local int z;
-- }
-- int a;
---
---The matcher varDecl(hasThreadStorageDuration())
---matches z
---but does not match x, z or
---a
-- 
-- -- --@@ -8025,34 +5962,29 @@ --
Matches constexpr variable and function declarations,
--        and if constexpr.
-- 
---Given
--+Given:
--   constexpr int foo = 42;
--   constexpr int bar();
--   void baz() { if constexpr(1 > 0) {} }
---
---The matcher varDecl(isConstexpr())
---matches foo.
---The matcher functionDecl(isConstexpr())
---matches bar.
---The matcher ifStmt(isConstexpr())
---matches if constexpr(1 > 0) {}.
--+varDecl(isConstexpr())
--+  matches the declaration of foo.
--+functionDecl(isConstexpr())
--+  matches the declaration of bar.
--+ifStmt(isConstexpr())
--+  matches the if statement in baz.
-- 
-- -- -- Matcher<VarDecl>isConstinit --
Matches constinit variable declarations.
-- 
---Given
--+Given:
--   constinit int foo = 42;
--   constinit const char* bar = "bar";
--   int baz = 42;
--   [[clang::require_constant_initialization]] int xyz = 42;
---
---The matcher varDecl(isConstinit())
---matches the declaration of foo
---and bar,
---but does not match baz or
---xyz.
--+varDecl(isConstinit())
--+  matches the declaration of `foo` and `bar`, but not `baz` and `xyz`.
-- 
-- -- --@@ -8066,14 +5998,6 @@ -- extern int vb; // Doesn't match, as it doesn't define the variable. -- void fa() {} -- void fb(); // Doesn't match, as it has no body. --- ---The matcher tagDecl(isDefinition()) ---matches A ---The matcher varDecl(isDefinition()) ---matches va ---The matcher functionDecl(isDefinition()) ---matches fa --- -- @interface X -- - (void)ma; // Doesn't match, interface is declaration. -- @end --@@ -8081,9 +6005,6 @@ -- - (void)ma {} -- @end -- ---The matcher objcMethodDecl(isDefinition()) ---matches - (void)ma {} --- -- Usable as: Matcher<TagDecl>, Matcher<VarDecl>, Matcher<FunctionDecl>, -- Matcher<ObjCMethodDecl> -- --@@ -8093,15 +6014,12 @@ --
Matches a variable declaration that is an exception variable from
-- a C++ catch block, or an Objective-C statement.
-- 
---Given
--+Example matches x (matcher = varDecl(isExceptionVariable())
-- void f(int y) {
--   try {
--   } catch (int x) {
--   }
-- }
---
---The matcher varDecl(isExceptionVariable())
---matches x
-- 
-- -- --@@ -8112,9 +6030,8 @@ -- Given -- template<typename T> void A(T t) { } -- template<> void A(int N) { } --- ---The matcher functionDecl(isExplicitTemplateSpecialization()) --- matches the specialization template<> void A(int N) { }. --+functionDecl(isExplicitTemplateSpecialization()) --+ matches the specialization A<int>(). -- -- Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl> -- --@@ -8123,21 +6040,17 @@ -- Matcher<VarDecl>isExternC --
Matches extern "C" function or variable declarations.
-- 
---Given
--+Given:
--   extern "C" void f() {}
--   extern "C" { void g() {} }
--   void h() {}
--   extern "C" int x = 1;
--   extern "C" int y = 2;
--   int z = 3;
---
---The matcher functionDecl(isExternC())
---matches f
---and g.
---The matcher varDecl(isExternC())
---matches x
---and y,
---but does not match z.
--+functionDecl(isExternC())
--+  matches the declaration of f and g, but not the declaration of h.
--+varDecl(isExternC())
--+  matches the declaration of x and y, but not the declaration of z.
-- 
-- -- --@@ -8145,11 +6058,8 @@ --
Matches a variable serving as the implicit variable for a lambda init-
-- capture.
-- 
---Given
---auto f = [x = 3]() { return x; };
---
---The matcher varDecl(isInitCapture())
---matches x = 3.
--+Example matches x (matcher = varDecl(isInitCapture()))
--+auto f = [x=3]() { return x; };
-- 
-- -- --@@ -8164,24 +6074,21 @@ -- inline namespace m {} -- } -- inline int Foo = 5; --- ---The matcher functionDecl(isInline()) matches f. ---The matcher namespaceDecl(isInline()) matches m. ---The matcher varDecl(isInline()) matches Foo --+functionDecl(isInline()) will match ::f(). --+namespaceDecl(isInline()) will match n::m. --+varDecl(isInline()) will match Foo; -- -- -- -- Matcher<VarDecl>isStaticLocal --
Matches a static variable with local scope.
-- 
---Given
--+Example matches y (matcher = varDecl(isStaticLocal()))
-- void f() {
--   int x;
--   static int y;
-- }
-- static int z;
---The matcher varDecl(isStaticLocal())
---matches y
-- 
-- -- --@@ -8189,15 +6096,15 @@ --
Matches variable/function declarations that have "static" storage
-- class specifier ("static" keyword) written in the source.
-- 
---Given
--+Given:
--   static void f() {}
--   static int i = 0;
--   extern int j;
--   int k;
---The matcher functionDecl(isStaticStorageClass())
---  matches f
---The matcher varDecl(isStaticStorageClass())
---  matches i
--+functionDecl(isStaticStorageClass())
--+  matches the function declaration f.
--+varDecl(isStaticStorageClass())
--+  matches the variable declaration i.
-- 
-- -- --@@ -8206,36 +6113,18 @@ -- member variable template instantiations. -- -- Given --- template <typename T> class X {}; --- class A {}; --- X<A> x; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches class X<class A>. --- template <typename T> class X {}; --- class A {}; --- template class X<A>; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches template class X<A> --- template <typename T> class X {}; --- class A {}; --- extern template class X<A>; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) ---matches extern template class X<A> --+ template <typename T> class X {}; class A {}; X<A> x; --+or --+ template <typename T> class X {}; class A {}; template class X<A>; --+or --+ template <typename T> class X {}; class A {}; extern template class X<A>; --+cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) --+ matches the template instantiation of X<A>. -- -- But given --- template <typename T> class X {}; --- class A {}; --- template <> class X<A> {}; --- X<A> x; --- ---The matcher cxxRecordDecl(hasName("::X"), ---isTemplateInstantiation()) --+ template <typename T> class X {}; class A {}; --+ template <> class X<A> {}; X<A> x; --+cxxRecordDecl(hasName("::X"), isTemplateInstantiation()) -- does not match, as X<A> is an explicit template specialization. -- -- Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl> --@@ -8262,9 +6151,10 @@ -- Matcher<*>binaryOperationMatcher<*>...Matcher<*> --
Matches nodes which can be used with binary operators.
-- 
---A comparison of two expressions might be represented in the clang AST as a
---binaryOperator, a cxxOperatorCallExpr or a
---cxxRewrittenBinaryOperator, depending on
--+The code
--+  var1 != var2;
--+might be represented in the clang AST as a binaryOperator, a
--+cxxOperatorCallExpr or a cxxRewrittenBinaryOperator, depending on
-- 
-- * whether the types of var1 and var2 are fundamental (binaryOperator) or at
--   least one is a class type (cxxOperatorCallExpr)
--@@ -8278,6 +6168,12 @@
-- compatible.
-- 
-- Given
--+  binaryOperation(
--+    hasOperatorName("!="),
--+    hasLHS(expr().bind("lhs")),
--+    hasRHS(expr().bind("rhs"))
--+  )
--+matches each use of "!=" in:
--   struct S{
--       bool operator!=(const S&) const;
--   };
--@@ -8291,28 +6187,25 @@
--   template<typename T>
--   void templ()
--   {
---     3 != 4;
--+     1 != 2;
--      T() != S();
--   }
--   struct HasOpEq
--   {
---      friend bool
---      operator==(const HasOpEq &, const HasOpEq&) noexcept = default;
--+      bool operator==(const HasOpEq &) const;
--   };
-- 
--   void inverse()
--   {
---      HasOpEq e1;
---      HasOpEq e2;
---      if (e1 != e2)
--+      HasOpEq s1;
--+      HasOpEq s2;
--+      if (s1 != s2)
--           return;
--   }
-- 
--   struct HasSpaceship
--   {
---      friend bool
---      operator<=>(const HasSpaceship &,
---                  const HasSpaceship&) noexcept = default;
--+      bool operator<=>(const HasOpEq &) const;
--   };
-- 
--   void use_spaceship()
--@@ -8322,15 +6215,6 @@
--       if (s1 != s2)
--           return;
--   }
---
---
---The matcher binaryOperation(
---    hasOperatorName("!="),
---    hasLHS(expr().bind("lhs")),
---    hasRHS(expr().bind("rhs"))
---  )
---matches 1 != 2, S() != S(), 3 != 4,
---T() != S(), e1 != e2 and s1 != s2.
-- 
-- -- --@@ -8340,18 +6224,14 @@ -- Unlike anyOf, eachOf will generate a match result for each -- matching submatcher. -- ---Given --- void f(int a, int b); --- --- ---The matcher functionDecl(hasAnyParameter( ---eachOf(parmVarDecl(hasName("a")).bind("v"), --- parmVarDecl(hasName("b")).bind("v")))) ---matches void f(int a, int b), ---with parmVarDecl(hasName("a")) matching a ---for one match, ---and with parmVarDecl(hasName("b")) matching ---b for the other match. --+For example, in: --+ class A { int a; int b; }; --+The matcher: --+ cxxRecordDecl(eachOf(has(fieldDecl(hasName("a")).bind("v")), --+ has(fieldDecl(hasName("b")).bind("v")))) --+will generate two results binding "v", the first of which binds --+the field declaration of a, the second the field declaration of --+b. -- -- Usable as: Any Matcher -- --@@ -8364,14 +6244,10 @@ -- -- For example, in: -- class A { class B {}; class C {}; }; --- ---The matcher ---cxxRecordDecl(hasName("::A"), --+The matcher: --+ cxxRecordDecl(hasName("::A"), -- findAll(cxxRecordDecl(isDefinition()).bind("m"))) ---matches A three times, ---with cxxRecordDecl(isDefinition()).bind("m") ---matching A, ---B and C. --+will generate results for A, B and C. -- -- Usable as: Any Matcher -- --@@ -8381,71 +6257,24 @@ --
Matches AST nodes that have descendant AST nodes that match the
-- provided matcher.
-- 
---Given
--+Example matches X, A, A::X, B, B::C, B::C::X
--+  (matcher = cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X")))))
--   class X {};
--   class A { class X {}; };  // Matches A, because A::X is a class of name
--                             // X inside A.
--   class B { class C { class X {}; }; };
-- 
---The matcher
---cxxRecordDecl(forEachDescendant(cxxRecordDecl(hasName("X"))))
---matches X, A,
---B, class B::C
---and class B::C::X
---
-- DescendantT must be an AST base type.
-- 
-- As opposed to 'hasDescendant', 'forEachDescendant' will cause a match for
-- each result that matches instead of only on the first one.
-- 
-- Note: Recursively combined ForEachDescendant can cause many matches:
---  struct A {
---    struct B {
---      struct C {};
---      struct D {};
---    };
---  };
---
---
---The matcher cxxRecordDecl(forEachDescendant(cxxRecordDecl(
---    forEachDescendant(cxxRecordDecl().bind("inner"))
---  ).bind("middle")))
---will match 9 times:
---It matches the definition of A with the definition of
---B in the middle and the injected class name of
---B as the innermost cxxRecordDecl.
---
---It matches the definition of A with the definition of
---C in the middle and the definition of
---B as the innermost cxxRecordDecl.
---
---It matches the definition of A with the definition of
---C in the middle and the injected class name of
---B as the innermost cxxRecordDecl.
---
---It matches the definition of A with the definition of
---B in the middle and the definition of
---D as the innermost cxxRecordDecl.
---
---It matches the definition of A with the definition of
---B in the middle and the injected class name of
---D as the innermost cxxRecordDecl.
---
---It matches the definition of A with the definition of
---C in the middle and the injected class name of
---C as the innermost cxxRecordDecl.
---
---It matches the definition of A with the definition of
---D in the middle and the injected class name of
---D as the innermost cxxRecordDecl.
---
---It matches the definition of B with the definition of
---C in the middle and the injected class name of
---C as the innermost cxxRecordDecl.
---
---It matches the definition of B with the definition of
---D in the middle and the injected class name of
---D as the innermost cxxRecordDecl.
--+  cxxRecordDecl(forEachDescendant(cxxRecordDecl(
--+    forEachDescendant(cxxRecordDecl())
--+  )))
--+will match 10 times (plus injected class name matches) on:
--+  class A { class B { class C { class D { class E {}; }; }; }; };
-- 
-- Usable as: Any Matcher
-- 
--@@ -8455,22 +6284,17 @@ --
Matches AST nodes that have child AST nodes that match the
-- provided matcher.
-- 
---Given
--+Example matches X, Y, Y::X, Z::Y, Z::Y::X
--+  (matcher = cxxRecordDecl(forEach(cxxRecordDecl(hasName("X")))
--   class X {};
--   class Y { class X {}; };  // Matches Y, because Y::X is a class of name X
--                             // inside Y.
--   class Z { class Y { class X {}; }; };  // Does not match Z.
-- 
---The matcher cxxRecordDecl(forEach(cxxRecordDecl(hasName("X"))))
---matches class X,
---class Y,
---class Y::X,
---class Z::Y::X and class Z::Y
---
-- ChildT must be an AST base type.
-- 
-- As opposed to 'has', 'forEach' will cause a match for each result that
---  matches instead of only on the first one.
--+matches instead of only on the first one.
-- 
-- Usable as: Any Matcher
-- 
--@@ -8483,10 +6307,7 @@ -- Given -- void f() { if (true) { int x = 42; } } -- void g() { for (;;) { int x = 43; } } --- ---The matcher expr(integerLiteral(hasAncestor(ifStmt()))) ---matches 42 ---but does not match 43 --+expr(integerLiteral(hasAncestor(ifStmt()))) matches 42, but not 43. -- -- Usable as: Any Matcher -- --@@ -8496,16 +6317,12 @@ --
Matches AST nodes that have descendant AST nodes that match the
-- provided matcher.
-- 
---Given
--+Example matches X, Y, Z
--+    (matcher = cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X")))))
--   class X {};  // Matches X, because X::X is a class of name X inside X.
--   class Y { class X {}; };
--   class Z { class Y { class X {}; }; };
-- 
---The matcher
---cxxRecordDecl(hasDescendant(cxxRecordDecl(hasName("X"))))
---matches class X {}, class Y { class X {}; }
---and class Z { class Y { class X {}; }; }.
---
-- DescendantT must be an AST base type.
-- 
-- Usable as: Any Matcher
--@@ -8516,29 +6333,19 @@
-- 
Matches AST nodes that have child AST nodes that match the
-- provided matcher.
-- 
---Given
--+Example matches X, Y
--+  (matcher = cxxRecordDecl(has(cxxRecordDecl(hasName("X")))
--   class X {};  // Matches X, because X::X is a class of name X inside X.
--   class Y { class X {}; };
--   class Z { class Y { class X {}; }; };  // Does not match Z.
-- 
---The matcher cxxRecordDecl(has(cxxRecordDecl(hasName("X"))))
---matches class X {} three times,
---and class Y { class X {}; } two times.
---
-- ChildT must be an AST base type.
-- 
-- Usable as: Any Matcher
-- Note that has is direct matcher, so it also matches things like implicit
-- casts and paren casts. If you are matching with expr then you should
---probably consider using ignoringParenImpCasts:
---
---Given
---  int x =0;
---  double y = static_cast<double>(x);
---
---The matcher
---cxxStaticCastExpr(has(ignoringParenImpCasts(declRefExpr()))).
---matches static_cast<double>(x)
--+probably consider using ignoringParenImpCasts like:
--+has(ignoringParenImpCasts(expr())).
-- 
-- -- --@@ -8548,9 +6355,7 @@ -- -- Given -- void f() { for (;;) { int x = 42; if (true) { int x = 43; } } } --- ---The matcher compoundStmt(hasParent(ifStmt())) ---matches { int x = 43; } --+compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }". -- -- Usable as: Any Matcher --
--@@ -8564,7 +6369,7 @@ -- which should match both are typically duplicated. This matcher -- removes the need for duplication. -- ---Given --+Given code -- struct ConstructorTakesInt -- { -- ConstructorTakesInt(int i) {} --@@ -8584,11 +6389,9 @@ -- ConstructorTakesInt cti(42); -- } -- --- -- The matcher ---expr(invocation(hasArgument(0, integerLiteral(equals(42))))) ---matches the expressions callTakesInt(42) ---and cti(42). --+invocation(hasArgument(0, integerLiteral(equals(42)))) --+matches the expression in both doCall and doConstruct -- -- -- --@@ -8599,12 +6402,18 @@ -- Useful when additional information which may or may not present about a main -- matching node is desired. -- ---Given --- int a = 0; --- int b; --- ---The matcher varDecl(optionally(hasInitializer(expr()))) ---matches int a = 0 and int b. --+For example, in: --+ class Foo { --+ int bar; --+ } --+The matcher: --+ cxxRecordDecl( --+ optionally(has( --+ fieldDecl(hasName("bar")).bind("var") --+ ))).bind("record") --+will produce a result binding for both "record" and "var". --+The matcher will produce a "record" binding for even if there is no data --+member named "bar" in that class. -- -- Usable as: Any Matcher -- --@@ -8619,10 +6428,10 @@ -- int i = 3.0; -- } -- The matcher ---traverse(TK_IgnoreUnlessSpelledInSource, --+ traverse(TK_IgnoreUnlessSpelledInSource, -- varDecl(hasInitializer(floatLiteral().bind("init"))) -- ) --- matches int i = 3.0 with "init" bound to 3.0. --+matches the variable declaration with "init" bound to the "3.0". -- -- -- --@@ -8630,13 +6439,8 @@ --
Matches the condition expression of an if statement, for loop,
-- switch statement or conditional operator.
-- 
---Given
---void foo() {
--+Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
--   if (true) {}
---}
---
---The matcher ifStmt(hasCondition(cxxBoolLiteral(equals(true))))
---if (true) {}
-- 
-- -- --@@ -8645,19 +6449,8 @@ -- (binary or ternary). -- -- Example matches b --- void foo(bool condition, int a, int b) { --- condition ? a : b; --- condition ?: b; --- } --- ---The matcher ---conditionalOperator(hasFalseExpression(expr().bind("false"))) ---matches condition ? a : b, ---with expr() matching b. ---The matcher ---binaryConditionalOperator(hasFalseExpression(expr().bind("false"))) ---matches condition ?: b, ---with expr() matching b. --+ condition ? a : b --+ condition ?: b -- -- -- --@@ -8665,31 +6458,16 @@ --
Matches the true branch expression of a conditional operator.
-- 
-- Example 1 (conditional ternary operator): matches a
---Given
---  void foo(bool condition, int a, int b) {
---    condition ? a : b;
---  }
---
---The matcher
---conditionalOperator(hasTrueExpression(expr().bind("true")))
---matches condition ? a : b,
---with expr() matching a.
--+  condition ? a : b
-- 
-- Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
---Given
---  void foo(bool condition, int a, int b) {
---    condition ?: b;
---  }
---
---The matcher binaryConditionalOperator(hasTrueExpression(expr()))
---matches condition ?: b,
---with expr() matching conditoin.
--+  condition ?: b
-- 
-- -- -- Matcher<AddrLabelExpr>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -8699,25 +6477,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -8735,7 +6505,7 @@
-- Given
--   int i[5];
--   void f() { i[1] = 42; }
---The matcher arraySubscriptExpr(hasBase(implicitCastExpr(
--+arraySubscriptExpression(hasBase(implicitCastExpr(
--     hasSourceExpression(declRefExpr()))))
--   matches i[1] with the declRefExpr() matching i
-- 
--@@ -8747,7 +6517,7 @@ -- Given -- int i[5]; -- void f() { i[1] = 42; } ---The matcher arraySubscriptExpr(hasIndex(integerLiteral())) --+arraySubscriptExpression(hasIndex(integerLiteral())) -- matches i[1] with the integerLiteral() matching 1 -- -- --@@ -8755,30 +6525,16 @@ -- Matcher<ArraySubscriptExpr>hasLHSMatcher<Expr> InnerMatcher --
Matches the left hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasLHS(expr().bind("lhs")))
---matches a || b,
---with expr()
---matching a.
--+Example matches a (matcher = binaryOperator(hasLHS()))
--+  a || b
-- 
-- -- -- Matcher<ArraySubscriptExpr>hasRHSMatcher<Expr> InnerMatcher --
Matches the right hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasRHS(expr().bind("rhs")))
---matches a || b,
---with expr()
---matching b.
--+Example matches b (matcher = binaryOperator(hasRHS()))
--+  a || b
-- 
-- -- --@@ -8790,10 +6546,8 @@ -- struct A {}; -- A a[7]; -- int b[7]; --- --- ---The matcher arrayType(hasElementType(builtinType())) ---int[7] --+arrayType(hasElementType(builtinType())) --+ matches "int b[7]" -- -- Usable as: Matcher<ArrayType>, Matcher<ComplexType> -- --@@ -8805,8 +6559,8 @@ -- Given -- _Atomic(int) i; -- _Atomic(float) f; ---The matcher atomicType(hasValueType(isInteger())) ---_Atomic(int). --+atomicType(hasValueType(isInteger())) --+ matches "_Atomic(int) i" -- -- Usable as: Matcher<AtomicType> -- --@@ -8821,10 +6575,8 @@ -- Given -- auto a = 1; -- auto b = 2.0; --- ---The matcher ---varDecl(hasType(autoType(hasDeducedType(isInteger())))) ---matches auto a = 1, but does not match auto b = 2.0. --+autoType(hasDeducedType(isInteger())) --+ matches "auto a" -- -- Usable as: Matcher<AutoType> -- --@@ -8836,54 +6588,21 @@ -- Given -- namespace X { void b(); } -- using X::b; --- ---The matcher usingDecl(hasAnyUsingShadowDecl(hasName("b"))) --- matches using X::b --- --+usingDecl(hasAnyUsingShadowDecl(hasName("b")))) --+ matches using X::b -- -- -- Matcher<BinaryOperator>hasEitherOperandMatcher<Expr> InnerMatcher --
Matches if either the left hand side or the right hand side of a
-- binary operator or fold expression matches.
---
---Given
---  struct S {};
---  bool operator ==(const S&, const S&);
---
---  void f(int a, const S&lhs, const S&rhs) {
---      a + 0;
---      lhs == rhs;
---      lhs != rhs;
---  }
---
---  template <typename ...Ts>
---  auto sum(Ts... args) {
---    return (0 + ... + args);
---  }
---
---
---The matcher binaryOperator(hasEitherOperand(integerLiteral()))
---matches a + 0.
---The matcher cxxOperatorCallExpr(hasEitherOperand(declRefExpr(to(
---parmVarDecl(hasName("lhs")))))) matches lhs == rhs and
---lhs != rhs.
---The matcher cxxFoldExpr(hasEitherOperand(integerLiteral()))
---matches (0 + ... + args).
-- 
-- -- -- Matcher<BinaryOperator>hasLHSMatcher<Expr> InnerMatcher --
Matches the left hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasLHS(expr().bind("lhs")))
---matches a || b,
---with expr()
---matching a.
--+Example matches a (matcher = binaryOperator(hasLHS()))
--+  a || b
-- 
-- -- --@@ -8891,40 +6610,27 @@ --
Matches if both matchers match with opposite sides of the binary operator
-- or fold expression.
-- 
---Given
---void foo() {
---  1 + 2; // Match
---  2 + 1; // Match
---  1 + 1; // No match
---  2 + 2; // No match
---}
---The matcher binaryOperator(hasOperands(integerLiteral(equals(1)),
---                                            integerLiteral(equals(2))))
---matches 1 + 2 and 2 + 1,
---but does not match 1 + 1
---or 2 + 2.
--+Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
--+                                             integerLiteral(equals(2)))
--+  1 + 2 // Match
--+  2 + 1 // Match
--+  1 + 1 // No match
--+  2 + 2 // No match
-- 
-- -- -- Matcher<BinaryOperator>hasRHSMatcher<Expr> InnerMatcher --
Matches the right hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasRHS(expr().bind("rhs")))
---matches a || b,
---with expr()
---matching b.
--+Example matches b (matcher = binaryOperator(hasRHS()))
--+  a || b
-- 
-- -- -- Matcher<BindingDecl>forDecompositionMatcher<ValueDecl> InnerMatcher --
Matches the DecompositionDecl the binding belongs to.
-- 
---Given
--+For example, in:
-- void foo()
-- {
--     int arr[3];
--@@ -8932,10 +6638,10 @@
-- 
--     f = 42;
-- }
---
---The matcher bindingDecl(hasName("f"),
---                forDecomposition(decompositionDecl()))
---matches f in 'auto &[f, s, t]'.
--+The matcher:
--+  bindingDecl(hasName("f"),
--+                forDecomposition(decompositionDecl())
--+matches 'f' in 'auto &[f, s, t]'.
-- 
-- -- --@@ -8947,26 +6653,23 @@ -- -- Given -- class X { void f(int x, int y, int z) {} }; --- ---The matcher cxxMethodDecl(hasAnyParameter(hasName("y"))) --- matches f --+cxxMethodDecl(hasAnyParameter(hasName("y"))) --+ matches f(int x, int y, int z) {} -- with hasAnyParameter(...) -- matching int y -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- --- -- the matcher objcMethodDecl(hasAnyParameter(hasName("y"))) --- matches the declaration of method f with hasParameter --+matches the declaration of method f with hasParameter -- matching y. -- -- For blocks, given -- b = ^(int y) { printf("%d", y) }; -- --- -- the matcher blockDecl(hasAnyParameter(hasName("y"))) --- matches the declaration of the block b with hasParameter --+matches the declaration of the block b with hasParameter -- matching y. -- -- --@@ -8977,18 +6680,15 @@ -- -- Given -- class X { void f(int x) {} }; --- ---The matcher ---cxxMethodDecl(hasParameter(0, hasType(asString("int")))) ---matches f --+cxxMethodDecl(hasParameter(0, hasType(varDecl()))) --+ matches f(int x) {} -- with hasParameter(...) ---matching int x. --+ matching int x -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- --- ---The matcher objcMethodDecl(hasParameter(0, hasName("y"))) --+the matcher objcMethodDecl(hasParameter(0, hasName("y"))) -- matches the declaration of method f with hasParameter -- matching y. -- --@@ -8997,26 +6697,19 @@ -- Matcher<BlockDecl>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
---
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -9035,14 +6728,10 @@
-- 
-- Given
--   int *a;
---  const int *b;
---  int * const c = nullptr;
---  const float *f;
---
---The matcher pointerType(pointee(isConstQualified(), isInteger()))
---matches const int *,
---but does not match int * const
---or const float *.
--+  int const *b;
--+  float const *f;
--+pointerType(pointee(isConstQualified(), isInteger()))
--+  matches "int const *b"
-- 
-- Usable as: Matcher<BlockPointerType>, Matcher<MemberPointerType>,
--   Matcher<PointerType>, Matcher<ReferenceType>
--@@ -9052,26 +6741,19 @@
-- Matcher<CXXBaseSpecifier>hasTypeLocMatcher<TypeLoc> Inner
-- 
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
---
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -9094,31 +6776,21 @@
-- X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
-- declaration of x.
-- 
--+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
--+            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
--+            and friend class X (matcher = friendDecl(hasType("X"))
--+            and public virtual X (matcher = cxxBaseSpecifier(hasType(
--+                                              cxxRecordDecl(hasName("X"))))
--  class X {};
--  void y(X &x) { x; X z; }
--  class Y { friend class X; };
--  class Z : public virtual X {};
-- 
---The matcher expr(hasType(cxxRecordDecl(hasName("X"))))
---matches x and z.
---The matcher varDecl(hasType(cxxRecordDecl(hasName("X"))))
---matches z.
---The matcher friendDecl(hasType(asString("class X")))
---matches friend class X.
---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType(
---asString("X"))).bind("b"))) matches
---class Z : public virtual X {},
---with cxxBaseSpecifier(...)
---matching public virtual X.
---
---Given
--+Example matches class Derived
--+(matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
-- class Base {};
-- class Derived : Base {};
-- 
---The matcher
---cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base")))))
---matches class Derived : Base {}.
---
-- Usable as: Matcher<Expr>, Matcher<FriendDecl>, Matcher<ValueDecl>,
-- Matcher<CXXBaseSpecifier>
-- 
--@@ -9128,25 +6800,17 @@ --
Matches if the expression's or declaration's type matches a type
-- matcher.
-- 
---Exmaple
--+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
--+            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
--+            and U (matcher = typedefDecl(hasType(asString("int")))
--+            and friend class X (matcher = friendDecl(hasType("X"))
--+            and public virtual X (matcher = cxxBaseSpecifier(hasType(
--+                                              asString("class X")))
--  class X {};
--  void y(X &x) { x; X z; }
--  typedef int U;
--  class Y { friend class X; };
--  class Z : public virtual X {};
---
---The matcher expr(hasType(cxxRecordDecl(hasName("X"))))
---matches x and z.
---The matcher varDecl(hasType(cxxRecordDecl(hasName("X"))))
---matches z
---The matcher typedefDecl(hasType(asString("int")))
---matches typedef int U
---The matcher friendDecl(hasType(asString("class X")))
---matches friend class X
---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType(
---asString("X"))).bind("b"))) matches class Z : public virtual X {},
---with cxxBaseSpecifier(...)
---matching public virtual X.
-- 
-- -- --@@ -9156,10 +6820,8 @@ -- Given -- void f(int i); -- int y; --- void foo() { --- f(y); --- } ---The matcher callExpr( --+ f(y); --+callExpr( -- forEachArgumentWithParam( -- declRefExpr(to(varDecl(hasName("y")))), -- parmVarDecl(hasType(isInteger())) --@@ -9182,15 +6844,14 @@ -- -- Given -- void f(int i); --- void foo(int y) { --- f(y); --- void (*f_ptr)(int) = f; --- f_ptr(y); --- } ---The matcher callExpr( --+ int y; --+ f(y); --+ void (*f_ptr)(int) = f; --+ f_ptr(y); --+callExpr( -- forEachArgumentWithParamType( -- declRefExpr(to(varDecl(hasName("y")))), --- qualType(isInteger()).bind("type") --+ qualType(isInteger()).bind("type) -- )) -- matches f(y) and f_ptr(y) -- with declRefExpr(...) --@@ -9205,19 +6866,17 @@ -- expression, or an ObjC-message-send expression. -- -- Given --- void x(int, int, int) { int y = 42; x(1, y, 42); } ---The matcher ---callExpr(hasAnyArgument(ignoringImplicit(declRefExpr()))) matches ---x(1, y, 42) with hasAnyArgument(...) --+ void x(int, int, int) { int y; x(1, y, 42); } --+callExpr(hasAnyArgument(declRefExpr())) --+ matches x(1, y, 42) --+with hasAnyArgument(...) -- matching y -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- void foo(I *i) { [i f:12]; } --- ---The matcher -- objcMessageExpr(hasAnyArgument(integerLiteral(equals(12)))) ---matches [i f:12] --+ matches [i f:12] --
-- -- --@@ -9225,17 +6884,15 @@ --
Matches the n'th argument of a call expression or a constructor
-- call expression.
-- 
---Given
--+Example matches y in x(y)
--+    (matcher = callExpr(hasArgument(0, declRefExpr())))
--   void x(int) { int y; x(y); }
---The matcher callExpr(hasArgument(0, declRefExpr().bind("arg")))
---matches x(y),
---with declRefExpr() matching y.
-- 
-- -- -- Matcher<CXXConstructExpr>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -9245,25 +6902,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -9280,12 +6929,10 @@
-- 
-- Given
--   class A { A() : i(42), j(42) {} int i; int j; };
---
---The matcher cxxConstructorDecl(forEachConstructorInitializer(
---  forField(fieldDecl().bind("x"))))
---matches the constructor of A twice, with
---fieldDecl() matching i and
---j respectively.
--+cxxConstructorDecl(forEachConstructorInitializer(
--+  forField(decl().bind("x"))
--+))
--+  will trigger two matches, binding for 'i' and 'j' respectively.
-- 
-- -- --@@ -9297,11 +6944,10 @@ -- Foo() : foo_(1) { } -- int foo_; -- }; --- ---The matcher cxxRecordDecl(has(cxxConstructorDecl( --+cxxRecordDecl(has(cxxConstructorDecl( -- hasAnyConstructorInitializer(anything()) -- ))) ---matches Foo, hasAnyConstructorInitializer matches foo_(1) --+ record matches Foo, hasAnyConstructorInitializer matches foo_(1) -- -- -- --@@ -9313,11 +6959,9 @@ -- Foo() : foo_(1) { } -- int foo_; -- }; --- ---The matcher -- cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer( -- forField(hasName("foo_")))))) ---matches Foo --+ matches Foo -- with forField matching foo_ -- -- --@@ -9325,26 +6969,19 @@ -- Matcher<CXXCtorInitializer>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
---
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -9365,11 +7002,9 @@
--     Foo() : foo_(1) { }
--     int foo_;
--   };
---
---The matcher
-- cxxRecordDecl(has(cxxConstructorDecl(hasAnyConstructorInitializer(
--     withInitializer(integerLiteral(equals(1)))))))
---matches Foo
--+  matches Foo
-- with withInitializer matching (1)
-- 
-- --@@ -9384,14 +7019,11 @@ -- int m; -- int f(X x) { x.m; return m; } -- }; --- --- ---The matcher -- memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X"))))) ---matches x.m, but not m; however, ---The matcher memberExpr(hasObjectExpression(hasType(pointsTo( ---cxxRecordDecl(hasName("X")))))) ---matches m (aka. this->m), but not x.m. --+ matches `x.m`, but not `m`; however, --+memberExpr(hasObjectExpression(hasType(pointsTo( --+ cxxRecordDecl(hasName("X")))))) --+ matches `m` (aka. `this->m`), but not `x.m`. -- -- -- --@@ -9401,20 +7033,12 @@ -- Given -- class Y { void x() { this->x(); x(); Y y; y.x(); } }; -- void f() { f(); } --- ---The matcher callExpr(callee(expr().bind("callee"))) ---matches this->x(), x(), y.x(), f() ---with expr() inside of callee ---matching this->x, x, ---y.x, f respectively --+callExpr(callee(expr())) --+ matches this->x(), x(), y.x(), f() --+with callee(...) --+ matching this->x, x, y.x, f respectively -- -- Given --- struct Dummy {}; --- // makes sure there is a callee, otherwise there would be no callee, --- // just a builtin operator --- Dummy operator+(Dummy, Dummy); --- // not defining a '*' operator --- -- template <typename... Args> -- auto sum(Args... args) { -- return (0 + ... + args); --@@ -9424,14 +7048,10 @@ -- auto multiply(Args... args) { -- return (args * ... * 1); -- } --- ---The matcher cxxFoldExpr(callee(expr().bind("op"))) ---matches (0 + ... + args) ---with callee(...) matching *, ---but does not match (args * ... * 1). ---A CXXFoldExpr only has an UnresolvedLookupExpr as a callee. ---When there are no define operators that could be used instead of builtin ---ones, then there will be no callee . --+cxxFoldExpr(callee(expr())) --+ matches (args * ... * 1) --+with callee(...) --+ matching * -- -- Note: Callee cannot take the more general internal::Matcher<Expr> -- because this introduces ambiguous overloads with calls to Callee taking a --@@ -9443,37 +7063,16 @@ -- Matcher<CXXFoldExpr>hasEitherOperandMatcher<Expr> InnerMatcher --
Matches if either the left hand side or the right hand side of a
-- binary operator or fold expression matches.
---
---Given
---  struct S {};
---  bool operator ==(const S&, const S&);
---
---  void f(int a, const S&lhs, const S&rhs) {
---      a + 0;
---      lhs == rhs;
---      lhs != rhs;
---  }
---
---  template <typename ...Ts>
---  auto sum(Ts... args) {
---    return (0 + ... + args);
---  }
---
---
---The matcher binaryOperator(hasEitherOperand(integerLiteral()))
---matches a + 0.
---The matcher cxxOperatorCallExpr(hasEitherOperand(declRefExpr(to(
---parmVarDecl(hasName("lhs")))))) matches lhs == rhs and
---lhs != rhs.
---The matcher cxxFoldExpr(hasEitherOperand(integerLiteral()))
---matches (0 + ... + args).
-- 
-- -- -- Matcher<CXXFoldExpr>hasFoldInitMatcher<Expr> InnerMacher --
Matches the operand that does not contain the parameter pack.
-- 
---Given
--+Example matches `(0 + ... + args)` and `(args * ... * 1)`
--+    (matcher = cxxFoldExpr(hasFoldInit(expr())))
--+  with hasFoldInit(...)
--+    matching `0` and `1` respectively
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--@@ -9483,27 +7082,14 @@
--   auto multiply(Args... args) {
--       return (args * ... * 1);
--   }
---
---
---The matcher cxxFoldExpr(hasFoldInit(expr().bind("init")))
---matches (0 + ... + args) and (args * ... * 1)
---with hasFoldInit(expr().bind("init")) matching
---0 and 1.
-- 
-- -- -- Matcher<CXXFoldExpr>hasLHSMatcher<Expr> InnerMatcher --
Matches the left hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasLHS(expr().bind("lhs")))
---matches a || b,
---with expr()
---matching a.
--+Example matches a (matcher = binaryOperator(hasLHS()))
--+  a || b
-- 
-- -- --@@ -9511,25 +7097,22 @@ --
Matches if both matchers match with opposite sides of the binary operator
-- or fold expression.
-- 
---Given
---void foo() {
---  1 + 2; // Match
---  2 + 1; // Match
---  1 + 1; // No match
---  2 + 2; // No match
---}
---The matcher binaryOperator(hasOperands(integerLiteral(equals(1)),
---                                            integerLiteral(equals(2))))
---matches 1 + 2 and 2 + 1,
---but does not match 1 + 1
---or 2 + 2.
--+Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
--+                                             integerLiteral(equals(2)))
--+  1 + 2 // Match
--+  2 + 1 // Match
--+  1 + 1 // No match
--+  2 + 2 // No match
-- 
-- -- -- Matcher<CXXFoldExpr>hasPatternMatcher<Expr> InnerMacher --
Matches the operand that contains the parameter pack.
-- 
---Given
--+Example matches `(0 + ... + args)`
--+    (matcher = cxxFoldExpr(hasPattern(expr())))
--+  with hasPattern(...)
--+    matching `args`
--   template <typename... Args>
--   auto sum(Args... args) {
--       return (0 + ... + args);
--@@ -9539,27 +7122,14 @@
--   auto multiply(Args... args) {
--       return (args * ... * 1);
--   }
---
---
---The matcher cxxFoldExpr(hasPattern(expr().bind("pattern")))
---matches (0 + ... + args) and (args * ... * 1),
---with hasPattern(expr().bind("pattern")) matching
---args two times.
-- 
-- -- -- Matcher<CXXFoldExpr>hasRHSMatcher<Expr> InnerMatcher --
Matches the right hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasRHS(expr().bind("rhs")))
---matches a || b,
---with expr()
---matching b.
--+Example matches b (matcher = binaryOperator(hasRHS()))
--+  a || b
-- 
-- -- --@@ -9570,32 +7140,27 @@ -- other declarations of the same function or coroutine. -- -- Given ---void foo() { -- for (;;) {} ---} ---The matcher forStmt(hasBody(compoundStmt().bind("body"))) ---matches for (;;) {} --+forStmt(hasBody(compoundStmt())) --+ matches 'for (;;) {}' -- with compoundStmt() --- matching {} --+ matching '{}' -- -- Given -- void f(); -- void f() {} ---The matcher functionDecl(hasBody(compoundStmt().bind("compound"))) ---f --+functionDecl(hasBody(compoundStmt())) --+ matches 'void f() {}' -- with compoundStmt() ---matching {} ---but does not match void f(); --+ matching '{}' --+ but does not match 'void f();' -- -- -- -- Matcher<CXXForRangeStmt>hasInitStatementMatcher<Stmt> InnerMatcher --
Matches selection statements with initializer.
-- 
---Given
--- struct vec { int* begin(); int* end(); };
--- int foobar();
--- vec& get_range();
--+Given:
--  void foo() {
--    if (int i = foobar(); i > 0) {}
--    switch (int i = foobar(); i) {}
--@@ -9606,71 +7171,51 @@
--    switch (foobar()) {}
--    for (auto& x : get_range()) {}
--  }
---
---The matcher ifStmt(hasInitStatement(anything()))
---  matches the if statement if (int i = foobar(); i > 0) {}
---  in foo but not if (foobar() > 0) {} in bar.
---The matcher switchStmt(hasInitStatement(anything()))
---  matches the switch statement switch (int i = foobar(); i) {}
---  in foo but not switch (foobar()) {} in bar.
---The matcher cxxForRangeStmt(hasInitStatement(anything()))
---  matches the range for statement
---  for (auto& a = get_range(); auto& x : a) {} in foo
---  but not for (auto& x : get_range()) {} in bar.
--+ifStmt(hasInitStatement(anything()))
--+  matches the if statement in foo but not in bar.
--+switchStmt(hasInitStatement(anything()))
--+  matches the switch statement in foo but not in bar.
--+cxxForRangeStmt(hasInitStatement(anything()))
--+  matches the range for statement in foo but not in bar.
-- 
-- -- -- Matcher<CXXForRangeStmt>hasLoopVariableMatcher<VarDecl> InnerMatcher --
Matches the initialization statement of a for loop.
-- 
---Given
---  void foo() {
---    int a[42] = {};
--+Example:
--+    forStmt(hasLoopVariable(anything()))
--+matches 'int x' in
--     for (int x : a) { }
---  }
---
---The matcher cxxForRangeStmt(hasLoopVariable(anything()))
---matches for (int x : a) { }
-- 
-- -- -- Matcher<CXXForRangeStmt>hasRangeInitMatcher<Expr> InnerMatcher --
Matches the range initialization statement of a for loop.
-- 
---Given
---  void foo() {
---    int a[42] = {};
--+Example:
--+    forStmt(hasRangeInit(anything()))
--+matches 'a' in
--     for (int x : a) { }
---  }
---
---The matcher cxxForRangeStmt(hasRangeInit(anything()))
---matches for (int x : a) { }
-- 
-- -- -- Matcher<CXXFunctionalCastExpr>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
---
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -9690,16 +7235,13 @@
-- Given
--   class Y { public: void m(); };
--   Y g();
---  class X : public Y { public: void g(); };
--+  class X : public Y { void g(); };
--   void z(Y y, X x) { y.m(); x.m(); x.g(); (g()).m(); }
---
---The matcher cxxMemberCallExpr(onImplicitObjectArgument(hasType(
--+cxxMemberCallExpr(onImplicitObjectArgument(hasType(
--     cxxRecordDecl(hasName("Y")))))
---matches y.m(), x.m() and (g()).m()
---but does not match x.g().
---The matcher cxxMemberCallExpr(on(callExpr()))
---only matches (g()).m(), because the parens are ignored.
---FIXME: should they be ignored? (ignored bc of `on`)
--+  matches `y.m()`, `x.m()` and (`g()).m()`, but not `x.g()`).
--+cxxMemberCallExpr(on(callExpr()))
--+  only matches `(g()).m()` (the parens are ignored).
-- 
-- FIXME: Overload to allow directly matching types?
-- 
--@@ -9714,15 +7256,12 @@ -- Y g(); -- class X : public Y {}; -- void z(Y y, X x) { y.m(); (g()).m(); x.m(); } --- ---The matcher -- cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("Y"))))) --- matches y.m() and (g()).m(). ---The matcher --+ matches `y.m()` and `(g()).m()`. -- cxxMemberCallExpr(on(hasType(cxxRecordDecl(hasName("X"))))) --- matches x.m(). ---The matcher cxxMemberCallExpr(on(callExpr())) --- matches (g()).m(). --+ matches `x.m()`. --+cxxMemberCallExpr(on(callExpr())) --+ matches `(g()).m()`. -- -- FIXME: Overload to allow directly matching types? -- --@@ -9730,35 +7269,24 @@ -- -- Matcher<CXXMemberCallExpr>thisPointerTypeMatcher<Decl> InnerMatcher --
Overloaded to match the type's declaration.
---
---Given
---  class Y { public: void m(); };
---  class X : public Y { public: void g(); };
---  void z() { Y y; y.m(); Y *p; p->m(); X x; x.m(); x.g(); }
---
---The matcher cxxMemberCallExpr(thisPointerType(
---    cxxRecordDecl(hasName("Y"))))
---  matches y.m(), p->m() and x.m().
---The matcher cxxMemberCallExpr(thisPointerType(
---    cxxRecordDecl(hasName("X"))))
---  matches x.g().
-- 
-- -- -- Matcher<CXXMemberCallExpr>thisPointerTypeMatcher<QualType> InnerMatcher --
Matches if the type of the expression's implicit object argument either
---  matches the InnerMatcher, or is a pointer to a type that matches the
--+matches the InnerMatcher, or is a pointer to a type that matches the
-- InnerMatcher.
-- 
-- Given
---  class Y { public: void m() const; };
---  class X : public Y { public: void g(); };
---  void z() { const Y y; y.m(); const Y *p; p->m(); X x; x.m(); x.g(); }
---
---The matcher
---cxxMemberCallExpr(thisPointerType(isConstQualified()))
---matches y.m(), x.m() and p->m(),
---but not x.g().
--+  class Y { public: void m(); };
--+  class X : public Y { void g(); };
--+  void z() { Y y; y.m(); Y *p; p->m(); X x; x.m(); x.g(); }
--+cxxMemberCallExpr(thisPointerType(hasDeclaration(
--+    cxxRecordDecl(hasName("Y")))))
--+  matches `y.m()`, `p->m()` and `x.m()`.
--+cxxMemberCallExpr(thisPointerType(hasDeclaration(
--+    cxxRecordDecl(hasName("X")))))
--+  matches `x.g()`.
-- 
-- -- --@@ -9770,27 +7298,19 @@ -- class A { virtual void f(); }; -- class B : public A { void f(); }; -- class C : public B { void f(); }; --- ---The matcher cxxMethodDecl(ofClass(hasName("C")), --- forEachOverridden(cxxMethodDecl().bind("b"))) ---matches void f() of C , ---with cxxMethodDecl() matching ---virtual void f() of A , ---but the matcher does not match void f() of B because ---it is not overridden by C::f. --+cxxMethodDecl(ofClass(hasName("C")), --+ forEachOverridden(cxxMethodDecl().bind("b"))).bind("d") --+ matches once, with "b" binding "A::f" and "d" binding "C::f" (Note --+ that B::f is not overridden by C::f). -- -- The check can produce multiple matches in case of multiple inheritance, e.g. -- class A1 { virtual void f(); }; -- class A2 { virtual void f(); }; -- class C : public A1, public A2 { void f(); }; --- ---The matcher cxxMethodDecl(ofClass(hasName("C")), --- forEachOverridden(cxxMethodDecl().bind("b"))) ---matches void f() of C with the inner ---cxxMethodDecl() matching virtual void f() ---inside of A1 , and void f() of C with the inner ---cxxMethodDecl() matching virtual void f() ---inside of A2. --+cxxMethodDecl(ofClass(hasName("C")), --+ forEachOverridden(cxxMethodDecl().bind("b"))).bind("d") --+ matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and --+ once with "b" binding "A2::f" and "d" binding "C::f". -- -- -- --@@ -9802,52 +7322,40 @@ -- FIXME: What other kind of declarations would we need to generalize -- this to? -- ---Given --+Example matches A() in the last line --+ (matcher = cxxConstructExpr(hasDeclaration(cxxMethodDecl( --+ ofClass(hasName("A")))))) -- class A { -- public: -- A(); --- void foo(); -- }; --- ---The matcher cxxMethodDecl(ofClass(hasName("A"))) ---matches A() and void foo(). --+ A a = A(); -- -- -- -- Matcher<CXXNewExpr>hasAnyPlacementArgMatcher<Expr> InnerMatcher --
Matches any placement new expression arguments.
-- 
---Given
---  void* operator new(decltype(sizeof(void*)), void*);
---  struct MyClass { int x; };
---  unsigned char Storage[sizeof(MyClass) * 10];
--+Given:
--   MyClass *p1 = new (Storage) MyClass();
---
---
---The matcher cxxNewExpr(hasAnyPlacementArg(anything()))
---matches new (Storage) MyClass().
--+cxxNewExpr(hasAnyPlacementArg(anything()))
--+  matches the expression 'new (Storage, 16) MyClass()'.
-- 
-- -- -- Matcher<CXXNewExpr>hasArraySizeMatcher<Expr> InnerMatcher --
Matches array new expressions with a given array size.
-- 
---Given
---  void* operator new(decltype(sizeof(void*)));
---  struct MyClass { int x; };
--+Given:
--   MyClass *p1 = new MyClass[10];
---
---
---The matcher
---cxxNewExpr(hasArraySize(
---            ignoringImplicit(integerLiteral(equals(10)))))
---matches new MyClass[10].
--+cxxNewExpr(hasArraySize(integerLiteral(equals(10))))
--+  matches the expression 'new MyClass[10]'.
-- 
-- -- -- Matcher<CXXNewExpr>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -9857,25 +7365,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -9890,42 +7390,29 @@
-- Matcher<CXXNewExpr>hasPlacementArgunsigned Index, Matcher<Expr> InnerMatcher
-- 
Matches placement new expression arguments.
-- 
---Given
---  void *operator new(decltype(sizeof(void*)), int, void*);
---  struct MyClass { int x; };
---  unsigned char Storage[sizeof(MyClass) * 10];
---  MyClass *p1 = new (16, Storage) MyClass();
---
---
---The matcher cxxNewExpr(hasPlacementArg(0,
---                      integerLiteral(equals(16))))
---matches new (16, Storage) MyClass().
--+Given:
--+  MyClass *p1 = new (Storage, 16) MyClass();
--+cxxNewExpr(hasPlacementArg(1, integerLiteral(equals(16))))
--+  matches the expression 'new (Storage, 16) MyClass()'.
-- 
-- -- -- Matcher<CXXNewExpr>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
---
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -9941,45 +7428,14 @@
-- Matcher<CXXOperatorCallExpr>hasEitherOperandMatcher<Expr> InnerMatcher
-- 
Matches if either the left hand side or the right hand side of a
-- binary operator or fold expression matches.
---
---Given
---  struct S {};
---  bool operator ==(const S&, const S&);
---
---  void f(int a, const S&lhs, const S&rhs) {
---      a + 0;
---      lhs == rhs;
---      lhs != rhs;
---  }
---
---  template <typename ...Ts>
---  auto sum(Ts... args) {
---    return (0 + ... + args);
---  }
---
---
---The matcher binaryOperator(hasEitherOperand(integerLiteral()))
---matches a + 0.
---The matcher cxxOperatorCallExpr(hasEitherOperand(declRefExpr(to(
---parmVarDecl(hasName("lhs")))))) matches lhs == rhs and
---lhs != rhs.
---The matcher cxxFoldExpr(hasEitherOperand(integerLiteral()))
---matches (0 + ... + args).
-- 
-- -- -- Matcher<CXXOperatorCallExpr>hasLHSMatcher<Expr> InnerMatcher --
Matches the left hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasLHS(expr().bind("lhs")))
---matches a || b,
---with expr()
---matching a.
--+Example matches a (matcher = binaryOperator(hasLHS()))
--+  a || b
-- 
-- -- --@@ -9987,64 +7443,44 @@ --
Matches if both matchers match with opposite sides of the binary operator
-- or fold expression.
-- 
---Given
---void foo() {
---  1 + 2; // Match
---  2 + 1; // Match
---  1 + 1; // No match
---  2 + 2; // No match
---}
---The matcher binaryOperator(hasOperands(integerLiteral(equals(1)),
---                                            integerLiteral(equals(2))))
---matches 1 + 2 and 2 + 1,
---but does not match 1 + 1
---or 2 + 2.
--+Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
--+                                             integerLiteral(equals(2)))
--+  1 + 2 // Match
--+  2 + 1 // Match
--+  1 + 1 // No match
--+  2 + 2 // No match
-- 
-- -- -- Matcher<CXXOperatorCallExpr>hasRHSMatcher<Expr> InnerMatcher --
Matches the right hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasRHS(expr().bind("rhs")))
---matches a || b,
---with expr()
---matching b.
--+Example matches b (matcher = binaryOperator(hasRHS()))
--+  a || b
-- 
-- -- -- Matcher<CXXOperatorCallExpr>hasUnaryOperandMatcher<Expr> InnerMatcher --
Matches if the operand of a unary operator matches.
-- 
---void foo() {
---  !true;
---}
---
---The matcher
---unaryOperator(hasUnaryOperand(cxxBoolLiteral(equals(true))))
---matches !true.
--+Example matches true (matcher = hasUnaryOperand(
--+                                  cxxBoolLiteral(equals(true))))
--+  !true
-- 
-- -- -- Matcher<CXXRecordDecl>hasAnyBaseMatcher<CXXBaseSpecifier> BaseSpecMatcher --
Matches C++ classes that have a direct or indirect base matching BaseSpecMatcher.
-- 
---Given
---  class Foo {};
--+Example:
--+matcher hasAnyBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
--+  class Foo;
--   class Bar : Foo {};
--   class Baz : Bar {};
---  class SpecialBase {};
--+  class SpecialBase;
--   class Proxy : SpecialBase {};  // matches Proxy
--   class IndirectlyDerived : Proxy {};  //matches IndirectlyDerived
-- 
---
---The matcher
---cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("SpecialBase")))))
---matches Proxy and IndirectlyDerived
-- FIXME: Refactor this and isDerivedFrom to reuse implementation.
-- 
-- --@@ -10052,31 +7488,26 @@ -- Matcher<CXXRecordDecl>hasDirectBaseMatcher<CXXBaseSpecifier> BaseSpecMatcher --
Matches C++ classes that have a direct base matching BaseSpecMatcher.
-- 
---Given
---  class Foo {};
--+Example:
--+matcher hasDirectBase(hasType(cxxRecordDecl(hasName("SpecialBase"))))
--+  class Foo;
--   class Bar : Foo {};
--   class Baz : Bar {};
---  class SpecialBase {};
--+  class SpecialBase;
--   class Proxy : SpecialBase {};  // matches Proxy
--   class IndirectlyDerived : Proxy {};  // doesn't match
---
---The matcher
---cxxRecordDecl(hasDirectBase(hasType(cxxRecordDecl(hasName("SpecialBase")))))
---matches Proxy
-- 
-- -- -- Matcher<CXXRecordDecl>hasMethodMatcher<CXXMethodDecl> InnerMatcher --
Matches the first method of a class or struct that satisfies InnerMatcher.
-- 
---Given
--+Given:
--   class A { void func(); };
--   class B { void member(); };
-- 
---
---The matcher cxxRecordDecl(hasMethod(hasName("func")))
---matches the declaration of class A { void func(); }
---but does not match class B { void member(); }
--+cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
--+A but not B.
-- 
-- -- --@@ -10088,29 +7519,22 @@ -- Note that a class is not considered to be derived from itself. -- -- Example matches Y, Z, C (Base == hasName("X")) --- class X {}; --+ class X; -- class Y : public X {}; // directly derived -- class Z : public Y {}; // indirectly derived -- typedef X A; -- typedef A B; -- class C : public B {}; // derived from a typedef of X -- --- class Foo {}; --- typedef Foo Alias; --- class Bar : public Alias {}; --- // derived from a type that Alias is a typedef of Foo --- --- ---The matcher cxxRecordDecl(isDerivedFrom(hasName("X"))) ---matches Y, Z and C. ---The matcher cxxRecordDecl(isDerivedFrom(hasName("Foo"))) ---matches Bar. --+In the following example, Bar matches isDerivedFrom(hasName("X")): --+ class Foo; --+ typedef Foo X; --+ class Bar : public Foo {}; // derived from a type that X is a typedef of -- -- In the following example, Bar matches isDerivedFrom(hasName("NSObject")) -- @interface NSObject @end -- @interface Bar : NSObject @end -- --- -- Usable as: Matcher<CXXRecordDecl>, Matcher<ObjCInterfaceDecl> --
-- --@@ -10121,90 +7545,38 @@ -- -- Note that a class is not considered to be derived from itself. -- ---Given --- class X {}; --+Example matches Y, C (Base == hasName("X")) --+ class X; -- class Y : public X {}; // directly derived -- class Z : public Y {}; // indirectly derived -- typedef X A; -- typedef A B; -- class C : public B {}; // derived from a typedef of X -- ---The matcher ---cxxRecordDecl(isDirectlyDerivedFrom(namedDecl(hasName("X")))) ---matches Y and C (Base == hasName("X") --- -- In the following example, Bar matches isDerivedFrom(hasName("X")): --- class Foo {}; --+ class Foo; -- typedef Foo X; -- class Bar : public Foo {}; // derived from a type that X is a typedef of --- ---The matcher cxxRecordDecl(isDerivedFrom(hasName("X"))) ---matches Bar --
-- -- -- Matcher<CXXRecordDecl>isSameOrDerivedFromMatcher<NamedDecl> Base --
Similar to isDerivedFrom(), but also matches classes that directly
-- match Base.
---
---Given
---  class X {};
---  class Y : public X {};  // directly derived
---  class Z : public Y {};  // indirectly derived
---  typedef X A;
---  typedef A B;
---  class C : public B {};  // derived from a typedef of X
---
---The matcher
---cxxRecordDecl(isSameOrDerivedFrom(cxxRecordDecl(hasName("X"))),
---isDefinition())
---matches class X {}, class Y : public X {},
---class Z : public Y {} and class C : public B {}.
-- 
-- -- -- Matcher<CXXRewrittenBinaryOperator>hasEitherOperandMatcher<Expr> InnerMatcher --
Matches if either the left hand side or the right hand side of a
-- binary operator or fold expression matches.
---
---Given
---  struct S {};
---  bool operator ==(const S&, const S&);
---
---  void f(int a, const S&lhs, const S&rhs) {
---      a + 0;
---      lhs == rhs;
---      lhs != rhs;
---  }
---
---  template <typename ...Ts>
---  auto sum(Ts... args) {
---    return (0 + ... + args);
---  }
---
---
---The matcher binaryOperator(hasEitherOperand(integerLiteral()))
---matches a + 0.
---The matcher cxxOperatorCallExpr(hasEitherOperand(declRefExpr(to(
---parmVarDecl(hasName("lhs")))))) matches lhs == rhs and
---lhs != rhs.
---The matcher cxxFoldExpr(hasEitherOperand(integerLiteral()))
---matches (0 + ... + args).
-- 
-- -- -- Matcher<CXXRewrittenBinaryOperator>hasLHSMatcher<Expr> InnerMatcher --
Matches the left hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasLHS(expr().bind("lhs")))
---matches a || b,
---with expr()
---matching a.
--+Example matches a (matcher = binaryOperator(hasLHS()))
--+  a || b
-- 
-- -- --@@ -10212,59 +7584,39 @@ --
Matches if both matchers match with opposite sides of the binary operator
-- or fold expression.
-- 
---Given
---void foo() {
---  1 + 2; // Match
---  2 + 1; // Match
---  1 + 1; // No match
---  2 + 2; // No match
---}
---The matcher binaryOperator(hasOperands(integerLiteral(equals(1)),
---                                            integerLiteral(equals(2))))
---matches 1 + 2 and 2 + 1,
---but does not match 1 + 1
---or 2 + 2.
--+Example matcher = binaryOperator(hasOperands(integerLiteral(equals(1),
--+                                             integerLiteral(equals(2)))
--+  1 + 2 // Match
--+  2 + 1 // Match
--+  1 + 1 // No match
--+  2 + 2 // No match
-- 
-- -- -- Matcher<CXXRewrittenBinaryOperator>hasRHSMatcher<Expr> InnerMatcher --
Matches the right hand side of binary operator expressions.
-- 
---Given
---void foo(bool a, bool b) {
---  a || b;
---}
---
---The matcher binaryOperator(hasRHS(expr().bind("rhs")))
---matches a || b,
---with expr()
---matching b.
--+Example matches b (matcher = binaryOperator(hasRHS()))
--+  a || b
-- 
-- -- -- Matcher<CXXTemporaryObjectExpr>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
---
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -10282,19 +7634,17 @@
-- expression, or an ObjC-message-send expression.
-- 
-- Given
---  void x(int, int, int) { int y = 42; x(1, y, 42); }
---The matcher
---callExpr(hasAnyArgument(ignoringImplicit(declRefExpr()))) matches
---x(1, y, 42) with hasAnyArgument(...)
--+  void x(int, int, int) { int y; x(1, y, 42); }
--+callExpr(hasAnyArgument(declRefExpr()))
--+  matches x(1, y, 42)
--+with hasAnyArgument(...)
--   matching y
-- 
-- For ObjectiveC, given
--   @interface I - (void) f:(int) y; @end
--   void foo(I *i) { [i f:12]; }
---
---The matcher
-- objcMessageExpr(hasAnyArgument(integerLiteral(equals(12))))
---matches [i f:12]
--+  matches [i f:12]
-- 
-- -- --@@ -10302,37 +7652,28 @@ --
Matches the n'th argument of a call expression or a constructor
-- call expression.
-- 
---Given
--+Example matches y in x(y)
--+    (matcher = callExpr(hasArgument(0, declRefExpr())))
--   void x(int) { int y; x(y); }
---The matcher callExpr(hasArgument(0, declRefExpr().bind("arg")))
---matches x(y),
---with declRefExpr() matching y.
-- 
-- -- -- Matcher<CXXUnresolvedConstructExpr>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
---
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -10350,23 +7691,19 @@
-- given matcher; or 2) if the Obj-C message expression's callee's method
-- declaration matches the given matcher.
-- 
---Example 1
--+Example matches y.x() (matcher = callExpr(callee(
--+                                   cxxMethodDecl(hasName("x")))))
--   class Y { public: void x(); };
--   void z() { Y y; y.x(); }
-- 
---The matcher callExpr(callee(cxxMethodDecl(hasName("x"))))
---matches y.x()
--+Example 2. Matches [I foo] with
--+objcMessageExpr(callee(objcMethodDecl(hasName("foo"))))
-- 
---Example 2
--   @interface I: NSObject
--   +(void)foo;
--   @end
--   ...
--   [I foo]
---
---The matcher
---objcMessageExpr(callee(objcMethodDecl(hasName("foo"))))
---matches [I foo]
-- 
-- -- --@@ -10376,20 +7713,12 @@ -- Given -- class Y { void x() { this->x(); x(); Y y; y.x(); } }; -- void f() { f(); } --- ---The matcher callExpr(callee(expr().bind("callee"))) ---matches this->x(), x(), y.x(), f() ---with expr() inside of callee ---matching this->x, x, ---y.x, f respectively --+callExpr(callee(expr())) --+ matches this->x(), x(), y.x(), f() --+with callee(...) --+ matching this->x, x, y.x, f respectively -- -- Given --- struct Dummy {}; --- // makes sure there is a callee, otherwise there would be no callee, --- // just a builtin operator --- Dummy operator+(Dummy, Dummy); --- // not defining a '*' operator --- -- template <typename... Args> -- auto sum(Args... args) { -- return (0 + ... + args); --@@ -10399,14 +7728,10 @@ -- auto multiply(Args... args) { -- return (args * ... * 1); -- } --- ---The matcher cxxFoldExpr(callee(expr().bind("op"))) ---matches (0 + ... + args) ---with callee(...) matching *, ---but does not match (args * ... * 1). ---A CXXFoldExpr only has an UnresolvedLookupExpr as a callee. ---When there are no define operators that could be used instead of builtin ---ones, then there will be no callee . --+cxxFoldExpr(callee(expr())) --+ matches (args * ... * 1) --+with callee(...) --+ matching * -- -- Note: Callee cannot take the more general internal::Matcher<Expr> -- because this introduces ambiguous overloads with calls to Callee taking a --@@ -10421,10 +7746,8 @@ -- Given -- void f(int i); -- int y; --- void foo() { --- f(y); --- } ---The matcher callExpr( --+ f(y); --+callExpr( -- forEachArgumentWithParam( -- declRefExpr(to(varDecl(hasName("y")))), -- parmVarDecl(hasType(isInteger())) --@@ -10447,15 +7770,14 @@ -- -- Given -- void f(int i); --- void foo(int y) { --- f(y); --- void (*f_ptr)(int) = f; --- f_ptr(y); --- } ---The matcher callExpr( --+ int y; --+ f(y); --+ void (*f_ptr)(int) = f; --+ f_ptr(y); --+callExpr( -- forEachArgumentWithParamType( -- declRefExpr(to(varDecl(hasName("y")))), --- qualType(isInteger()).bind("type") --+ qualType(isInteger()).bind("type) -- )) -- matches f(y) and f_ptr(y) -- with declRefExpr(...) --@@ -10470,19 +7792,17 @@ -- expression, or an ObjC-message-send expression. -- -- Given --- void x(int, int, int) { int y = 42; x(1, y, 42); } ---The matcher ---callExpr(hasAnyArgument(ignoringImplicit(declRefExpr()))) matches ---x(1, y, 42) with hasAnyArgument(...) --+ void x(int, int, int) { int y; x(1, y, 42); } --+callExpr(hasAnyArgument(declRefExpr())) --+ matches x(1, y, 42) --+with hasAnyArgument(...) -- matching y -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- void foo(I *i) { [i f:12]; } --- ---The matcher -- objcMessageExpr(hasAnyArgument(integerLiteral(equals(12)))) ---matches [i f:12] --+ matches [i f:12] -- -- -- --@@ -10490,17 +7810,15 @@ --
Matches the n'th argument of a call expression or a constructor
-- call expression.
-- 
---Given
--+Example matches y in x(y)
--+    (matcher = callExpr(hasArgument(0, declRefExpr())))
--   void x(int) { int y; x(y); }
---The matcher callExpr(hasArgument(0, declRefExpr().bind("arg")))
---matches x(y),
---with declRefExpr() matching y.
-- 
-- -- -- Matcher<CallExpr>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -10510,25 +7828,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -10545,12 +7855,9 @@
-- extension, matches the constant given in the statement.
-- 
-- Given
---  void foo() {
---    switch (1) { case 1: break; case 1+1: break; case 3 ... 4: break; }
---  }
---The matcher
---caseStmt(hasCaseConstant(constantExpr(has(integerLiteral()))))
---matches case 1: break.
--+  switch (1) { case 1: case 1+1: case 3 ... 4: ; }
--+caseStmt(hasCaseConstant(integerLiteral()))
--+  matches "case 1:"
-- 
-- -- --@@ -10558,23 +7865,14 @@ --
Matches if the cast's source expression
-- or opaque value's source expression matches the given matcher.
-- 
---Given
--- struct URL { URL(const char*); };
--- URL url = "a string";
---
---The matcher castExpr(hasSourceExpression(cxxConstructExpr()))
---matches "a string".
---
---Given
---void foo(bool b) {
---  int a = b ?: 1;
---}
---
---The matcher
---opaqueValueExpr(hasSourceExpression(
---              implicitCastExpr(has(
---                implicitCastExpr(has(declRefExpr()))))))
---matches b twice, for the conditiona and the true expression.
--+Example 1: matches "a string"
--+(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
--+class URL { URL(string); };
--+URL url = "a string";
--+
--+Example 2: matches 'b' (matcher =
--+opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
--+int a = b ?: 1;
-- 
-- -- --@@ -10594,22 +7892,13 @@ -- template <typename T, typename U> -- void f(T&& t, U&& u) {} -- --- void foo() { --- bool B = false; --- f(R, B); --- } --- ---The matcher ---templateSpecializationType(forEachTemplateArgument(isExpr(expr().bind("t_arg")))) ---matches Matrix<int, R * 2, R * 4> twice, with ---expr() matching R * 2 and ---R * 4. ---The matcher ---functionDecl(forEachTemplateArgument(refersToType(qualType().bind("type")))) ---matches the specialization of f twice, ---with qualType() matching ---unsigned and ---bool. --+ bool B = false; --+ f(R, B); --+templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) --+ matches twice, with expr() matching 'R * 2' and 'R * 4' --+functionDecl(forEachTemplateArgument(refersToType(builtinType()))) --+ matches the specialization f<unsigned, bool> twice, for 'unsigned' --+ and 'bool' -- -- -- --@@ -10622,11 +7911,9 @@ -- Given -- template<typename T> class A {}; -- A<int> a; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( ---hasTypeLoc(loc(asString("int"))))))))) matches A<int> a. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( --+ hasTypeLoc(loc(asString("int"))))))) --+ matches `A<int> a`. -- -- -- --@@ -10640,19 +7927,15 @@ -- template<> class A<double> {}; -- A<int> a; -- --- template<typename T> void f() {}; --+ template<typename T> f() {}; -- void func() { f<int>(); }; -- --+classTemplateSpecializationDecl(hasAnyTemplateArgument( --+ refersToType(asString("int")))) --+ matches the specialization A<int> -- ---The matcher classTemplateSpecializationDecl( --- hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches class A<int>. --- ---The matcher ---functionDecl(hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches the instantiation of f. --+functionDecl(hasAnyTemplateArgument(refersToType(asString("int")))) --+ matches the specialization f<int> -- -- -- --@@ -10660,14 +7943,11 @@ --
Matches the specialized template of a specialization declaration.
-- 
-- Given
---  template<typename T> class A {}; // #1
---  template<> class A<int> {}; // #2
---
---The matcher
---classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl().bind("ctd")))
---matches template<> class A<int> {},
---with classTemplateDecl() matching the class template
---declaration template <typename T> class A {}.
--+  template<typename T> class A {}; #1
--+  template<> class A<int> {}; #2
--+classTemplateSpecializationDecl(hasSpecializedTemplate(classTemplateDecl()))
--+  matches '#2' with classTemplateDecl() matching the class template
--+  declaration of 'A' at #1.
-- 
-- -- --@@ -10680,12 +7960,9 @@ -- template<typename T, typename U> class A {}; -- A<double, int> b; -- A<int, double> c; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, ---hasTypeLoc(loc(asString("double"))))))))) ---matches A<double, int> b, but not double> c}. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, --+ hasTypeLoc(loc(asString("double"))))))) --+ matches `A<double, int> b`, but not `A<int, double> c`. -- -- -- --@@ -10696,20 +7973,17 @@ -- -- Given -- template<typename T, typename U> class A {}; --- A<double, int> b; --- A<int, double> c; --+ A<bool, int> b; --+ A<int, bool> c; -- -- template<typename T> void f() {} -- void func() { f<int>(); }; --- ---The matcher -- classTemplateSpecializationDecl(hasTemplateArgument( -- 1, refersToType(asString("int")))) ---matches the specialization class A<double, int>. --+ matches the specialization A<bool, int> -- ---The matcher functionDecl(hasTemplateArgument(0, --- refersToType(asString("int")))) ---matches the specialization of f. --+functionDecl(hasTemplateArgument(0, refersToType(asString("int")))) --+ matches the specialization f<int> -- -- -- --@@ -10721,10 +7995,8 @@ -- struct A {}; -- A a[7]; -- int b[7]; --- --- ---The matcher arrayType(hasElementType(builtinType())) ---int[7] --+arrayType(hasElementType(builtinType())) --+ matches "int b[7]" -- -- Usable as: Matcher<ArrayType>, Matcher<ComplexType> -- --@@ -10733,26 +8005,19 @@ -- Matcher<CompoundLiteralExpr>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
---
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -10770,12 +8035,11 @@
-- a given matcher. Also matches StmtExprs that have CompoundStmt as children.
-- 
-- Given
---void foo() { { {}; 1+2; } }
---The matcher
---compoundStmt(hasAnySubstatement(compoundStmt().bind("compound")))
---{ {}; 1+2; } and { { {}; 1+2; } }
--+  { {}; 1+2; }
--+hasAnySubstatement(compoundStmt())
--+  matches '{ {}; 1+2; }'
-- with compoundStmt()
---matching {} and { {}; 1+2; }.
--+  matching '{}'
-- 
-- -- --@@ -10786,35 +8050,25 @@ -- other declarations of the same function or coroutine. -- -- Given ---void foo() { -- for (;;) {} ---} ---The matcher forStmt(hasBody(compoundStmt().bind("body"))) ---matches for (;;) {} --+forStmt(hasBody(compoundStmt())) --+ matches 'for (;;) {}' -- with compoundStmt() --- matching {} --+ matching '{}' -- -- Given -- void f(); -- void f() {} ---The matcher functionDecl(hasBody(compoundStmt().bind("compound"))) ---f --+functionDecl(hasBody(compoundStmt())) --+ matches 'void f() {}' -- with compoundStmt() ---matching {} ---but does not match void f(); --+ matching '{}' --+ but does not match 'void f();' -- -- -- -- Matcher<DecayedType>hasDecayedTypeMatcher<QualType> InnerType --
Matches the decayed type, whoes decayed type matches InnerMatcher
---
---Given
---  void f(int i[]) {
---    i[1] = 0;
---  }
---
---The matcher parmVarDecl(hasType(decayedType()))
---matches int i[].
-- 
-- -- --@@ -10827,17 +8081,15 @@ -- Given -- template<typename T> class A {}; -- A<int> a; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( ---hasTypeLoc(loc(asString("int"))))))))) matches A<int> a. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( --+ hasTypeLoc(loc(asString("int"))))))) --+ matches `A<int> a`. -- -- -- -- Matcher<DeclRefExpr>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -10847,25 +8099,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -10886,12 +8130,9 @@
--   template<typename T, typename U> class A {};
--   A<double, int> b;
--   A<int, double> c;
---
---The matcher
---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc(
---templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
---hasTypeLoc(loc(asString("double")))))))))
---matches A<double, int> b, but not double> c}.
--+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0,
--+  hasTypeLoc(loc(asString("double")))))))
--+  matches `A<double, int> b`, but not `A<int, double> c`.
-- 
-- -- --@@ -10899,20 +8140,18 @@ --
Matches if a node refers to a declaration through a specific
-- using shadow declaration.
-- 
---Given
--+Examples:
--   namespace a { int f(); }
--   using a::f;
--   int x = f();
---
---The matcher declRefExpr(throughUsingDecl(anything()))
---matches f
--+declRefExpr(throughUsingDecl(anything()))
--+  matches f
-- 
--   namespace a { class X{}; }
--   using a::X;
--   X x;
---
---The matcher typeLoc(loc(usingType(throughUsingDecl(anything()))))
---matches X
--+typeLoc(loc(usingType(throughUsingDecl(anything()))))
--+  matches X
-- 
-- Usable as: Matcher<DeclRefExpr>, Matcher<UsingType>
-- 
--@@ -10922,14 +8161,10 @@ --
Matches a DeclRefExpr that refers to a declaration that matches the
-- specified matcher.
-- 
---Given
---  void foo() {
---    bool x;
---    if (x) {}
---  }
---
---The matcher declRefExpr(to(varDecl(hasName("x"))))
---matches x inside the condition of the if-stmt.
--+Example matches x in if(x)
--+    (matcher = declRefExpr(to(varDecl(hasName("x")))))
--+  bool x;
--+  if (x) {}
-- 
-- -- --@@ -10939,19 +8174,16 @@ -- Note that this does not work for global declarations because the AST -- breaks up multiple-declaration DeclStmt's into multiple single-declaration -- DeclStmt's. --- ---Given non-global declarations --- void foo() { --- int a, b = 0; --- int c; --- int d = 2, e; --- } ---The matcher declStmt(containsDeclaration( --+Example: Given non-global declarations --+ int a, b = 0; --+ int c; --+ int d = 2, e; --+declStmt(containsDeclaration( -- 0, varDecl(hasInitializer(anything())))) ---matches int d = 2, e;. ---The matcher declStmt(containsDeclaration(1, varDecl())) ---matches int a, b = 0; and int d = 2, e; ---but does not match int c;. --+ matches only 'int d = 2, e;', and --+declStmt(containsDeclaration(1, varDecl())) --+ matches 'int a, b = 0' as well as 'int d = 2, e;' --+ but 'int c;' is not matched. -- -- -- --@@ -10959,39 +8191,29 @@ --
Matches the Decl of a DeclStmt which has a single declaration.
-- 
-- Given
---  void foo() {
---    int a, b;
---    int c;
---  }
---The matcher declStmt(hasSingleDecl(anything()))
---matches int c;
---but does not match int a, b;
--+  int a, b;
--+  int c;
--+declStmt(hasSingleDecl(anything()))
--+  matches 'int c;' but not 'int a, b;'.
-- 
-- -- -- Matcher<DeclaratorDecl>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
---
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -11015,9 +8237,8 @@
--     }
--   }
-- 
---
---The matcher cxxRecordDecl(hasDeclContext(namedDecl(hasName("M"))))
---  matches the declaration of D.
--+cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
--+declaration of class D.
-- 
-- -- --@@ -11027,11 +8248,8 @@ -- Given -- decltype(1) a = 1; -- decltype(2.0) b = 2.0; --- --- ---The matcher decltypeType(hasUnderlyingType(isInteger())) ---matches the type decltype(1) of the variable ---declaration of a . --+decltypeType(hasUnderlyingType(isInteger())) --+ matches the type of "a" -- -- Usable as: Matcher<DecltypeType>, Matcher<UsingType> -- --@@ -11048,17 +8266,16 @@ -- -- f = 42; -- } --- ---The matcher --- decompositionDecl(hasAnyBinding(bindingDecl(hasName("f")).bind("fBinding"))) ---matches auto &[f, s, t] = arr with 'f' bound to "fBinding". --+The matcher: --+ decompositionDecl(hasAnyBinding(bindingDecl(hasName("f").bind("fBinding")))) --+matches the decomposition decl with 'f' bound to "fBinding". -- -- -- -- Matcher<DecompositionDecl>hasBindingunsigned N, Matcher<BindingDecl> InnerMatcher --
Matches the Nth binding of a DecompositionDecl.
-- 
---Given
--+For example, in:
-- void foo()
-- {
--     int arr[3];
--@@ -11066,10 +8283,10 @@
-- 
--     f = 42;
-- }
---
---The matcher decompositionDecl(hasBinding(0,
---  bindingDecl(hasName("f")).bind("fBinding")))
---matches auto &[f, s, t] = arr with 'f' bound to "fBinding".
--+The matcher:
--+  decompositionDecl(hasBinding(0,
--+  bindingDecl(hasName("f").bind("fBinding"))))
--+matches the decomposition decl with 'f' bound to "fBinding".
-- 
-- -- --@@ -11080,22 +8297,20 @@ -- other declarations of the same function or coroutine. -- -- Given ---void foo() { -- for (;;) {} ---} ---The matcher forStmt(hasBody(compoundStmt().bind("body"))) ---matches for (;;) {} --+forStmt(hasBody(compoundStmt())) --+ matches 'for (;;) {}' -- with compoundStmt() --- matching {} --+ matching '{}' -- -- Given -- void f(); -- void f() {} ---The matcher functionDecl(hasBody(compoundStmt().bind("compound"))) ---f --+functionDecl(hasBody(compoundStmt())) --+ matches 'void f() {}' -- with compoundStmt() ---matching {} ---but does not match void f(); --+ matching '{}' --+ but does not match 'void f();' -- -- -- --@@ -11103,13 +8318,8 @@ --
Matches the condition expression of an if statement, for loop,
-- switch statement or conditional operator.
-- 
---Given
---void foo() {
--+Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
--   if (true) {}
---}
---
---The matcher ifStmt(hasCondition(cxxBoolLiteral(equals(true))))
---if (true) {}
-- 
-- -- --@@ -11124,16 +8334,14 @@ -- -- class D {}; -- class D d; --- ---The matcher ---elaboratedTypeLoc(hasNamedTypeLoc(templateSpecializationTypeLoc())) --- matches class C<int>, but not 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.
--+matches InnerMatcher if the qualifier exists.
-- 
-- Given
--   namespace N {
--@@ -11143,11 +8351,8 @@
--   }
--   N::M::D d;
-- 
---
---The matcher
---elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N")))))
---  matches the type N::M::D of the variable declaration
---  of d.
--+elaboratedType(hasQualifier(hasPrefix(specifiesNamespace(hasName("N"))))
--+matches the type of the variable declaration of d.
-- 
-- -- --@@ -11157,20 +8362,20 @@ -- Given -- namespace N { -- namespace M { --- enum E { Ok }; --+ class D {}; -- } -- } --- N::M::E e = N::M::Ok; --- --+ N::M::D d; -- ---The matcher elaboratedType(namesType(enumType())) ---matches the type N::M::E of the declaration of e . --+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.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -11180,25 +8385,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -11215,37 +8412,25 @@
-- 
-- (Note: Clang's AST refers to other conversions as "casts" too, and calls
-- actual casts "explicit" casts.)
---
---  unsigned int a = (unsigned int)0;
---
---The matcher explicitCastExpr(hasDestinationType(
---qualType(isUnsignedInteger()))) matches (unsigned int)0.
-- 
-- -- -- Matcher<ExplicitCastExpr>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
---
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -11268,31 +8453,21 @@
-- X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
-- declaration of x.
-- 
--+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
--+            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
--+            and friend class X (matcher = friendDecl(hasType("X"))
--+            and public virtual X (matcher = cxxBaseSpecifier(hasType(
--+                                              cxxRecordDecl(hasName("X"))))
--  class X {};
--  void y(X &x) { x; X z; }
--  class Y { friend class X; };
--  class Z : public virtual X {};
-- 
---The matcher expr(hasType(cxxRecordDecl(hasName("X"))))
---matches x and z.
---The matcher varDecl(hasType(cxxRecordDecl(hasName("X"))))
---matches z.
---The matcher friendDecl(hasType(asString("class X")))
---matches friend class X.
---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType(
---asString("X"))).bind("b"))) matches
---class Z : public virtual X {},
---with cxxBaseSpecifier(...)
---matching public virtual X.
---
---Given
--+Example matches class Derived
--+(matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))))
-- class Base {};
-- class Derived : Base {};
-- 
---The matcher
---cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base")))))
---matches class Derived : Base {}.
---
-- Usable as: Matcher<Expr>, Matcher<FriendDecl>, Matcher<ValueDecl>,
-- Matcher<CXXBaseSpecifier>
-- 
--@@ -11302,25 +8477,17 @@ --
Matches if the expression's or declaration's type matches a type
-- matcher.
-- 
---Exmaple
--+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
--+            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
--+            and U (matcher = typedefDecl(hasType(asString("int")))
--+            and friend class X (matcher = friendDecl(hasType("X"))
--+            and public virtual X (matcher = cxxBaseSpecifier(hasType(
--+                                              asString("class X")))
--  class X {};
--  void y(X &x) { x; X z; }
--  typedef int U;
--  class Y { friend class X; };
--  class Z : public virtual X {};
---
---The matcher expr(hasType(cxxRecordDecl(hasName("X"))))
---matches x and z.
---The matcher varDecl(hasType(cxxRecordDecl(hasName("X"))))
---matches z
---The matcher typedefDecl(hasType(asString("int")))
---matches typedef int U
---The matcher friendDecl(hasType(asString("class X")))
---matches friend class X
---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType(
---asString("X"))).bind("b"))) matches class Z : public virtual X {},
---with cxxBaseSpecifier(...)
---matching public virtual X.
-- 
-- -- --@@ -11337,16 +8504,15 @@ -- appear in the C++17 AST. -- -- Given --+ -- struct H {}; -- H G(); -- void f() { -- H D = G(); -- } -- --- ---The matcher ---varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr()))) ---matches H D = G(). --+``varDecl(hasInitializer(ignoringElidableConstructorCall(callExpr())))`` --+matches ``H D = G()`` in C++11 through C++17 (and beyond). -- -- -- --@@ -11357,25 +8523,19 @@ -- Parentheses and explicit casts are not discarded. -- Given -- int arr[5]; --- const int a = 0; --+ int a = 0; -- char b = 0; -- const int c = a; -- int *d = arr; -- long e = (long) 0l; ---The matcher ---varDecl(hasInitializer(ignoringImpCasts(integerLiteral()))) ---matches a and b, ---but does not match e. ---The matcher ---varDecl(hasInitializer(ignoringImpCasts(declRefExpr()))) ---matches c and d. --- ---The matcher ---varDecl(hasInitializer(integerLiteral())) ---matches a, ---but does not match b or e. ---The matcher varDecl(hasInitializer(declRefExpr())) ---does not match c or d. --+The matchers --+ varDecl(hasInitializer(ignoringImpCasts(integerLiteral()))) --+ varDecl(hasInitializer(ignoringImpCasts(declRefExpr()))) --+would match the declarations for a, b, c, and d, but not e. --+While --+ varDecl(hasInitializer(integerLiteral())) --+ varDecl(hasInitializer(declRefExpr())) --+only match the declarations for a. -- -- -- --@@ -11384,34 +8544,17 @@ -- nodes are stripped off. -- -- Parentheses and explicit casts are not discarded. --- -- Given --- void f(int param) { --- int a = 0; --- int b = param; --- const int c = 0; --- const int d = param; --- int e = (0U); --- int f = (int)0.0; --- const int g = ((int)(((0)))); --- } --- ---The matcher ---varDecl(hasInitializer(ignoringImplicit(integerLiteral()))) ---matches int a = 0 and const int c = 0, ---but not int e = (0U) and ((int)(((0))). ---The matcher ---varDecl(hasInitializer(integerLiteral())) ---matches int a = 0 and const int c = 0, ---but not int e = (0U) and ((int)(((0))). --- ---The matcher ---varDecl(hasInitializer(ignoringImplicit(declRefExpr()))) ---matches int b = param and const int d = param. ---The matcher ---varDecl(hasInitializer(declRefExpr())) ---matches neither int b = param nor const int d = param, ---because an l-to-r-value cast happens. --+ class C {}; --+ C a = C(); --+ C b; --+ C c = b; --+The matchers --+ varDecl(hasInitializer(ignoringImplicit(cxxConstructExpr()))) --+would match the declarations for a, b, and c. --+While --+ varDecl(hasInitializer(cxxConstructExpr())) --+only match the declarations for b and c. -- -- -- --@@ -11425,14 +8568,12 @@ -- char b = (0); -- void* c = reinterpret_cast<char*>(0); -- char d = char(0); --- ---The matcher ---varDecl(hasInitializer(ignoringParenCasts(integerLiteral()))) ---matches a, b, c ---and d. -- The matcher ---varDecl(hasInitializer(integerLiteral())) ---matches a. --+ varDecl(hasInitializer(ignoringParenCasts(integerLiteral()))) --+would match the declarations for a, b, c, and d. --+while --+ varDecl(hasInitializer(integerLiteral())) --+only match the declaration for a. -- -- -- --@@ -11448,21 +8589,14 @@ -- const int c = a; -- int *d = (arr); -- long e = ((long) 0l); --- ---The matcher ---varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral()))) ---matches a and b, ---but does not match e. ---The matcher ---varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr()))) ---matches c and d. --- ---The matcher ---varDecl(hasInitializer(integerLiteral())) ---matches a, ---but does not match b or e. ---The matcher varDecl(hasInitializer(declRefExpr())) ---does not match c, or d. --+The matchers --+ varDecl(hasInitializer(ignoringParenImpCasts(integerLiteral()))) --+ varDecl(hasInitializer(ignoringParenImpCasts(declRefExpr()))) --+would match the declarations for a, b, c, and d, but not e. --+while --+ varDecl(hasInitializer(integerLiteral())) --+ varDecl(hasInitializer(declRefExpr())) --+would only match the declaration for a. -- -- -- --@@ -11472,9 +8606,8 @@ -- Given -- const char* str = ("my-string"); -- The matcher ---implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral()))) ---would match the implicit cast resulting from the assignment ---("my-string"). --+ implicitCastExpr(hasSourceExpression(ignoringParens(stringLiteral()))) --+would match the implicit cast resulting from the assignment. -- -- -- --@@ -11487,14 +8620,10 @@ -- int b = 3; -- int c; -- }; --- ---The matcher -- fieldDecl(hasInClassInitializer(integerLiteral(equals(2)))) ---matches a, ---but does not match b. ---The matcher fieldDecl(hasInClassInitializer(anything())) ---matches a and b, ---but does not match c. --+ matches 'int a;' but not 'int b;'. --+fieldDecl(hasInClassInitializer(anything())) --+ matches 'int a;' and 'int b;' but not 'int c;'. -- -- -- --@@ -11505,22 +8634,20 @@ -- other declarations of the same function or coroutine. -- -- Given ---void foo() { -- for (;;) {} ---} ---The matcher forStmt(hasBody(compoundStmt().bind("body"))) ---matches for (;;) {} --+forStmt(hasBody(compoundStmt())) --+ matches 'for (;;) {}' -- with compoundStmt() --- matching {} --+ matching '{}' -- -- Given -- void f(); -- void f() {} ---The matcher functionDecl(hasBody(compoundStmt().bind("compound"))) ---f --+functionDecl(hasBody(compoundStmt())) --+ matches 'void f() {}' -- with compoundStmt() ---matching {} ---but does not match void f(); --+ matching '{}' --+ but does not match 'void f();' -- -- -- --@@ -11528,38 +8655,28 @@ --
Matches the condition expression of an if statement, for loop,
-- switch statement or conditional operator.
-- 
---Given
---void foo() {
--+Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
--   if (true) {}
---}
---
---The matcher ifStmt(hasCondition(cxxBoolLiteral(equals(true))))
---if (true) {}
-- 
-- -- -- Matcher<ForStmt>hasIncrementMatcher<Stmt> InnerMatcher --
Matches the increment statement of a for loop.
-- 
---Given
---void foo(int N) {
---    for (int x = 0; x < N; ++x) { }
---}
---The matcher
---forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
---matches for (int x = 0; x < N; ++x) { }
--+Example:
--+    forStmt(hasIncrement(unaryOperator(hasOperatorName("++"))))
--+matches '++x' in
--+    for (x; x < N; ++x) { }
-- 
-- -- -- Matcher<ForStmt>hasLoopInitMatcher<Stmt> InnerMatcher --
Matches the initialization statement of a for loop.
-- 
---Given
---void foo(int N) {
--+Example:
--+    forStmt(hasLoopInit(declStmt()))
--+matches 'int x = 0' in
--     for (int x = 0; x < N; ++x) { }
---}
---The matcher forStmt(hasLoopInit(declStmt()))
---matches for (int x = 0; x < N; ++x) { }
-- 
-- -- --@@ -11573,31 +8690,21 @@ -- X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the -- declaration of x. -- --+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X"))))) --+ and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X"))))) --+ and friend class X (matcher = friendDecl(hasType("X")) --+ and public virtual X (matcher = cxxBaseSpecifier(hasType( --+ cxxRecordDecl(hasName("X")))) -- class X {}; -- void y(X &x) { x; X z; } -- class Y { friend class X; }; -- class Z : public virtual X {}; -- ---The matcher expr(hasType(cxxRecordDecl(hasName("X")))) ---matches x and z. ---The matcher varDecl(hasType(cxxRecordDecl(hasName("X")))) ---matches z. ---The matcher friendDecl(hasType(asString("class X"))) ---matches friend class X. ---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType( ---asString("X"))).bind("b"))) matches ---class Z : public virtual X {}, ---with cxxBaseSpecifier(...) ---matching public virtual X. --- ---Given --+Example matches class Derived --+(matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base")))))) -- class Base {}; -- class Derived : Base {}; -- ---The matcher ---cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))) ---matches class Derived : Base {}. --- -- Usable as: Matcher<Expr>, Matcher<FriendDecl>, Matcher<ValueDecl>, -- Matcher<CXXBaseSpecifier> -- --@@ -11607,25 +8714,17 @@ --
Matches if the expression's or declaration's type matches a type
-- matcher.
-- 
---Exmaple
--+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
--+            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
--+            and U (matcher = typedefDecl(hasType(asString("int")))
--+            and friend class X (matcher = friendDecl(hasType("X"))
--+            and public virtual X (matcher = cxxBaseSpecifier(hasType(
--+                                              asString("class X")))
--  class X {};
--  void y(X &x) { x; X z; }
--  typedef int U;
--  class Y { friend class X; };
--  class Z : public virtual X {};
---
---The matcher expr(hasType(cxxRecordDecl(hasName("X"))))
---matches x and z.
---The matcher varDecl(hasType(cxxRecordDecl(hasName("X"))))
---matches z
---The matcher typedefDecl(hasType(asString("int")))
---matches typedef int U
---The matcher friendDecl(hasType(asString("class X")))
---matches friend class X
---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType(
---asString("X"))).bind("b"))) matches class Z : public virtual X {},
---with cxxBaseSpecifier(...)
---matching public virtual X.
-- 
-- -- --@@ -11645,22 +8744,13 @@ -- template <typename T, typename U> -- void f(T&& t, U&& u) {} -- --- void foo() { --- bool B = false; --- f(R, B); --- } --- ---The matcher ---templateSpecializationType(forEachTemplateArgument(isExpr(expr().bind("t_arg")))) ---matches Matrix<int, R * 2, R * 4> twice, with ---expr() matching R * 2 and ---R * 4. ---The matcher ---functionDecl(forEachTemplateArgument(refersToType(qualType().bind("type")))) ---matches the specialization of f twice, ---with qualType() matching ---unsigned and ---bool. --+ bool B = false; --+ f(R, B); --+templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) --+ matches twice, with expr() matching 'R * 2' and 'R * 4' --+functionDecl(forEachTemplateArgument(refersToType(builtinType()))) --+ matches the specialization f<unsigned, bool> twice, for 'unsigned' --+ and 'bool' -- -- -- --@@ -11673,12 +8763,12 @@ -- void f(); -- void f() {} -- void g(); ---The matcher functionDecl(hasAnyBody(compoundStmt())) --- matches f --- and f --+functionDecl(hasAnyBody(compoundStmt())) --+ matches both 'void f();' --+ and 'void f() {}' -- with compoundStmt() --- matching {} --- but does not match void g(); --+ matching '{}' --+ but does not match 'void g();' -- -- -- --@@ -11690,26 +8780,23 @@ -- -- Given -- class X { void f(int x, int y, int z) {} }; --- ---The matcher cxxMethodDecl(hasAnyParameter(hasName("y"))) --- matches f --+cxxMethodDecl(hasAnyParameter(hasName("y"))) --+ matches f(int x, int y, int z) {} -- with hasAnyParameter(...) -- matching int y -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- --- -- the matcher objcMethodDecl(hasAnyParameter(hasName("y"))) --- matches the declaration of method f with hasParameter --+matches the declaration of method f with hasParameter -- matching y. -- -- For blocks, given -- b = ^(int y) { printf("%d", y) }; -- --- -- the matcher blockDecl(hasAnyParameter(hasName("y"))) --- matches the declaration of the block b with hasParameter --+matches the declaration of the block b with hasParameter -- matching y. -- -- --@@ -11723,11 +8810,9 @@ -- Given -- template<typename T> class A {}; -- A<int> a; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( ---hasTypeLoc(loc(asString("int"))))))))) matches A<int> a. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( --+ hasTypeLoc(loc(asString("int"))))))) --+ matches `A<int> a`. -- -- -- --@@ -11741,19 +8826,15 @@ -- template<> class A<double> {}; -- A<int> a; -- --- template<typename T> void f() {}; --+ template<typename T> f() {}; -- void func() { f<int>(); }; -- --+classTemplateSpecializationDecl(hasAnyTemplateArgument( --+ refersToType(asString("int")))) --+ matches the specialization A<int> -- ---The matcher classTemplateSpecializationDecl( --- hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches class A<int>. --- ---The matcher ---functionDecl(hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches the instantiation of f. --+functionDecl(hasAnyTemplateArgument(refersToType(asString("int")))) --+ matches the specialization f<int> -- -- -- --@@ -11764,22 +8845,20 @@ -- other declarations of the same function or coroutine. -- -- Given ---void foo() { -- for (;;) {} ---} ---The matcher forStmt(hasBody(compoundStmt().bind("body"))) ---matches for (;;) {} --+forStmt(hasBody(compoundStmt())) --+ matches 'for (;;) {}' -- with compoundStmt() --- matching {} --+ matching '{}' -- -- Given -- void f(); -- void f() {} ---The matcher functionDecl(hasBody(compoundStmt().bind("compound"))) ---f --+functionDecl(hasBody(compoundStmt())) --+ matches 'void f() {}' -- with compoundStmt() ---matching {} ---but does not match void f(); --+ matching '{}' --+ but does not match 'void f();' -- -- -- --@@ -11794,27 +8873,15 @@ -- explicit S(double); // #2 -- operator int(); // #3 -- explicit operator bool(); // #4 --- explicit(false) S(bool); // # 7 --- explicit(true) S(char); // # 8 --- explicit(b) S(float); // # 9 --- }; --- S(int) -> S<true>; // #5 --- explicit S(double) -> S<false>; // #6 --- ---The matcher ---cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) matches ---explicit(false) S(bool) and explicit(true) S(char), ---but does not match explicit(b) S(float), S(int) or ---explicit S(double). ---The matcher ---cxxConversionDecl(hasExplicitSpecifier(constantExpr())) does not ---match operator int() or explicit operator bool(). ---Matcher ---The matcher ---cxxDeductionGuideDecl(hasExplicitSpecifier(declRefExpr())) ---matches the implicitly generated deduction guide ---auto (float) -> S<b> of the constructor ---S(float)}. --+ explicit(false) S(bool) // # 7 --+ explicit(true) S(char) // # 8 --+ explicit(b) S(S) // # 9 --+ }; --+ S(int) -> S<true> // #5 --+ explicit S(double) -> S<false> // #6 --+cxxConstructorDecl(hasExplicitSpecifier(constantExpr())) will match #7, #8 and #9, but not #1 or #2. --+cxxConversionDecl(hasExplicitSpecifier(constantExpr())) will not match #3 or #4. --+cxxDeductionGuideDecl(hasExplicitSpecifier(constantExpr())) will not match #5 or #6. -- -- -- --@@ -11824,18 +8891,15 @@ -- -- Given -- class X { void f(int x) {} }; --- ---The matcher ---cxxMethodDecl(hasParameter(0, hasType(asString("int")))) ---matches f --+cxxMethodDecl(hasParameter(0, hasType(varDecl()))) --+ matches f(int x) {} -- with hasParameter(...) ---matching int x. --+ matching int x -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- --- ---The matcher objcMethodDecl(hasParameter(0, hasName("y"))) --+the matcher objcMethodDecl(hasParameter(0, hasName("y"))) -- matches the declaration of method f with hasParameter -- matching y. -- --@@ -11847,9 +8911,9 @@ -- Given -- int f() { return 5; } -- void g() {} ---The matcher functionDecl(hasReturnTypeLoc(loc(asString("int")))) --- matches the declaration of f, but not --- --+functionDecl(hasReturnTypeLoc(loc(asString("int")))) --+ matches the declaration of `f`, but not `g`. --+ -- -- -- Matcher<FunctionDecl>hasTemplateArgumentLocunsigned Index, Matcher<TemplateArgumentLoc> InnerMatcher --@@ -11861,12 +8925,9 @@ -- template<typename T, typename U> class A {}; -- A<double, int> b; -- A<int, double> c; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, ---hasTypeLoc(loc(asString("double"))))))))) ---matches A<double, int> b, but not double> c}. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, --+ hasTypeLoc(loc(asString("double"))))))) --+ matches `A<double, int> b`, but not `A<int, double> c`. -- -- -- --@@ -11877,31 +8938,27 @@ -- -- Given -- template<typename T, typename U> class A {}; --- A<double, int> b; --- A<int, double> c; --+ A<bool, int> b; --+ A<int, bool> c; -- -- template<typename T> void f() {} -- void func() { f<int>(); }; --- ---The matcher -- classTemplateSpecializationDecl(hasTemplateArgument( -- 1, refersToType(asString("int")))) ---matches the specialization class A<double, int>. --+ matches the specialization A<bool, int> -- ---The matcher functionDecl(hasTemplateArgument(0, --- refersToType(asString("int")))) ---matches the specialization of f. --+functionDecl(hasTemplateArgument(0, refersToType(asString("int")))) --+ matches the specialization f<int> -- -- -- -- Matcher<FunctionDecl>returnsMatcher<QualType> InnerMatcher --
Matches the return type of a function declaration.
-- 
---Given
--+Given:
--   class X { int f() { return 1; } };
---
---The matcher cxxMethodDecl(returns(asString("int")))
---  matches f
--+cxxMethodDecl(returns(asString("int")))
--+  matches int f() { return 1; }
-- 
-- -- --@@ -11909,13 +8966,8 @@ --
Matches the condition expression of an if statement, for loop,
-- switch statement or conditional operator.
-- 
---Given
---void foo() {
--+Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
--   if (true) {}
---}
---
---The matcher ifStmt(hasCondition(cxxBoolLiteral(equals(true))))
---if (true) {}
-- 
-- -- --@@ -11923,37 +8975,25 @@ --
Matches the condition variable statement in an if statement.
-- 
-- Given
---struct A {};
---A* GetAPointer();
---void foo() {
--   if (A* a = GetAPointer()) {}
---}
---
---The matcher ifStmt(hasConditionVariableStatement(declStmt()))
---if (A* a = GetAPointer()) {}
--+hasConditionVariableStatement(...)
--+  matches 'A* a = GetAPointer()'.
-- 
-- -- -- Matcher<IfStmt>hasElseMatcher<Stmt> InnerMatcher --
Matches the else-statement of an if statement.
-- 
---Given
---void foo() {
--+Examples matches the if statement
--+  (matcher = ifStmt(hasElse(cxxBoolLiteral(equals(true)))))
--   if (false) false; else true;
---}
---
---The matcher ifStmt(hasElse(cxxBoolLiteral(equals(true))))
---if (false) false; else true
-- 
-- -- -- Matcher<IfStmt>hasInitStatementMatcher<Stmt> InnerMatcher --
Matches selection statements with initializer.
-- 
---Given
--- struct vec { int* begin(); int* end(); };
--- int foobar();
--- vec& get_range();
--+Given:
--  void foo() {
--    if (int i = foobar(); i > 0) {}
--    switch (int i = foobar(); i) {}
--@@ -11964,77 +9004,48 @@
--    switch (foobar()) {}
--    for (auto& x : get_range()) {}
--  }
---
---The matcher ifStmt(hasInitStatement(anything()))
---  matches the if statement if (int i = foobar(); i > 0) {}
---  in foo but not if (foobar() > 0) {} in bar.
---The matcher switchStmt(hasInitStatement(anything()))
---  matches the switch statement switch (int i = foobar(); i) {}
---  in foo but not switch (foobar()) {} in bar.
---The matcher cxxForRangeStmt(hasInitStatement(anything()))
---  matches the range for statement
---  for (auto& a = get_range(); auto& x : a) {} in foo
---  but not for (auto& x : get_range()) {} in bar.
--+ifStmt(hasInitStatement(anything()))
--+  matches the if statement in foo but not in bar.
--+switchStmt(hasInitStatement(anything()))
--+  matches the switch statement in foo but not in bar.
--+cxxForRangeStmt(hasInitStatement(anything()))
--+  matches the range for statement in foo but not in bar.
-- 
-- -- -- Matcher<IfStmt>hasThenMatcher<Stmt> InnerMatcher --
Matches the then-statement of an if statement.
-- 
---Given
---void foo() {
--+Examples matches the if statement
--+  (matcher = ifStmt(hasThen(cxxBoolLiteral(equals(true)))))
--   if (false) true; else false;
---}
---
---The matcher ifStmt(hasThen(cxxBoolLiteral(equals(true))))
---if (false) true; else false
-- 
-- -- -- Matcher<ImplicitCastExpr>hasImplicitDestinationTypeMatcher<QualType> InnerMatcher --
Matches implicit casts whose destination type matches a given
-- matcher.
---
---Given
---  unsigned int a = 0;
---
---The matcher
---implicitCastExpr(hasImplicitDestinationType(
---qualType(isUnsignedInteger()))) matches 0.
-- 
-- -- -- Matcher<InitListExpr>hasInitunsigned N, Matcher<Expr> InnerMatcher --
Matches the n'th item of an initializer list expression.
-- 
---Given
---  int y = 42;
---  int x{y};
---
---The matcher initListExpr(hasInit(0, expr()))
---matches {y}.
--+Example matches y.
--+    (matcher = initListExpr(hasInit(0, expr())))
--+  int x{y}.
-- 
-- -- -- Matcher<InitListExpr>hasSyntacticFormMatcher<Expr> InnerMatcher --
Matches the syntactic form of init list expressions
-- (if expression have it).
---
---Given
---  int a[] = { 1, 2 };
---  struct B { int x, y; };
---  struct B b = { 5, 6 };
---
---
---The matcher
---initListExpr(hasSyntacticForm(expr().bind("syntactic")))
---matches { 1, 2 } and { 5, 6 }.
-- 
-- -- -- Matcher<InjectedClassNameType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -12044,25 +9055,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -12076,7 +9079,7 @@
-- 
-- Matcher<LabelStmt>hasDeclarationMatcher<Decl>  InnerMatcher
-- 
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -12086,25 +9089,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -12127,13 +9122,9 @@
--     auto f = [x](){};
--     auto g = [x = 1](){};
--   }
---
---The matcher
---lambdaExpr(hasAnyCapture(
---    lambdaCapture(capturesVar(hasName("x"))).bind("capture")))
---matches [x](){} and [x = 1](){}, with
---lambdaCapture(capturesVar(hasName("x"))).bind("capture")
---matching x and x = 1.
--+In the matcher
--+lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(hasName("x")))),
--+capturesVar(hasName("x")) matches `x` and `x = 1`.
-- 
-- -- --@@ -12142,18 +9133,13 @@ -- -- Given -- int main() { --- int x; --- int y; --+ int x, y; -- float z; -- auto f = [=]() { return x + y + z; }; -- } --- ---The matcher lambdaExpr(forEachLambdaCapture( --- lambdaCapture(capturesVar( --- varDecl(hasType(isInteger())).bind("captured"))))) ---matches [=]() { return x + y + z; } two times, ---with varDecl(hasType(isInteger())) matching ---int x and int y. --+lambdaExpr(forEachLambdaCapture( --+ lambdaCapture(capturesVar(varDecl(hasType(isInteger())))))) --+will trigger two matches, binding for 'x' and 'y' respectively. --
-- -- --@@ -12165,16 +9151,15 @@ -- int t = 5; -- auto f = [=](){ return t; }; -- } --- ---The matcher lambdaExpr(hasAnyCapture(lambdaCapture())) and ---lambdaExpr(hasAnyCapture(lambdaCapture(capturesVar(hasName("t"))))) --- both match [=](){ return t; }. --+lambdaExpr(hasAnyCapture(lambdaCapture())) and --+lambdaExpr(hasAnyCapture(lambdaCapture(refersToVarDecl(hasName("t"))))) --+ both match `[=](){ return t; }`. -- -- -- -- Matcher<MemberExpr>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -12184,25 +9169,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -12224,14 +9201,11 @@
--     int m;
--     int f(X x) { x.m; return m; }
--   };
---
---
---The matcher
-- memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X")))))
---matches x.m, but not m; however,
---The matcher memberExpr(hasObjectExpression(hasType(pointsTo(
---cxxRecordDecl(hasName("X"))))))
---matches m (aka. this->m), but not x.m.
--+  matches `x.m`, but not `m`; however,
--+memberExpr(hasObjectExpression(hasType(pointsTo(
--+     cxxRecordDecl(hasName("X"))))))
--+  matches `m` (aka. `this->m`), but not `x.m`.
-- 
-- -- --@@ -12240,14 +9214,13 @@ -- given matcher. -- -- Given --- struct { int first = 0, second = 1; } first, second; --- int i = second.first; --- int j = first.second; --- --- ---The matcher memberExpr(member(hasName("first"))) ---matches second.first ---but not --+ struct { int first, second; } first, second; --+ int i(second.first); --+ int j(first.second); --+memberExpr(member(hasName("first"))) --+ matches second.first --+ but not first.second (because the member name there is "second"). --+ -- -- -- Matcher<MemberPointerType>pointeeMatcher<Type> --@@ -12256,14 +9229,10 @@ -- -- Given -- int *a; --- const int *b; --- int * const c = nullptr; --- const float *f; --- ---The matcher pointerType(pointee(isConstQualified(), isInteger())) ---matches const int *, ---but does not match int * const ---or const float *. --+ int const *b; --+ float const *f; --+pointerType(pointee(isConstQualified(), isInteger())) --+ matches "int const *b" -- -- Usable as: Matcher<BlockPointerType>, Matcher<MemberPointerType>, -- Matcher<PointerType>, Matcher<ReferenceType> --@@ -12277,10 +9246,9 @@ -- Given -- namespace N { template<class T> void f(T t); } -- template <class T> void g() { using N::f; f(T()); } --- ---The matcher unresolvedLookupExpr(hasAnyDeclaration( --+unresolvedLookupExpr(hasAnyDeclaration( -- namedDecl(hasUnderlyingDecl(hasName("::N::f"))))) --- matches f in g(). --+ matches the use of f in g() . -- -- -- --@@ -12290,29 +9258,14 @@ -- Given -- struct A { struct B { struct C {}; }; }; -- A::B::C c; --- ---The matcher ---nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString( ---"struct A"))))) matches A::B::. --+nestedNameSpecifierLoc(hasPrefix(loc(specifiesType(asString("struct A"))))) --+ matches "A::" -- -- -- -- Matcher<NestedNameSpecifierLoc>locMatcher<NestedNameSpecifier> InnerMatcher --
Matches NestedNameSpecifierLocs for which the given inner
-- NestedNameSpecifier-matcher matches.
---
---Given
---  namespace ns {
---    struct A { static void f(); };
---    void A::f() {}
---    void g() { A::f(); }
---  }
---  ns::A a;
---
---
---The matcher nestedNameSpecifierLoc(loc(specifiesType(
---hasDeclaration(namedDecl(hasName("A")))))) matches A::
---twice.
-- 
-- -- --@@ -12323,10 +9276,9 @@ -- Given -- struct A { struct B { struct C {}; }; }; -- A::B::C c; --- ---The matcher nestedNameSpecifierLoc(specifiesTypeLoc(loc(qualType( --+nestedNameSpecifierLoc(specifiesTypeLoc(loc(type( -- hasDeclaration(cxxRecordDecl(hasName("A"))))))) ---matches A:: --+ matches "A::" -- -- -- --@@ -12336,10 +9288,8 @@ -- Given -- struct A { struct B { struct C {}; }; }; -- A::B::C c; --- ---The matcher ---nestedNameSpecifier(hasPrefix(specifiesType(asString( ---"struct A")))) matches struct A::B --+nestedNameSpecifier(hasPrefix(specifiesType(asString("struct A")))) and --+ matches "A::" -- -- -- --@@ -12350,10 +9300,8 @@ -- Given -- namespace ns { struct A {}; } -- ns::A a; --- ---The matcher ---nestedNameSpecifier(specifiesNamespace(hasName("ns"))) matches ---ns. --+nestedNameSpecifier(specifiesNamespace(hasName("ns"))) --+ matches "ns::" -- -- -- --@@ -12364,11 +9312,10 @@ -- Given -- struct A { struct B { struct C {}; }; }; -- A::B::C c; --- ---The matcher nestedNameSpecifier(specifiesType( --+nestedNameSpecifier(specifiesType( -- hasDeclaration(cxxRecordDecl(hasName("A"))) -- )) ---matches A. --+ matches "A::" -- -- -- --@@ -12376,16 +9323,12 @@ --
Matches any clause in an OpenMP directive.
-- 
-- Given
---  void foo() {
--+
--   #pragma omp parallel
---    ;
--   #pragma omp parallel default(none)
---    ;
---  }
-- 
---
---The matcher ompExecutableDirective(hasAnyClause(anything()))
---matches #pragma omp parallel default(none).
--+``ompExecutableDirective(hasAnyClause(anything()))`` matches
--+``omp parallel default(none)``.
-- 
-- -- --@@ -12396,18 +9339,13 @@ -- If it is, it will never match. -- -- Given --- void foo() { --- #pragma omp parallel --- ; --- #pragma omp parallel --- {} --- } -- --+ #pragma omp parallel --+ ; --+ #pragma omp parallel --+ {} -- ---The matcher ---ompExecutableDirective(hasStructuredBlock(nullStmt().bind("stmt"))) ---matches #pragma omp parallel, ---with stmtt() matching {}. --+``ompExecutableDirective(hasStructuredBlock(nullStmt()))`` will match ``;`` -- -- -- --@@ -12419,29 +9357,22 @@ -- Note that a class is not considered to be derived from itself. -- -- Example matches Y, Z, C (Base == hasName("X")) --- class X {}; --+ class X; -- class Y : public X {}; // directly derived -- class Z : public Y {}; // indirectly derived -- typedef X A; -- typedef A B; -- class C : public B {}; // derived from a typedef of X -- --- class Foo {}; --- typedef Foo Alias; --- class Bar : public Alias {}; --- // derived from a type that Alias is a typedef of Foo --- --- ---The matcher cxxRecordDecl(isDerivedFrom(hasName("X"))) ---matches Y, Z and C. ---The matcher cxxRecordDecl(isDerivedFrom(hasName("Foo"))) ---matches Bar. --+In the following example, Bar matches isDerivedFrom(hasName("X")): --+ class Foo; --+ typedef Foo X; --+ class Bar : public Foo {}; // derived from a type that X is a typedef of -- -- In the following example, Bar matches isDerivedFrom(hasName("NSObject")) -- @interface NSObject @end -- @interface Bar : NSObject @end -- --- -- Usable as: Matcher<CXXRecordDecl>, Matcher<ObjCInterfaceDecl> -- -- --@@ -12452,45 +9383,24 @@ -- -- Note that a class is not considered to be derived from itself. -- ---Given --- class X {}; --+Example matches Y, C (Base == hasName("X")) --+ class X; -- class Y : public X {}; // directly derived -- class Z : public Y {}; // indirectly derived -- typedef X A; -- typedef A B; -- class C : public B {}; // derived from a typedef of X -- ---The matcher ---cxxRecordDecl(isDirectlyDerivedFrom(namedDecl(hasName("X")))) ---matches Y and C (Base == hasName("X") --- -- In the following example, Bar matches isDerivedFrom(hasName("X")): --- class Foo {}; --+ class Foo; -- typedef Foo X; -- class Bar : public Foo {}; // derived from a type that X is a typedef of --- ---The matcher cxxRecordDecl(isDerivedFrom(hasName("X"))) ---matches Bar -- -- -- -- Matcher<ObjCInterfaceDecl>isSameOrDerivedFromMatcher<NamedDecl> Base --
Similar to isDerivedFrom(), but also matches classes that directly
-- match Base.
---
---Given
---  class X {};
---  class Y : public X {};  // directly derived
---  class Z : public Y {};  // indirectly derived
---  typedef X A;
---  typedef A B;
---  class C : public B {};  // derived from a typedef of X
---
---The matcher
---cxxRecordDecl(isSameOrDerivedFrom(cxxRecordDecl(hasName("X"))),
---isDefinition())
---matches class X {}, class Y : public X {},
---class Z : public Y {} and class C : public B {}.
-- 
-- -- --@@ -12499,23 +9409,19 @@ -- given matcher; or 2) if the Obj-C message expression's callee's method -- declaration matches the given matcher. -- ---Example 1 --+Example matches y.x() (matcher = callExpr(callee( --+ cxxMethodDecl(hasName("x"))))) -- class Y { public: void x(); }; -- void z() { Y y; y.x(); } -- ---The matcher callExpr(callee(cxxMethodDecl(hasName("x")))) ---matches y.x() --+Example 2. Matches [I foo] with --+objcMessageExpr(callee(objcMethodDecl(hasName("foo")))) -- ---Example 2 -- @interface I: NSObject -- +(void)foo; -- @end -- ... -- [I foo] --- ---The matcher ---objcMessageExpr(callee(objcMethodDecl(hasName("foo")))) ---matches [I foo] -- -- -- --@@ -12524,19 +9430,17 @@ -- expression, or an ObjC-message-send expression. -- -- Given --- void x(int, int, int) { int y = 42; x(1, y, 42); } ---The matcher ---callExpr(hasAnyArgument(ignoringImplicit(declRefExpr()))) matches ---x(1, y, 42) with hasAnyArgument(...) --+ void x(int, int, int) { int y; x(1, y, 42); } --+callExpr(hasAnyArgument(declRefExpr())) --+ matches x(1, y, 42) --+with hasAnyArgument(...) -- matching y -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- void foo(I *i) { [i f:12]; } --- ---The matcher -- objcMessageExpr(hasAnyArgument(integerLiteral(equals(12)))) ---matches [i f:12] --+ matches [i f:12] -- -- -- --@@ -12544,11 +9448,9 @@ --
Matches the n'th argument of a call expression or a constructor
-- call expression.
-- 
---Given
--+Example matches y in x(y)
--+    (matcher = callExpr(hasArgument(0, declRefExpr())))
--   void x(int) { int y; x(y); }
---The matcher callExpr(hasArgument(0, declRefExpr().bind("arg")))
---matches x(y),
---with declRefExpr() matching y.
-- 
-- -- --@@ -12556,26 +9458,23 @@ --
Matches if the Objective-C message is sent to an instance,
-- and the inner matcher matches on that instance.
-- 
---Given
--+For example the method call in
--   NSString *x = @"hello";
--   [x containsString:@"h"];
---
---The matcher
--+is matched by
-- objcMessageExpr(hasReceiver(declRefExpr(to(varDecl(hasName("x"))))))
---matches [x containsString:@"h"];
-- 
-- -- -- Matcher<ObjCMessageExpr>hasReceiverTypeMatcher<QualType> InnerMatcher --
Matches on the receiver of an ObjectiveC Message expression.
-- 
--+Example
--+matcher = objCMessageExpr(hasReceiverType(asString("UIWebView *")));
--+matches the [webView ...] message invocation.
--   NSString *webViewJavaScript = ...
--   UIWebView *webView = ...
--   [webView stringByEvaluatingJavaScriptFromString:webViewJavascript];
---
---The matcher objCMessageExpr(hasReceiverType(asString("UIWebView
---*"))) matches
---[webViewstringByEvaluatingJavaScriptFromString:webViewJavascript];
-- 
-- -- --@@ -12587,26 +9486,23 @@ -- -- Given -- class X { void f(int x, int y, int z) {} }; --- ---The matcher cxxMethodDecl(hasAnyParameter(hasName("y"))) --- matches f --+cxxMethodDecl(hasAnyParameter(hasName("y"))) --+ matches f(int x, int y, int z) {} -- with hasAnyParameter(...) -- matching int y -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- --- -- the matcher objcMethodDecl(hasAnyParameter(hasName("y"))) --- matches the declaration of method f with hasParameter --+matches the declaration of method f with hasParameter -- matching y. -- -- For blocks, given -- b = ^(int y) { printf("%d", y) }; -- --- -- the matcher blockDecl(hasAnyParameter(hasName("y"))) --- matches the declaration of the block b with hasParameter --+matches the declaration of the block b with hasParameter -- matching y. -- -- --@@ -12617,18 +9513,15 @@ -- -- Given -- class X { void f(int x) {} }; --- ---The matcher ---cxxMethodDecl(hasParameter(0, hasType(asString("int")))) ---matches f --+cxxMethodDecl(hasParameter(0, hasType(varDecl()))) --+ matches f(int x) {} -- with hasParameter(...) ---matching int x. --+ matching int x -- -- For ObjectiveC, given -- @interface I - (void) f:(int) y; @end -- --- ---The matcher objcMethodDecl(hasParameter(0, hasName("y"))) --+the matcher objcMethodDecl(hasParameter(0, hasName("y"))) -- matches the declaration of method f with hasParameter -- matching y. -- --@@ -12637,26 +9530,19 @@ -- Matcher<ObjCPropertyDecl>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
---
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -12673,23 +9559,14 @@
-- 
Matches if the cast's source expression
-- or opaque value's source expression matches the given matcher.
-- 
---Given
--- struct URL { URL(const char*); };
--- URL url = "a string";
---
---The matcher castExpr(hasSourceExpression(cxxConstructExpr()))
---matches "a string".
---
---Given
---void foo(bool b) {
---  int a = b ?: 1;
---}
---
---The matcher
---opaqueValueExpr(hasSourceExpression(
---              implicitCastExpr(has(
---                implicitCastExpr(has(declRefExpr()))))))
---matches b twice, for the conditiona and the true expression.
--+Example 1: matches "a string"
--+(matcher = castExpr(hasSourceExpression(cxxConstructExpr())))
--+class URL { URL(string); };
--+URL url = "a string";
--+
--+Example 2: matches 'b' (matcher =
--+opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr())))
--+int a = b ?: 1;
-- 
-- -- --@@ -12704,11 +9581,9 @@ -- foo(t); -- bar(t); -- } --- ---The matcher unresolvedLookupExpr(hasAnyDeclaration( --+unresolvedLookupExpr(hasAnyDeclaration( -- functionTemplateDecl(hasName("foo")))) ---matches foo in foo(t); ---but does not match bar in bar(t); --+ matches foo in foo(t); but not bar in bar(t); --
-- -- --@@ -12719,10 +9594,8 @@ -- int (*ptr_to_array)[4]; -- int (*ptr_to_func)(int); -- ---The matcher ---varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) --- matches ptr_to_func but not --- ptr_to_array. --+varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches --+ptr_to_func but not ptr_to_array. -- -- Usable as: Matcher<ParenType> -- --@@ -12734,8 +9607,8 @@ -- -- Given -- int* x; ---The matcher pointerTypeLoc(hasPointeeLoc(loc(asString("int")))) --- matches int*. --+pointerTypeLoc(hasPointeeLoc(loc(asString("int")))) --+ matches `int*`. -- -- -- --@@ -12745,14 +9618,10 @@ -- -- Given -- int *a; --- const int *b; --- int * const c = nullptr; --- const float *f; --- ---The matcher pointerType(pointee(isConstQualified(), isInteger())) ---matches const int *, ---but does not match int * const ---or const float *. --+ int const *b; --+ float const *f; --+pointerType(pointee(isConstQualified(), isInteger())) --+ matches "int const *b" -- -- Usable as: Matcher<BlockPointerType>, Matcher<MemberPointerType>, -- Matcher<PointerType>, Matcher<ReferenceType> --@@ -12762,22 +9631,19 @@ -- Matcher<QualType>hasCanonicalTypeMatcher<QualType> InnerMatcher --
Matches QualTypes whose canonical type matches InnerMatcher.
-- 
---Given
--+Given:
--   typedef int &int_ref;
--   int a;
--   int_ref b = a;
-- 
---The matcher varDecl(hasType(qualType(referenceType())))
---does not match int_ref b = a,
---but the matcher
---varDecl(hasType(qualType(hasCanonicalType(referenceType()))))
---does match int_ref b = a.
--+varDecl(hasType(qualType(referenceType()))))) will not match the
--+declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType())))))) does.
-- 
-- -- -- Matcher<QualType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -12787,25 +9653,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -12823,56 +9681,30 @@
-- Given
--   void (*fp)(void);
-- The matcher
---varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
---matches fp.
--+  varDecl(hasType(pointerType(pointee(ignoringParens(functionType())))))
--+would match the declaration for fp.
-- 
-- -- -- Matcher<QualType>pointsToMatcher<Decl> InnerMatcher ---
Matches if the matched type is a pointer type and the pointee type
---  matches the specified matcher.
---Overloaded to match the pointee type's declaration.
---
---Given
---  class Y { public: void x(); };
---  void z() { Y *y; y->x(); }
---
---The matcher cxxMemberCallExpr(on(hasType(pointsTo(
---     cxxRecordDecl(hasName("Y"))))))
---matches y->x()
--+
Overloaded to match the pointee type's declaration.
-- 
-- -- -- Matcher<QualType>pointsToMatcher<QualType> InnerMatcher --
Matches if the matched type is a pointer type and the pointee type
---  matches the specified matcher.
--+matches the specified matcher.
-- 
---Given
--+Example matches y->x()
--+  (matcher = cxxMemberCallExpr(on(hasType(pointsTo
--+     cxxRecordDecl(hasName("Y")))))))
--   class Y { public: void x(); };
--   void z() { Y *y; y->x(); }
---
---The matcher cxxMemberCallExpr(on(hasType(pointsTo(
---     qualType()))))
---matches y->x()
-- 
-- -- -- Matcher<QualType>referencesMatcher<Decl> InnerMatcher ---
Matches if the matched type is a reference type and the referenced
---type matches the specified matcher.
---Overloaded to match the referenced type's declaration.
---
---Given
---  class X {
---    void a(X b) {
---      X &x = b;
---      const X &y = b;
---    }
---  };
---
---The matcher
---varDecl(hasType(references(cxxRecordDecl(hasName("X"))))) matches
---X &x = b and const X &y = b.
--+
Overloaded to match the referenced type's declaration.
-- 
-- -- --@@ -12880,17 +9712,14 @@ --
Matches if the matched type is a reference type and the referenced
-- type matches the specified matcher.
-- 
---Given
--+Example matches X &x and const X &y
--+    (matcher = varDecl(hasType(references(cxxRecordDecl(hasName("X"))))))
--   class X {
--     void a(X b) {
--       X &x = b;
--       const X &y = b;
--     }
--   };
---
---The matcher
---varDecl(hasType(references(qualType()))) matches
---X &x = b and const X &y = b.
-- 
-- -- --@@ -12899,18 +9728,16 @@ -- `InnerMatcher`. -- -- Given --- int* const x = nullptr; --- const int y = 0; --- --- ---The matcher qualifiedTypeLoc(hasUnqualifiedLoc(pointerTypeLoc())) ---matches the type int* of the variable declaration but ---not
--+ int* const x; --+ const int y; --+qualifiedTypeLoc(hasUnqualifiedLoc(pointerTypeLoc())) --+ matches the `TypeLoc` of the variable declaration of `x`, but not `y`. --+
-- -- -- Matcher<RecordType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -12920,25 +9747,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -12957,10 +9776,8 @@
-- Given
--   int x = 3;
--   int& xx = x;
---
---
---The matcher referenceTypeLoc(hasReferentLoc(loc(asString("int"))))
---  matches int&.
--+referenceTypeLoc(hasReferentLoc(loc(asString("int"))))
--+  matches `int&`.
-- 
-- -- --@@ -12970,14 +9787,10 @@ -- -- Given -- int *a; --- const int *b; --- int * const c = nullptr; --- const float *f; --- ---The matcher pointerType(pointee(isConstQualified(), isInteger())) ---matches const int *, ---but does not match int * const ---or const float *. --+ int const *b; --+ float const *f; --+pointerType(pointee(isConstQualified(), isInteger())) --+ matches "int const *b" -- -- Usable as: Matcher<BlockPointerType>, Matcher<MemberPointerType>, -- Matcher<PointerType>, Matcher<ReferenceType> --@@ -12988,13 +9801,11 @@ --
Matches the return value expression of a return statement
-- 
-- Given
---  int foo(int a, int b) {
---    return a + b;
---  }
---The matcher
---returnStmt(hasReturnValue(binaryOperator().bind("op"))) matches
---return a + b, with binaryOperator() matching
---a + b.
--+  return a + b;
--+hasReturnValue(binaryOperator())
--+  matches 'return a + b'
--+with binaryOperator()
--+  matching 'a + b'
-- 
-- -- --@@ -13003,25 +9814,17 @@ -- a given matcher. Also matches StmtExprs that have CompoundStmt as children. -- -- Given ---void foo() { { {}; 1+2; } } ---The matcher ---compoundStmt(hasAnySubstatement(compoundStmt().bind("compound"))) ---{ {}; 1+2; } and { { {}; 1+2; } } --+ { {}; 1+2; } --+hasAnySubstatement(compoundStmt()) --+ matches '{ {}; 1+2; }' -- with compoundStmt() ---matching {} and { {}; 1+2; }. --+ matching '{}' -- -- -- -- Matcher<Stmt>alignOfExprMatcher<UnaryExprOrTypeTraitExpr> InnerMatcher --
Same as unaryExprOrTypeTraitExpr, but only matching
-- alignof.
---
---Given
---  int align = alignof(int);
---
---
---The matcher alignOfExpr(expr())
---matches alignof(int).
-- 
-- -- --@@ -13029,30 +9832,26 @@ --
Matches declaration of the function, method, or block the statement
-- belongs to.
-- 
---Given
---struct F {
---  F& operator=(const F& other) {
---    []() { return 42 == 42; };
---    return *this;
---  }
---};
---
---The matcher returnStmt(forFunction(hasName("operator=")))
---matches return *this
---but does not match return 42 == 42.
--+Given:
--+F& operator=(const F& o) {
--+  std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v > 0; });
--+  return *this;
--+}
--+returnStmt(forCallable(functionDecl(hasName("operator="))))
--+  matches 'return *this'
--+  but does not match 'return v > 0'
-- 
---Given
---void foo {
--+Given:
--+-(void) foo {
--   int x = 1;
--   dispatch_sync(queue, ^{ int y = 2; });
-- }
---
---The matcher declStmt(forCallable(objcMethodDecl()))
---matches int x = 1
---but does not match int y = 2.
---The matcher declStmt(forCallable(blockDecl()))
---matches int y = 2
---but does not match int x = 1.
--+declStmt(forCallable(objcMethodDecl()))
--+  matches 'int x = 1'
--+  but does not match 'int y = 2'.
--+whereas declStmt(forCallable(blockDecl()))
--+  matches 'int y = 2'
--+  but does not match 'int x = 1'.
-- 
-- -- --@@ -13061,34 +9860,23 @@ -- -- Deprecated. Use forCallable() to correctly handle the situation when -- the declaration is not a function (but a block or an Objective-C method). ---The matcher forFunction() not only fails to take non-functions ---into account but also may match the wrong declaration in their presence. --- ---Given --- struct F { --- F& operator=(const F& other) { --- []() { return 42 == 42; }; --- return *this; --- } --- }; --+forFunction() not only fails to take non-functions into account but also --+may match the wrong declaration in their presence. -- --- ---The matcher returnStmt(forFunction(hasName("operator="))) ---matches return *this ---but does not match return 42 == 42. --+Given: --+F& operator=(const F& o) { --+ std::copy_if(o.begin(), o.end(), begin(), [](V v) { return v > 0; }); --+ return *this; --+} --+returnStmt(forFunction(hasName("operator="))) --+ matches 'return *this' --+ but does not match 'return v > 0' -- -- -- -- Matcher<Stmt>sizeOfExprMatcher<UnaryExprOrTypeTraitExpr> InnerMatcher --
Same as unaryExprOrTypeTraitExpr, but only matching
-- sizeof.
---
---Given
---  struct S { double x; double y; };
---  int size = sizeof(struct S);
---
---The matcher sizeOfExpr(expr())
---matches sizeof(struct S).
-- 
-- -- --@@ -13102,9 +9890,7 @@ -- int i; -- double j = F(i); -- --- ---The matcher substTemplateTypeParmType(hasReplacementType(type())) ---matches int. --+substTemplateTypeParmType(hasReplacementType(type())) matches int -- -- -- --@@ -13113,18 +9899,11 @@ -- statement. This matcher may produce multiple matches. -- -- Given --- void foo() { --- switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } } --- } ---The matcher ---switchStmt(forEachSwitchCase(caseStmt().bind("c"))) ---matches four times, matching ---switch (1) { case 1: case 2: default: switch (2) { case 3: ---case 4: ; } } and ---switch (2) { case 3: case 4: ; }, with ---caseStmt() matching each of case 1:, ---case 2:, case 3: ---and case 4:. --+ switch (1) { case 1: case 2: default: switch (2) { case 3: case 4: ; } } --+switchStmt(forEachSwitchCase(caseStmt().bind("c"))).bind("s") --+ matches four times, with "c" binding each of "case 1:", "case 2:", --+"case 3:" and "case 4:", and "s" respectively binding "switch (1)", --+"switch (1)", "switch (2)" and "switch (2)". -- -- -- --@@ -13132,23 +9911,15 @@ --
Matches the condition expression of an if statement, for loop,
-- switch statement or conditional operator.
-- 
---Given
---void foo() {
--+Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
--   if (true) {}
---}
---
---The matcher ifStmt(hasCondition(cxxBoolLiteral(equals(true))))
---if (true) {}
-- 
-- -- -- Matcher<SwitchStmt>hasInitStatementMatcher<Stmt> InnerMatcher --
Matches selection statements with initializer.
-- 
---Given
--- struct vec { int* begin(); int* end(); };
--- int foobar();
--- vec& get_range();
--+Given:
--  void foo() {
--    if (int i = foobar(); i > 0) {}
--    switch (int i = foobar(); i) {}
--@@ -13159,23 +9930,18 @@
--    switch (foobar()) {}
--    for (auto& x : get_range()) {}
--  }
---
---The matcher ifStmt(hasInitStatement(anything()))
---  matches the if statement if (int i = foobar(); i > 0) {}
---  in foo but not if (foobar() > 0) {} in bar.
---The matcher switchStmt(hasInitStatement(anything()))
---  matches the switch statement switch (int i = foobar(); i) {}
---  in foo but not switch (foobar()) {} in bar.
---The matcher cxxForRangeStmt(hasInitStatement(anything()))
---  matches the range for statement
---  for (auto& a = get_range(); auto& x : a) {} in foo
---  but not for (auto& x : get_range()) {} in bar.
--+ifStmt(hasInitStatement(anything()))
--+  matches the if statement in foo but not in bar.
--+switchStmt(hasInitStatement(anything()))
--+  matches the switch statement in foo but not in bar.
--+cxxForRangeStmt(hasInitStatement(anything()))
--+  matches the range for statement in foo but not in bar.
-- 
-- -- -- Matcher<TagType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -13185,25 +9951,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -13218,26 +9976,19 @@
-- Matcher<TemplateArgumentLoc>hasTypeLocMatcher<TypeLoc> Inner
-- 
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
---
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -13257,13 +10008,10 @@
--   struct B { int next; };
--   template<int(B::*next_ptr)> struct A {};
--   A<&B::next> a;
---
---The matcher
-- templateSpecializationType(hasAnyTemplateArgument(
---  isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next")).bind("next")))))))
---matches the specialization A<&struct B::next>
---with fieldDecl(hasName("next")) matching
---B::next.
--+  isExpr(hasDescendant(declRefExpr(to(fieldDecl(hasName("next"))))))))
--+  matches the specialization A<&B::next> with fieldDecl(...) matching
--+    B::next
-- 
-- -- --@@ -13275,13 +10023,10 @@ -- struct B { int next; }; -- template<int(B::*next_ptr)> struct A {}; -- A<&B::next> a; --- ---The matcher -- classTemplateSpecializationDecl(hasAnyTemplateArgument( --- refersToDeclaration(fieldDecl(hasName("next")).bind("next")))) ---matches the specialization struct A<&B::next> ---with fieldDecl(hasName("next")) matching ---B::next. --+ refersToDeclaration(fieldDecl(hasName("next"))))) --+ matches the specialization A<&B::next> with fieldDecl(...) matching --+ B::next --
-- -- --@@ -13291,12 +10036,9 @@ -- Given -- template<int T> struct C {}; -- C<42> c; --- ---The matcher classTemplateSpecializationDecl( --+classTemplateSpecializationDecl( -- hasAnyTemplateArgument(refersToIntegralType(asString("int")))) ---matches the implicitly declared specialization ---struct C<42> from the instantiation for the type of the ---variable c . --+ matches the implicit instantiation of C in C<42>. -- -- -- --@@ -13307,11 +10049,9 @@ -- template<template <typename> class S> class X {}; -- template<typename T> class Y {}; -- X<Y> xi; --- ---The matcher -- classTemplateSpecializationDecl(hasAnyTemplateArgument( --- refersToTemplate(templateName()))) ---matches the specialization class X<Y> --+ refersToTemplate(templateName()))) --+ matches the specialization X<Y> -- -- -- --@@ -13322,11 +10062,9 @@ -- struct X {}; -- template<typename T> struct A {}; -- A<X> a; --- ---The matcher -- classTemplateSpecializationDecl(hasAnyTemplateArgument(refersToType( --- recordType(hasDeclaration(recordDecl(hasName("X"))))))) ---matches the specialization struct A<struct X>. --+ recordType(hasDeclaration(recordDecl(hasName("X"))))))) --+matches the specialization of struct A generated by A<X>. -- -- -- --@@ -13339,11 +10077,9 @@ -- Given -- template<typename T> class A {}; -- A<int> a; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( ---hasTypeLoc(loc(asString("int"))))))))) matches A<int> a. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( --+ hasTypeLoc(loc(asString("int"))))))) --+ matches `A<int> a`. -- -- -- --@@ -13356,12 +10092,9 @@ -- template<typename T, typename U> class A {}; -- A<double, int> b; -- A<int, double> c; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, ---hasTypeLoc(loc(asString("double"))))))))) ---matches A<double, int> b, but not double> c}. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, --+ hasTypeLoc(loc(asString("double"))))))) --+ matches `A<double, int> b`, but not `A<int, double> c`. -- -- -- --@@ -13381,22 +10114,13 @@ -- template <typename T, typename U> -- void f(T&& t, U&& u) {} -- --- void foo() { --- bool B = false; --- f(R, B); --- } --- ---The matcher ---templateSpecializationType(forEachTemplateArgument(isExpr(expr().bind("t_arg")))) ---matches Matrix<int, R * 2, R * 4> twice, with ---expr() matching R * 2 and ---R * 4. ---The matcher ---functionDecl(forEachTemplateArgument(refersToType(qualType().bind("type")))) ---matches the specialization of f twice, ---with qualType() matching ---unsigned and ---bool. --+ bool B = false; --+ f(R, B); --+templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) --+ matches twice, with expr() matching 'R * 2' and 'R * 4' --+functionDecl(forEachTemplateArgument(refersToType(builtinType()))) --+ matches the specialization f<unsigned, bool> twice, for 'unsigned' --+ and 'bool' -- -- -- --@@ -13410,25 +10134,21 @@ -- template<> class A<double> {}; -- A<int> a; -- --- template<typename T> void f() {}; --+ template<typename T> f() {}; -- void func() { f<int>(); }; -- --+classTemplateSpecializationDecl(hasAnyTemplateArgument( --+ refersToType(asString("int")))) --+ matches the specialization A<int> -- ---The matcher classTemplateSpecializationDecl( --- hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches class A<int>. --- ---The matcher ---functionDecl(hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches the instantiation of f. --+functionDecl(hasAnyTemplateArgument(refersToType(asString("int")))) --+ matches the specialization f<int> -- -- -- -- Matcher<TemplateSpecializationType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -13438,25 +10158,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -13475,26 +10187,23 @@
-- 
-- Given
--   template<typename T, typename U> class A {};
---  A<double, int> b;
---  A<int, double> c;
--+  A<bool, int> b;
--+  A<int, bool> c;
-- 
--   template<typename T> void f() {}
--   void func() { f<int>(); };
---
---The matcher
-- classTemplateSpecializationDecl(hasTemplateArgument(
--     1, refersToType(asString("int"))))
---matches the specialization class A<double, int>.
--+  matches the specialization A<bool, int>
-- 
---The matcher functionDecl(hasTemplateArgument(0,
---                        refersToType(asString("int"))))
---matches the specialization of f.
--+functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
--+  matches the specialization f<int>
-- 
-- -- -- Matcher<TemplateTypeParmType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -13504,25 +10213,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -13537,37 +10238,25 @@
-- Matcher<TypeLoc>locMatcher<QualType> InnerMatcher
-- 
Matches TypeLocs for which the given inner
-- QualType-matcher matches.
---
---  int a = 10;
---
---The matcher typeLoc(loc(qualType(isInteger())))
---matches the int of a .
-- 
-- -- -- Matcher<TypedefNameDecl>hasTypeLocMatcher<TypeLoc> Inner --
Matches if the type location of a node matches the inner matcher.
-- 
---Given
--+Examples:
--   int x;
---The matcher declaratorDecl(hasTypeLoc(loc(asString("int"))))
---matches int x.
--+declaratorDecl(hasTypeLoc(loc(asString("int"))))
--+  matches int x
-- 
---Given
---struct point { point(double, double); };
---point p = point(1.0, -1.0);
--+auto x = int(3);
--+cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("int"))))
--+  matches int(3)
-- 
---The matcher
---cxxTemporaryObjectExpr(hasTypeLoc(loc(asString("point"))))
---matches point(1.0, -1.0).
---
---Given
-- struct Foo { Foo(int, int); };
---Foo x = Foo(1, 2);
---
---The matcher cxxTemporaryObjectExpr(hasTypeLoc(
---                          loc(asString("Foo"))))
---matches Foo(1, 2).
--+auto x = Foo(1, 2);
--+cxxFunctionalCastExpr(hasTypeLoc(loc(asString("struct Foo"))))
--+  matches Foo(1, 2)
-- 
-- Usable as: Matcher<BlockDecl>, Matcher<CXXBaseSpecifier>,
--   Matcher<CXXCtorInitializer>, Matcher<CXXFunctionalCastExpr>,
--@@ -13584,31 +10273,23 @@
-- 
Matches if the expression's or declaration's type matches a type
-- matcher.
-- 
---Exmaple
--+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
--+            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
--+            and U (matcher = typedefDecl(hasType(asString("int")))
--+            and friend class X (matcher = friendDecl(hasType("X"))
--+            and public virtual X (matcher = cxxBaseSpecifier(hasType(
--+                                              asString("class X")))
--  class X {};
--  void y(X &x) { x; X z; }
--  typedef int U;
--  class Y { friend class X; };
--  class Z : public virtual X {};
---
---The matcher expr(hasType(cxxRecordDecl(hasName("X"))))
---matches x and z.
---The matcher varDecl(hasType(cxxRecordDecl(hasName("X"))))
---matches z
---The matcher typedefDecl(hasType(asString("int")))
---matches typedef int U
---The matcher friendDecl(hasType(asString("class X")))
---matches friend class X
---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType(
---asString("X"))).bind("b"))) matches class Z : public virtual X {},
---with cxxBaseSpecifier(...)
---matching public virtual X.
-- 
-- -- -- Matcher<TypedefType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -13618,25 +10299,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -13655,11 +10328,8 @@
-- For example, in:
--   class A {};
--   using B = A;
---  B b;
---
---The matcher
---varDecl(hasType(hasUnqualifiedDesugaredType(recordType())))
---matches B b.
--+The matcher type(hasUnqualifiedDesugaredType(recordType())) matches
--+both B and A.
-- 
-- -- --@@ -13668,23 +10338,17 @@ -- -- Given -- int a, c; float b; int s = sizeof(a) + sizeof(b) + alignof(c); --- ---The matcher ---unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int"))) ---matches sizeof(a) and alignof(c) --+unaryExprOrTypeTraitExpr(hasArgumentOfType(asString("int")) --+ matches sizeof(a) and alignof(c) --
-- -- -- Matcher<UnaryOperator>hasUnaryOperandMatcher<Expr> InnerMatcher --
Matches if the operand of a unary operator matches.
-- 
---void foo() {
---  !true;
---}
---
---The matcher
---unaryOperator(hasUnaryOperand(cxxBoolLiteral(equals(true))))
---matches !true.
--+Example matches true (matcher = hasUnaryOperand(
--+                                  cxxBoolLiteral(equals(true))))
--+  !true
-- 
-- -- --@@ -13698,20 +10362,17 @@ -- int m; -- int f(X x) { x.m; return m; } -- }; --- --- ---The matcher -- memberExpr(hasObjectExpression(hasType(cxxRecordDecl(hasName("X"))))) ---matches x.m, but not m; however, ---The matcher memberExpr(hasObjectExpression(hasType(pointsTo( ---cxxRecordDecl(hasName("X")))))) ---matches m (aka. this->m), but not x.m. --+ matches `x.m`, but not `m`; however, --+memberExpr(hasObjectExpression(hasType(pointsTo( --+ cxxRecordDecl(hasName("X")))))) --+ matches `m` (aka. `this->m`), but not `x.m`. --
-- -- -- Matcher<UnresolvedUsingType>hasDeclarationMatcher<Decl> InnerMatcher --
Matches a node if the declaration associated with that node
---  matches the given matcher.
--+matches the given matcher.
-- 
-- The associated declaration is:
-- - for type nodes, the declaration of the underlying type
--@@ -13721,25 +10382,17 @@
-- - for CXXNewExpr, the declaration of the operator new
-- - for ObjCIvarExpr, the declaration of the ivar
-- 
---Given
--+For type nodes, hasDeclaration will generally match the declaration of the
--+sugared type. Given
--   class X {};
--   typedef X Y;
--   Y y;
---
---For type nodes, hasDeclaration will generally match the declaration of the
---sugared type, i.e., the matcher
---varDecl(hasType(qualType(hasDeclaration(decl().bind("d"))))),
---matches Y y, with
---the matcher decl() matching
---typedef X Y;.
---A common use case is to match the underlying, desugared type.
--+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().bind("d"))))))
---matches Y y.
---In this matcher, the matcher decl() will match the
---CXXRecordDecl
---class X {};.
--+  varDecl(hasType(hasUnqualifiedDesugaredType(
--+      recordType(hasDeclaration(decl())))))
--+In this matcher, the decl will match the CXXRecordDecl of class X.
-- 
-- Usable as: Matcher<AddrLabelExpr>, Matcher<CallExpr>,
--   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
--@@ -13759,12 +10412,8 @@
--   namespace X { int a; void b(); }
--   using X::a;
--   using X::b;
---
---The matcher
-- usingDecl(hasAnyUsingShadowDecl(hasTargetDecl(functionDecl())))
---  matches using X::b
---  but not X::a}
---
--+ matches using X::b but not using X::a -- -- -- Matcher<UsingType>hasUnderlyingTypeMatcher<Type> --@@ -13773,11 +10422,8 @@ -- Given -- decltype(1) a = 1; -- decltype(2.0) b = 2.0; --- --- ---The matcher decltypeType(hasUnderlyingType(isInteger())) ---matches the type decltype(1) of the variable ---declaration of a . --+decltypeType(hasUnderlyingType(isInteger())) --+ matches the type of "a" -- -- Usable as: Matcher<DecltypeType>, Matcher<UsingType> -- --@@ -13787,20 +10433,18 @@ --
Matches if a node refers to a declaration through a specific
-- using shadow declaration.
-- 
---Given
--+Examples:
--   namespace a { int f(); }
--   using a::f;
--   int x = f();
---
---The matcher declRefExpr(throughUsingDecl(anything()))
---matches f
--+declRefExpr(throughUsingDecl(anything()))
--+  matches f
-- 
--   namespace a { class X{}; }
--   using a::X;
--   X x;
---
---The matcher typeLoc(loc(usingType(throughUsingDecl(anything()))))
---matches X
--+typeLoc(loc(usingType(throughUsingDecl(anything()))))
--+  matches X
-- 
-- Usable as: Matcher<DeclRefExpr>, Matcher<UsingType>
-- 
--@@ -13816,31 +10460,21 @@ -- X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the -- declaration of x. -- --+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X"))))) --+ and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X"))))) --+ and friend class X (matcher = friendDecl(hasType("X")) --+ and public virtual X (matcher = cxxBaseSpecifier(hasType( --+ cxxRecordDecl(hasName("X")))) -- class X {}; -- void y(X &x) { x; X z; } -- class Y { friend class X; }; -- class Z : public virtual X {}; -- ---The matcher expr(hasType(cxxRecordDecl(hasName("X")))) ---matches x and z. ---The matcher varDecl(hasType(cxxRecordDecl(hasName("X")))) ---matches z. ---The matcher friendDecl(hasType(asString("class X"))) ---matches friend class X. ---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType( ---asString("X"))).bind("b"))) matches ---class Z : public virtual X {}, ---with cxxBaseSpecifier(...) ---matching public virtual X. --- ---Given --+Example matches class Derived --+(matcher = cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base")))))) -- class Base {}; -- class Derived : Base {}; -- ---The matcher ---cxxRecordDecl(hasAnyBase(hasType(cxxRecordDecl(hasName("Base"))))) ---matches class Derived : Base {}. --- -- Usable as: Matcher<Expr>, Matcher<FriendDecl>, Matcher<ValueDecl>, -- Matcher<CXXBaseSpecifier> -- --@@ -13850,25 +10484,17 @@ --
Matches if the expression's or declaration's type matches a type
-- matcher.
-- 
---Exmaple
--+Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
--+            and z (matcher = varDecl(hasType(cxxRecordDecl(hasName("X")))))
--+            and U (matcher = typedefDecl(hasType(asString("int")))
--+            and friend class X (matcher = friendDecl(hasType("X"))
--+            and public virtual X (matcher = cxxBaseSpecifier(hasType(
--+                                              asString("class X")))
--  class X {};
--  void y(X &x) { x; X z; }
--  typedef int U;
--  class Y { friend class X; };
--  class Z : public virtual X {};
---
---The matcher expr(hasType(cxxRecordDecl(hasName("X"))))
---matches x and z.
---The matcher varDecl(hasType(cxxRecordDecl(hasName("X"))))
---matches z
---The matcher typedefDecl(hasType(asString("int")))
---matches typedef int U
---The matcher friendDecl(hasType(asString("class X")))
---matches friend class X
---The matcher cxxRecordDecl(hasAnyBase(cxxBaseSpecifier(hasType(
---asString("X"))).bind("b"))) matches class Z : public virtual X {},
---with cxxBaseSpecifier(...)
---matching public virtual X.
-- 
-- -- --@@ -13876,13 +10502,9 @@ --
Matches a variable declaration that has an initializer expression
-- that matches the given matcher.
-- 
---Given
---  int y() { return 0; }
---  void foo() {
---    int x = y();
---  }
---The matcher varDecl(hasInitializer(callExpr()))
---matches x
--+Example matches x (matcher = varDecl(hasInitializer(callExpr())))
--+  bool y() { return true; }
--+  bool x = y();
-- 
-- -- --@@ -13902,22 +10524,13 @@ -- template <typename T, typename U> -- void f(T&& t, U&& u) {} -- --- void foo() { --- bool B = false; --- f(R, B); --- } --- ---The matcher ---templateSpecializationType(forEachTemplateArgument(isExpr(expr().bind("t_arg")))) ---matches Matrix<int, R * 2, R * 4> twice, with ---expr() matching R * 2 and ---R * 4. ---The matcher ---functionDecl(forEachTemplateArgument(refersToType(qualType().bind("type")))) ---matches the specialization of f twice, ---with qualType() matching ---unsigned and ---bool. --+ bool B = false; --+ f(R, B); --+templateSpecializationType(forEachTemplateArgument(isExpr(expr()))) --+ matches twice, with expr() matching 'R * 2' and 'R * 4' --+functionDecl(forEachTemplateArgument(refersToType(builtinType()))) --+ matches the specialization f<unsigned, bool> twice, for 'unsigned' --+ and 'bool' -- -- -- --@@ -13930,11 +10543,9 @@ -- Given -- template<typename T> class A {}; -- A<int> a; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( ---hasTypeLoc(loc(asString("int"))))))))) matches A<int> a. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasAnyTemplateArgumentLoc( --+ hasTypeLoc(loc(asString("int"))))))) --+ matches `A<int> a`. -- -- -- --@@ -13948,19 +10559,15 @@ -- template<> class A<double> {}; -- A<int> a; -- --- template<typename T> void f() {}; --+ template<typename T> f() {}; -- void func() { f<int>(); }; -- --+classTemplateSpecializationDecl(hasAnyTemplateArgument( --+ refersToType(asString("int")))) --+ matches the specialization A<int> -- ---The matcher classTemplateSpecializationDecl( --- hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches class A<int>. --- ---The matcher ---functionDecl(hasAnyTemplateArgument( --- refersToType(asString("int")))) ---matches the instantiation of f. --+functionDecl(hasAnyTemplateArgument(refersToType(asString("int")))) --+ matches the specialization f<int> -- -- -- --@@ -13973,12 +10580,9 @@ -- template<typename T, typename U> class A {}; -- A<double, int> b; -- A<int, double> c; --- ---The matcher ---varDecl(hasTypeLoc(elaboratedTypeLoc(hasNamedTypeLoc( ---templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, ---hasTypeLoc(loc(asString("double"))))))))) ---matches A<double, int> b, but not double> c}. --+varDecl(hasTypeLoc(templateSpecializationTypeLoc(hasTemplateArgumentLoc(0, --+ hasTypeLoc(loc(asString("double"))))))) --+ matches `A<double, int> b`, but not `A<int, double> c`. -- -- -- --@@ -13989,20 +10593,17 @@ -- -- Given -- template<typename T, typename U> class A {}; --- A<double, int> b; --- A<int, double> c; --+ A<bool, int> b; --+ A<int, bool> c; -- -- template<typename T> void f() {} -- void func() { f<int>(); }; --- ---The matcher -- classTemplateSpecializationDecl(hasTemplateArgument( -- 1, refersToType(asString("int")))) ---matches the specialization class A<double, int>. --+ matches the specialization A<bool, int> -- ---The matcher functionDecl(hasTemplateArgument(0, --- refersToType(asString("int")))) ---matches the specialization of f. --+functionDecl(hasTemplateArgument(0, refersToType(asString("int")))) --+ matches the specialization f<int> -- -- -- --@@ -14014,10 +10615,9 @@ -- void f(int b) { -- int a[b]; -- } ---The matcher -- variableArrayType(hasSizeExpr(ignoringImpCasts(declRefExpr(to( -- varDecl(hasName("b"))))))) ---matches int[b] --+ matches "int a[b]" -- -- -- --@@ -14028,22 +10628,20 @@ -- other declarations of the same function or coroutine. -- -- Given ---void foo() { -- for (;;) {} ---} ---The matcher forStmt(hasBody(compoundStmt().bind("body"))) ---matches for (;;) {} --+forStmt(hasBody(compoundStmt())) --+ matches 'for (;;) {}' -- with compoundStmt() --- matching {} --+ matching '{}' -- -- Given -- void f(); -- void f() {} ---The matcher functionDecl(hasBody(compoundStmt().bind("compound"))) ---f --+functionDecl(hasBody(compoundStmt())) --+ matches 'void f() {}' -- with compoundStmt() ---matching {} ---but does not match void f(); --+ matching '{}' --+ but does not match 'void f();' -- -- -- --@@ -14051,13 +10649,8 @@ --
Matches the condition expression of an if statement, for loop,
-- switch statement or conditional operator.
-- 
---Given
---void foo() {
--+Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
--   if (true) {}
---}
---
---The matcher ifStmt(hasCondition(cxxBoolLiteral(equals(true))))
---if (true) {}
-- 
-- -- --diff -ruN --strip-trailing-cr a/clang/docs/ReleaseNotes.rst b/clang/docs/ReleaseNotes.rst ----- a/clang/docs/ReleaseNotes.rst --+++ b/clang/docs/ReleaseNotes.rst --@@ -858,9 +858,6 @@ -- - Ensure ``hasName`` matches template specializations across inline namespaces, -- making `matchesNodeFullSlow` and `matchesNodeFullFast` consistent. -- ---- The examples in the AST matcher reference are now tested and additional --- examples and descriptions were added. --- -- clang-format -- ------------ -- --diff -ruN --strip-trailing-cr a/clang/docs/tools/dump_ast_matchers.py b/clang/docs/tools/dump_ast_matchers.py ----- a/clang/docs/tools/dump_ast_matchers.py --+++ b/clang/docs/tools/dump_ast_matchers.py --@@ -100,72 +100,15 @@ -- comment = m.group(1) -- -- ---def find_next_closing_rbrace( --- data: str, start_pos: int, braces_to_be_matched: int ---) -> int: --- """Finds the location of the closing rbrace '}' inside of data.""" --- """'start_pos' should be one past the opening lbrace and braces_to_be_matched is initialized with 0""" --- next_lbrace = data.find("{", start_pos) --- next_rbrace = data.find("}", start_pos) --- if next_lbrace != -1: --- if next_lbrace < next_rbrace: --- return find_next_closing_rbrace( --- data, next_lbrace + 1, braces_to_be_matched + 1 --- ) --- if braces_to_be_matched == 0: --- return next_rbrace --- return find_next_closing_rbrace(data, next_rbrace + 1, braces_to_be_matched - 1) --- --- if braces_to_be_matched > 0: --- return find_next_closing_rbrace(data, next_rbrace + 1, braces_to_be_matched - 1) --- --- return next_rbrace --- --- -- def strip_doxygen(comment): -- """Returns the given comment without \-escaped words.""" --+ # If there is only a doxygen keyword in the line, delete the whole line. --+ comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) --+ -- # If there is a doxygen \see command, change the \see prefix into "See also:". -- # FIXME: it would be better to turn this into a link to the target instead. -- comment = re.sub(r"\\see", r"See also:", comment) -- --- commands: list[str] = [ --- "\\compile_args{", --- "\\matcher{", --- "\\match{", --- "\\nomatch{", --- ] --- --- for command in commands: --- delete_command = command == "\\compile_args{" --- command_begin_loc = comment.find(command) --- while command_begin_loc != -1: --- command_end_loc = command_begin_loc + len(command) --- end_brace_loc = find_next_closing_rbrace(comment, command_end_loc + 1, 0) --- if end_brace_loc == -1: --- print("found unmatched {") --- command_begin_loc = comment.find(command, command_end_loc) --- continue --- --- if delete_command: --- comment = comment[0:command_begin_loc] + comment[end_brace_loc + 1 :] --- command_begin_loc = comment.find(command, command_begin_loc) --- continue --- --- tag_seperator_loc = comment.find("$", command_end_loc) --- if tag_seperator_loc != -1 and tag_seperator_loc < end_brace_loc: --- command_end_loc = tag_seperator_loc + 1 --- --- comment = ( --- comment[0:command_begin_loc] --- + comment[command_end_loc:end_brace_loc] --- + comment[end_brace_loc + 1 :] --- ) --- --- command_begin_loc = comment.find(command, command_begin_loc) --- --- # If there is only a doxygen keyword in the line, delete the whole line. --- comment = re.sub(r"^\\[^\s]+\n", r"", comment, flags=re.M) --- -- # Delete the doxygen command and the following whitespace. -- comment = re.sub(r"\\[^\s]+\s+", r"", comment) -- return comment --@@ -248,9 +191,8 @@ -- definition. -- """ -- if declaration.strip(): --- if re.match( --- r"^\s?(#|namespace|using|template using|})", declaration --- ): --+ --+ if re.match(r"^\s?(#|namespace|using|template using|})", declaration): -- return -- -- # Node matchers are defined by writing: --diff -ruN --strip-trailing-cr a/clang/include/clang/ASTMatchers/ASTMatchers.h b/clang/include/clang/ASTMatchers/ASTMatchers.h ----- a/clang/include/clang/ASTMatchers/ASTMatchers.h --+++ b/clang/include/clang/ASTMatchers/ASTMatchers.h --@@ -39,158 +39,6 @@ -- // See ASTMatchFinder.h for how to use the generated matchers to run over -- // an AST. -- // ---// The doxygen comments on matchers are used to: ---// - create the doxygen documentation ---// - get information in the editor via signature help and goto definition ---// - generate the AST matcher reference html file ---// - test the documentation using a special syntax ---// ---// Test Annotations: ---// ---// The automatic testing uses doxygen commands (aliases) to extract the ---// relevant information about an example of using a matcher from the ---// documentation. ---// ---// \header{a.h} ---// \endheader <- zero or more header ---// ---// \code ---// int a = 42; ---// \endcode ---// \compile_args{-std=c++,c23-or-later} <- optional, the std flag supports ---// std ranges and ---// whole languages ---// ---// \matcher{expr()} <- one or more matchers in succession ---// \matcher{integerLiteral()} <- one or more matchers in succession ---// both matcher will have to match the ---// following matches ---// \match{42} <- one or more matches in succession ---// ---// \matcher{varDecl()} <- new matcher resets the context, the above ---// \match will not count for this new ---// matcher(-group) ---// \match{int a = 42} <- only applies to the previous matcher (not to the ---// previous case) ---// ---// ---// The above block can be repeated inside a doxygen command for multiple code ---// examples for a single matcher. The test generation script will only look for ---// these annotations and ignore anything else like `\c` or the sentences where ---// these annotations are embedded into: `The matcher \matcher{expr()} matches ---// the number \match{42}.`. ---// ---// Language Grammar: ---// ---// [] denotes an optional, and <> denotes user-input ---// ---// compile_args j:= \compile_args{[;]} ---// matcher_tag_key ::= type ---// match_tag_key ::= type || std || count || sub ---// matcher_tags ::= [matcher_tag_key=;]matcher_tag_key= ---// match_tags ::= [match_tag_key=;]match_tag_key= ---// matcher ::= \matcher{[matcher_tags$]} ---// matchers ::= [matcher] matcher ---// match ::= \match{[match_tags$]} ---// matches ::= [match] match ---// case ::= matchers matches ---// cases ::= [case] case ---// header-block ::= \header{} \endheader ---// code-block ::= \code \endcode ---// testcase ::= code-block [compile_args] cases ---// ---// Language Standard Versions: ---// ---// The 'std' tag and '\compile_args' support specifying a specific language ---// version, a whole language and all of its versions, and thresholds (implies ---// ranges). Multiple arguments are passed with a ',' separator. For a language ---// and version to execute a tested matcher, it has to match the specified ---// '\compile_args' for the code, and the 'std' tag for the matcher. Predicates ---// for the 'std' compiler flag are used with disjunction between languages ---// (e.g. 'c || c++') and conjunction for all predicates specific to each ---// language (e.g. 'c++11-or-later && c++23-or-earlier'). ---// ---// Examples: ---// - `c` all available versions of C ---// - `c++11` only C++11 ---// - `c++11-or-later` C++11 or later ---// - `c++11-or-earlier` C++11 or earlier ---// - `c++11-or-later,c++23-or-earlier,c` all of C and C++ between 11 and ---// 23 (inclusive) ---// - `c++11-23,c` same as above ---// ---// Tags ---// ---// `type`: ---// **Match types** are used to select where the string that is used to check if ---// a node matches comes from. Available: `code`, `name`, `typestr`, ---// `typeofstr`. The default is `code`. ---// ---// - `code`: Forwards to `tooling::fixit::getText(...)` and should be the ---// preferred way to show what matches. ---// - `name`: Casts the match to a `NamedDecl` and returns the result of ---// `getNameAsString`. Useful when the matched AST node is not easy to spell ---// out (`code` type), e.g., namespaces or classes with many members. ---// - `typestr`: Returns the result of `QualType::getAsString` for the type ---// derived from `Type` (otherwise, if it is derived from `Decl`, recurses with ---// `Node->getTypeForDecl()`) ---// ---// **Matcher types** are used to mark matchers as sub-matcher with 'sub' or as ---// deactivated using 'none'. Testing sub-matcher is not implemented. ---// ---// `count`: ---// Specifying a 'count=n' on a match will result in a test that requires that ---// the specified match will be matched n times. Default is 1. ---// ---// `std`: ---// A match allows specifying if it matches only in specific language versions. ---// This may be needed when the AST differs between language versions. ---// ---// `sub`: ---// The `sub` tag on a `\match` will indicate that the match is for a node of a ---// bound sub-matcher. E.g., `\matcher{expr(expr().bind("inner"))}` has a ---// sub-matcher that binds to `inner`, which is the value for the `sub` tag of ---// the expected match for the sub-matcher `\match{sub=inner$...}`. Currently, ---// sub-matchers are not tested in any way. ---// ---// ---// What if ...? ---// ---// ... I want to add a matcher? ---// ---// Add a doxygen comment to the matcher with a code example, corresponding ---// matchers and matches, that shows what the matcher is supposed to do. Specify ---// the compile arguments/supported languages if required, and run `ninja ---// check-clang-unit` to test the documentation. ---// ---// ... the example I wrote is wrong? ---// ---// The test-failure output of the generated test file will provide information ---// about ---// - where the generated test file is located ---// - which line in `ASTMatcher.h` the example is from ---// - which matches were: found, not-(yet)-found, expected ---// - in case of an unexpected match: what the node looks like using the ---// different `type`s ---// - the language version and if the test ran with a windows `-target` flag ---// (also in failure summary) ---// ---// ... I don't adhere to the required order of the syntax? ---// ---// The script will diagnose any found issues, such as `matcher is missing an ---// example` with a `file:line:` prefix, which should provide enough information ---// about the issue. ---// ---// ... the script diagnoses a false-positive issue with a doxygen comment? ---// ---// It hopefully shouldn't, but if you, e.g., added some non-matcher code and ---// documented it with doxygen, then the script will consider that as a matcher ---// documentation. As a result, the script will print that it detected a ---// mismatch between the actual and the expected number of failures. If the ---// diagnostic truly is a false-positive, change the ---// `expected_failure_statistics` at the top of the ---// `generate_ast_matcher_doc_tests.py` file. ---// -- //===----------------------------------------------------------------------===// -- -- #ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERS_H --@@ -312,13 +160,13 @@ -- /// additional constraint. This will often be used with an explicit conversion -- /// to an \c internal::Matcher<> type such as \c TypeMatcher. -- /// ---/// Given --+/// Example: \c DeclarationMatcher(anything()) matches all declarations, e.g., -- /// \code --+/// "int* p" and "void f()" in -- /// int* p; -- /// void f(); -- /// \endcode ---/// The matcher \matcher{decl(anything())} ---/// matches \match{int* p} and \match{void f()}. --+/// -- /// Usable as: Any Matcher -- inline internal::TrueMatcher anything() { return internal::TrueMatcher(); } -- --@@ -327,13 +175,12 @@ -- /// Given -- /// \code -- /// int X; ---/// namespace NS { int Y; } --+/// namespace NS { --+/// int Y; --+/// } // namespace NS -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{namedDecl(hasDeclContext(translationUnitDecl()))} ---/// matches \match{int X} and \match{namespace NS { int Y; }}, ---/// but does not match \nomatch{int Y} because its decl-context is the ---/// namespace \c NS . --+/// decl(hasDeclContext(translationUnitDecl())) --+/// matches "int X", but not "int Y". -- extern const internal::VariadicDynCastAllOfMatcher -- translationUnitDecl; -- --@@ -344,10 +191,8 @@ -- /// typedef int X; -- /// using Y = int; -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{typedefDecl()} ---/// matches \match{typedef int X}, ---/// but does not match \nomatch{using Y = int}. --+/// typedefDecl() --+/// matches "typedef int X", but not "using Y = int" -- extern const internal::VariadicDynCastAllOfMatcher -- typedefDecl; -- --@@ -358,9 +203,8 @@ -- /// typedef int X; -- /// using Y = int; -- /// \endcode ---/// \compile_args{-std=c++11-or-later} ---/// The matcher \matcher{typedefNameDecl()} ---/// matches \match{typedef int X} and \match{using Y = int}. --+/// typedefNameDecl() --+/// matches "typedef int X" and "using Y = int" -- extern const internal::VariadicDynCastAllOfMatcher -- typedefNameDecl; -- --@@ -371,44 +215,33 @@ -- /// typedef int X; -- /// using Y = int; -- /// \endcode ---/// \compile_args{-std=c++11-or-later} ---/// The matcher \matcher{typeAliasDecl()} ---/// matches \match{using Y = int}, ---/// but does not match \nomatch{typedef int X}. --+/// typeAliasDecl() --+/// matches "using Y = int", but not "typedef int X" -- extern const internal::VariadicDynCastAllOfMatcher -- typeAliasDecl; -- -- /// Matches type alias template declarations. -- /// ---/// Given --+/// typeAliasTemplateDecl() matches -- /// \code ---/// template struct X {}; ---/// template using Y = X; --+/// template --+/// using Y = X; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher \matcher{typeAliasTemplateDecl()} ---/// matches \match{template using Y = X}. -- extern const internal::VariadicDynCastAllOfMatcher -- typeAliasTemplateDecl; -- -- /// Matches AST nodes that were expanded within the main-file. -- /// ---/// Given the header \c Y.h ---/// \header{Y.h} ---/// #pragma once ---/// typedef int my_header_int; ---/// \endheader ---/// and the source file ---/// \code ---/// #include "Y.h" ---/// typedef int my_main_file_int; ---/// my_main_file_int a = 0; ---/// my_header_int b = 1; ---/// \endcode ---/// ---/// The matcher \matcher{typedefDecl(isExpansionInMainFile())} ---/// matches \match{typedef int my_main_file_int}, ---/// but does not match \nomatch{typedef int my_header_int}. --+/// Example matches X but not Y --+/// (matcher = cxxRecordDecl(isExpansionInMainFile()) --+/// \code --+/// #include --+/// class X {}; --+/// \endcode --+/// Y.h: --+/// \code --+/// class Y {}; --+/// \endcode -- /// -- /// Usable as: Matcher, Matcher, Matcher -- AST_POLYMORPHIC_MATCHER(isExpansionInMainFile, --@@ -420,21 +253,16 @@ -- -- /// Matches AST nodes that were expanded within system-header-files. -- /// ---/// Given the header \c SystemHeader.h ---/// \header{system_include/SystemHeader.h} ---/// #pragma once ---/// int header(); ---/// \endheader ---/// and the source code --+/// Example matches Y but not X --+/// (matcher = cxxRecordDecl(isExpansionInSystemHeader()) -- /// \code -- /// #include ---/// static int main_file(); --+/// class X {}; --+/// \endcode --+/// SystemHeader.h: --+/// \code --+/// class Y {}; -- /// \endcode ---/// \compile_args{-isystemsystem_include/} ---/// ---/// The matcher \matcher{type=none$functionDecl(isExpansionInSystemHeader())} ---/// matches \match{int header()}, ---/// but does not match \nomatch{static int main_file()}. -- /// -- /// Usable as: Matcher, Matcher, Matcher -- AST_POLYMORPHIC_MATCHER(isExpansionInSystemHeader, --@@ -450,31 +278,16 @@ -- /// Matches AST nodes that were expanded within files whose name is -- /// partially matching a given regex. -- /// ---/// Given the headers \c Y.h ---/// \header{Y.h} ---/// #pragma once ---/// typedef int my_y_int; ---/// \endheader ---/// and \c X.h ---/// \header{X.h} ---/// #pragma once ---/// typedef int my_x_int; ---/// \endheader ---/// and the source code ---/// \code ---/// #include "X.h" ---/// #include "Y.h" ---/// typedef int my_main_file_int; ---/// my_main_file_int a = 0; ---/// my_x_int b = 1; ---/// my_y_int c = 2; --+/// Example matches Y but not X --+/// (matcher = cxxRecordDecl(isExpansionInFileMatching("AST.*")) --+/// \code --+/// #include "ASTMatcher.h" --+/// class X {}; --+/// \endcode --+/// ASTMatcher.h: --+/// \code --+/// class Y {}; -- /// \endcode ---/// ---/// The matcher ---/// \matcher{type=none$typedefDecl(isExpansionInFileMatching("Y.h"))} ---/// matches \match{typedef int my_y_int}, ---/// but does not match \nomatch{typedef int my_main_file_int} or ---/// \nomatch{typedef int my_x_int}. -- /// -- /// Usable as: Matcher, Matcher, Matcher -- AST_POLYMORPHIC_MATCHER_REGEX(isExpansionInFileMatching, --@@ -500,17 +313,6 @@ -- /// Does not match if only part of the statement is expanded from that macro or -- /// if different parts of the statement are expanded from different -- /// appearances of the macro. ---/// ---/// Given ---/// \code ---/// #define A 0 ---/// #define B A ---/// int c = B; ---/// \endcode ---/// ---/// The matcher \matcher{integerLiteral(isExpandedFromMacro("A"))} ---/// matches the literal expanded at the initializer \match{B} of the variable ---/// \c c . -- AST_POLYMORPHIC_MATCHER_P(isExpandedFromMacro, -- AST_POLYMORPHIC_SUPPORTED_TYPES(Decl, Stmt, TypeLoc), -- std::string, MacroName) { --@@ -528,50 +330,35 @@ -- -- /// Matches declarations. -- /// ---/// Given --+/// Examples matches \c X, \c C, and the friend declaration inside \c C; -- /// \code -- /// void X(); -- /// class C { ---/// friend void X(); --+/// friend X; -- /// }; -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{decl()} ---/// matches \match{void X()} once, \match{type=name;count=2$C} ---/// twice, once for the definition and once for the implicit class declaration, ---/// and \match{count=2$friend void X()} twice, once for the declaration of the ---/// friend, and once for the redeclaration of the function itself. -- extern const internal::VariadicAllOfMatcher decl; -- -- /// Matches decomposition-declarations. -- /// ---/// Given --+/// Examples matches the declaration node with \c foo and \c bar, but not --+/// \c number. --+/// (matcher = declStmt(has(decompositionDecl()))) --+/// -- /// \code ---/// struct pair { int x; int y; }; ---/// pair make(int, int); -- /// int number = 42; ---/// auto [foo, bar] = make(42, 42); --+/// auto [foo, bar] = std::make_pair{42, 42}; -- /// \endcode ---/// \compile_args{-std=c++17-or-later} ---/// The matcher \matcher{decompositionDecl()} ---/// matches \match{auto [foo, bar] = make(42, 42)}, ---/// but does not match \nomatch{type=name$number}. -- extern const internal::VariadicDynCastAllOfMatcher -- decompositionDecl; -- -- /// Matches binding declarations --+/// Example matches \c foo and \c bar --+/// (matcher = bindingDecl() -- /// ---/// Given -- /// \code ---/// struct pair { int x; int y; }; ---/// pair make(int, int); ---/// void f() { ---/// auto [foo, bar] = make(42, 42); ---/// } --+/// auto [foo, bar] = std::make_pair{42, 42}; -- /// \endcode ---/// \compile_args{-std=c++17-or-later} ---/// The matcher \matcher{bindingDecl()} ---/// matches \match{type=name$foo} and \match{type=name$bar}. -- extern const internal::VariadicDynCastAllOfMatcher -- bindingDecl; -- --@@ -581,41 +368,33 @@ -- /// \code -- /// extern "C" {} -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{linkageSpecDecl()} ---/// matches \match{extern "C" {}}. --+/// linkageSpecDecl() --+/// matches "extern "C" {}" -- extern const internal::VariadicDynCastAllOfMatcher -- linkageSpecDecl; -- -- /// Matches a declaration of anything that could have a name. -- /// -- /// Example matches \c X, \c S, the anonymous union type, \c i, and \c U; ---/// Given -- /// \code -- /// typedef int X; ---/// struct S { union { int i; } U; }; --+/// struct S { --+/// union { --+/// int i; --+/// } U; --+/// }; -- /// \endcode ---/// The matcher \matcher{namedDecl()} ---/// matches \match{typedef int X}, ---/// \match{std=c$struct S { union { int i; } U; }}, \match{int i}, ---/// the unnamed union\match{type=name$} and the variable ---/// \match{union { int i; } U}, ---/// with \match{type=name;count=2;std=c++$S} matching twice in C++. ---/// Once for the implicit class declaration and once for the declaration itself. -- extern const internal::VariadicDynCastAllOfMatcher namedDecl; -- -- /// Matches a declaration of label. -- /// -- /// Given -- /// \code ---/// void bar(); ---/// void foo() { ---/// goto FOO; ---/// FOO: bar(); ---/// } --+/// goto FOO; --+/// FOO: bar(); -- /// \endcode ---/// The matcher \matcher{type=none$labelDecl()} ---/// matches \match{FOO: bar()}. --+/// labelDecl() --+/// matches 'FOO:' -- extern const internal::VariadicDynCastAllOfMatcher labelDecl; -- -- /// Matches a declaration of a namespace. --@@ -625,9 +404,8 @@ -- /// namespace {} -- /// namespace test {} -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{namespaceDecl()} ---/// matches \match{namespace {}} and \match{namespace test {}}. --+/// namespaceDecl() --+/// matches "namespace {}" and "namespace test {}" -- extern const internal::VariadicDynCastAllOfMatcher -- namespaceDecl; -- --@@ -638,53 +416,38 @@ -- /// namespace test {} -- /// namespace alias = ::test; -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{namespaceAliasDecl()} ---/// matches \match{namespace alias = ::test}, ---/// but does not match \nomatch{namespace test {}}. --+/// namespaceAliasDecl() --+/// matches "namespace alias" but not "namespace test" -- extern const internal::VariadicDynCastAllOfMatcher -- namespaceAliasDecl; -- -- /// Matches class, struct, and union declarations. -- /// ---/// Given --+/// Example matches \c X, \c Z, \c U, and \c S -- /// \code -- /// class X; -- /// template class Z {}; -- /// struct S {}; -- /// union U {}; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher \matcher{recordDecl()} ---/// matches \match{class X} once, and the rest of the declared records twice, ---/// once for their written definition and once for their implicit declaration: ---/// \match{type=name;count=2$Z}, \match{type=name;count=2$S} and ---/// \match{type=name;count=2$U}. -- extern const internal::VariadicDynCastAllOfMatcher recordDecl; -- -- /// Matches C++ class declarations. -- /// ---/// Given --+/// Example matches \c X, \c Z -- /// \code -- /// class X; -- /// template class Z {}; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher \matcher{cxxRecordDecl()} ---/// matches \match{class X} once, and \match{type=name;count=2$Z} twice, ---/// once for the written definition and once for the implicit declaration. -- extern const internal::VariadicDynCastAllOfMatcher -- cxxRecordDecl; -- -- /// Matches C++ class template declarations. -- /// ---/// Given --+/// Example matches \c Z -- /// \code -- /// template class Z {}; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher \matcher{classTemplateDecl()} ---/// matches \match{template class Z {}}. -- extern const internal::VariadicDynCastAllOfMatcher -- classTemplateDecl; -- --@@ -696,10 +459,8 @@ -- /// template<> class A {}; -- /// A a; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher \matcher{classTemplateSpecializationDecl()} ---/// matches \match{type=typestr$class A} ---/// and \match{type=typestr$class A}. --+/// classTemplateSpecializationDecl() --+/// matches the specializations \c A and \c A -- extern const internal::VariadicDynCastAllOfMatcher< -- Decl, ClassTemplateSpecializationDecl> -- classTemplateSpecializationDecl; --@@ -711,15 +472,14 @@ -- /// template -- /// class A {}; -- /// ---/// template class A {}; --+/// template --+/// class A {}; -- /// -- /// template<> -- /// class A {}; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher \matcher{classTemplatePartialSpecializationDecl()} ---/// matches \match{template class A {}}, ---/// but does not match \nomatch{A}. --+/// classTemplatePartialSpecializationDecl() --+/// matches the specialization \c A but not \c A -- extern const internal::VariadicDynCastAllOfMatcher< -- Decl, ClassTemplatePartialSpecializationDecl> -- classTemplatePartialSpecializationDecl; --@@ -731,9 +491,8 @@ -- /// \code -- /// class X { int y; }; -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{declaratorDecl()} ---/// matches \match{int y}. --+/// declaratorDecl() --+/// matches \c int y. -- extern const internal::VariadicDynCastAllOfMatcher -- declaratorDecl; -- --@@ -743,8 +502,8 @@ -- /// \code -- /// void f(int x); -- /// \endcode ---/// The matcher \matcher{parmVarDecl()} ---/// matches \match{int x}. --+/// parmVarDecl() --+/// matches \c int x. -- extern const internal::VariadicDynCastAllOfMatcher -- parmVarDecl; -- --@@ -757,36 +516,29 @@ -- /// int a; -- /// }; -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{accessSpecDecl()} ---/// matches \match{public:}. --+/// accessSpecDecl() --+/// matches 'public:' -- extern const internal::VariadicDynCastAllOfMatcher -- accessSpecDecl; -- -- /// Matches class bases. -- /// ---/// Given --+/// Examples matches \c public virtual B. -- /// \code -- /// class B {}; ---/// class C : public B {}; --+/// class C : public virtual B {}; -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{cxxRecordDecl(hasDirectBase(cxxBaseSpecifier()))} ---/// matches \match{class C : public B {}}. -- extern const internal::VariadicAllOfMatcher cxxBaseSpecifier; -- -- /// Matches constructor initializers. -- /// ---/// Given --+/// Examples matches \c i(42). -- /// \code -- /// class C { -- /// C() : i(42) {} -- /// int i; -- /// }; -- /// \endcode ---/// \compile_args{-std=c++} ---/// The matcher \matcher{cxxCtorInitializer()} ---/// matches \match{i(42)}. -- extern const internal::VariadicAllOfMatcher -- cxxCtorInitializer; -- --@@ -797,10 +549,8 @@ -- /// template struct C {}; -- /// C c; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher ---/// \matcher{templateSpecializationType(hasAnyTemplateArgument(templateArgument()))} ---/// matches \match{type=typestr$C}. --+/// templateArgument() --+/// matches 'int' in C. -- extern const internal::VariadicAllOfMatcher templateArgument; -- -- /// Matches template arguments (with location info). --@@ -810,9 +560,8 @@ -- /// template struct C {}; -- /// C c; -- /// \endcode ---/// \compile_args{-fno-delayed-template-parsing;-std=c++} ---/// The matcher \matcher{templateArgumentLoc()} ---/// matches \match{int} in C. --+/// templateArgumentLoc() --+/// matches 'int' in C. -- extern const internal::VariadicAllOfMatcher -- templateArgumentLoc; -- --@@ -820,15 +569,11 @@ -- /// -- /// Given -- /// \code ---/// template