Lines Matching full:matches

111 /// \brief If the provided matcher matches a node, binds the node to \c ID.
131 /// \brief Matches any node.
137 /// Example: \c DeclarationMatcher(anything()) matches all declarations, e.g.,
147 /// \brief Matches the top declaration context.
157 /// matches "int X", but not "int Y".
161 /// \brief Matches typedef declarations.
169 /// matches "typedef int X", but not "using Y = int"
172 /// \brief Matches typedef name declarations.
180 /// matches "typedef int X" and "using Y = int"
184 /// \brief Matches type alias declarations.
192 /// matches "using Y = int", but not "typedef int X"
195 /// \brief Matches AST nodes that were expanded within the main-file.
197 /// Example matches X but not Y
216 /// \brief Matches AST nodes that were expanded within system-header-files.
218 /// Example matches Y but not X
240 /// \brief Matches AST nodes that were expanded within files whose name is
243 /// Example matches Y but not X
274 /// \brief Matches declarations.
276 /// Examples matches \c X, \c C, and the friend declaration inside \c C;
285 /// \brief Matches a declaration of a linkage specification.
292 /// matches "extern "C" {}"
296 /// \brief Matches a declaration of anything that could have a name.
298 /// Example matches \c X, \c S, the anonymous union type, \c i, and \c U;
309 /// \brief Matches a declaration of label.
317 /// matches 'FOO:'
320 /// \brief Matches a declaration of a namespace.
328 /// matches "namespace {}" and "namespace test {}"
331 /// \brief Matches a declaration of a namespace alias.
339 /// matches "namespace alias" but not "namespace test"
343 /// \brief Matches class, struct, and union declarations.
345 /// Example matches \c X, \c Z, \c U, and \c S
356 /// \brief Matches C++ class declarations.
358 /// Example matches \c X, \c Z
367 /// \brief Matches C++ class template declarations.
369 /// Example matches \c Z
377 /// \brief Matches C++ class template specializations.
386 /// matches the specializations \c A<int> and \c A<double>
391 /// \brief Matches declarator declarations (field, variable, function
399 /// matches \c int y.
403 /// \brief Matches parameter variable declarations.
410 /// matches \c int x.
413 /// \brief Matches C++ access specifier declarations.
423 /// matches 'public:'
428 /// \brief Matches constructor initializers.
430 /// Examples matches \c i(42).
439 /// \brief Matches template arguments.
447 /// matches 'int' in C<int>.
450 /// \brief Matches non-type template parameter declarations.
457 /// matches 'N', but not 'T'.
462 /// \brief Matches template type parameter declarations.
469 /// matches 'T', but not 'N'.
474 /// \brief Matches public C++ declarations.
485 /// matches 'int a;'
490 /// \brief Matches protected C++ declarations.
501 /// matches 'int b;'
506 /// \brief Matches private C++ declarations.
517 /// matches 'int c;'
522 /// \brief Matches non-static data members that are bit-fields.
532 /// matches 'int a;' but not 'int b;'.
537 /// \brief Matches non-static data members that are bit-fields.
548 /// matches 'int a;' and 'int c;' but not 'int b;'.
554 /// \brief Matches a declaration that has been implicitly added
560 /// \brief Matches classTemplateSpecializations that have at least one
571 /// matches the specialization \c A<int>
583 /// \brief Matches expressions that match InnerMatcher after any implicit AST
606 return InnerMatcher.matches(*Node.IgnoreImplicit(), Finder, Builder); in AST_MATCHER_P()
609 /// \brief Matches expressions that match InnerMatcher after any implicit casts
636 return InnerMatcher.matches(*Node.IgnoreImpCasts(), Finder, Builder); in AST_MATCHER_P()
639 /// \brief Matches expressions that match InnerMatcher after parentheses and
657 return InnerMatcher.matches(*Node.IgnoreParenCasts(), Finder, Builder); in AST_MATCHER_P()
660 /// \brief Matches expressions that match InnerMatcher after implicit casts and
683 return InnerMatcher.matches(*Node.IgnoreParenImpCasts(), Finder, Builder); in AST_MATCHER_P()
686 /// \brief Matches types that match InnerMatcher after any parens are stripped.
699 return InnerMatcher.matches(Node.IgnoreParens(), Finder, Builder); in AST_MATCHER_P()
702 /// \brief Matches classTemplateSpecializations where the n'th TemplateArgument
703 /// matches the given InnerMatcher.
713 /// matches the specialization \c A<bool, int>
723 return InnerMatcher.matches(List[N], Finder, Builder); in AST_POLYMORPHIC_MATCHER_P2()
726 /// \brief Matches if the number of template arguments equals \p N.
734 /// matches C<int>.
743 /// \brief Matches a TemplateArgument that refers to a certain type.
753 /// matches the specialization \c A<X>
758 return InnerMatcher.matches(Node.getAsType(), Finder, Builder); in AST_MATCHER_P()
761 /// \brief Matches a canonical TemplateArgument that refers to a certain
772 /// matches the specialization \c A<&B::next> with \c fieldDecl(...) matching
777 return InnerMatcher.matches(*Node.getAsDecl(), Finder, Builder); in AST_MATCHER_P()
781 /// \brief Matches a sugar TemplateArgument that refers to a certain expression.
791 /// matches the specialization \c A<&B::next> with \c fieldDecl(...) matching
795 return InnerMatcher.matches(*Node.getAsExpr(), Finder, Builder); in AST_MATCHER_P()
799 /// \brief Matches a TemplateArgument that is an integral value.
808 /// matches the implicit instantiation of C in C<42>
814 /// \brief Matches a TemplateArgument that referes to an integral type.
823 /// matches the implicit instantiation of C in C<42>.
828 return InnerMatcher.matches(Node.getIntegralType(), Finder, Builder); in AST_MATCHER_P()
831 /// \brief Matches a TemplateArgument of integral type with a given value.
844 /// matches the implicit instantiation of C in C<42>.
852 /// \brief Matches any value declaration.
854 /// Example matches A, B, C and F
861 /// \brief Matches C++ constructor declarations.
863 /// Example matches Foo::Foo() and Foo::Foo(int)
876 /// \brief Matches explicit C++ destructor declarations.
878 /// Example matches Foo::~Foo()
889 /// \brief Matches enum declarations.
891 /// Example matches X
899 /// \brief Matches enum constants.
901 /// Example matches A, B, C
911 /// \brief Matches method declarations.
913 /// Example matches y
919 /// \brief Matches conversion operator declarations.
921 /// Example matches the operator.
928 /// \brief Matches variable declarations.
933 /// Example matches a
939 /// \brief Matches field declarations.
946 /// matches 'm'.
949 /// \brief Matches function declarations.
951 /// Example matches f
957 /// \brief Matches C++ function template declarations.
959 /// Example matches f
967 /// \brief Matches friend declarations.
974 /// matches 'friend void foo()'.
977 /// \brief Matches statements.
984 /// matches both the compound statement '{ ++a; }' and '++a'.
987 /// \brief Matches declaration statements.
994 /// matches 'int a'.
999 /// \brief Matches member expressions.
1009 /// matches this->x, x, y.x, a, this->b
1012 /// \brief Matches call expressions.
1014 /// Example matches x.y() and y()
1022 /// \brief Matches lambda expressions.
1024 /// Example matches [&](){return 5;}
1030 /// \brief Matches member call expressions.
1032 /// Example matches x.y()
1041 /// \brief Matches ObjectiveC Message invocation expressions.
1054 /// \brief Matches Objective-C interface declarations.
1056 /// Example matches Foo
1065 /// \brief Matches expressions that introduce cleanups to be run at the end
1068 /// Example matches std::string()
1076 /// \brief Matches init list expressions.
1085 /// matches "{ 1, 2 }" and "{ 5, 6 }"
1088 /// \brief Matches the syntactic form of init list expressions
1094 InnerMatcher.matches(*SyntForm, Finder, Builder)); in AST_MATCHER_P()
1097 /// \brief Matches implicit initializers of init list expressions.
1104 /// matches "[0].y" (implicitly)
1108 /// \brief Matches paren list expressions.
1121 /// parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
1125 /// \brief Matches substitutions of non-type template parameters.
1134 /// matches "N" in the right-hand side of "static const int n = N;"
1139 /// \brief Matches using declarations.
1147 /// matches \code using X::x \endcode
1150 /// \brief Matches using namespace declarations.
1158 /// matches \code using namespace X \endcode
1163 /// \brief Matches reference to a name that can be looked up during parsing
1176 /// matches \code foo<T>() \endcode
1181 /// \brief Matches unresolved using value declarations.
1191 /// matches \code using X::x \endcode
1196 /// \brief Matches unresolved using value declarations that involve the
1210 /// matches \code using Base<T>::Foo \endcode
1215 /// \brief Matches parentheses used in expressions.
1217 /// Example matches (foo() + 1)
1226 /// \brief Matches constructor call expressions (including implicit ones).
1228 /// Example matches string(ptr, n) and ptr within arguments of f
1240 /// \brief Matches unresolved constructor call expressions.
1242 /// Example matches T(t) in return statement of f
1252 /// \brief Matches implicit and explicit this expressions.
1254 /// Example matches the implicit this expression in "return i".
1264 /// \brief Matches nodes where temporaries are created.
1266 /// Example matches FunctionTakesString(GetStringByValue())
1276 /// \brief Matches nodes where temporaries are materialized.
1284 /// materializeTemporaryExpr() matches 'f()' in these statements
1298 /// \brief Matches new expressions.
1305 /// matches 'new X'.
1308 /// \brief Matches delete expressions.
1315 /// matches 'delete X'.
1318 /// \brief Matches array subscript expressions.
1325 /// matches "a[1]"
1330 /// \brief Matches the value of a default argument at the call site.
1332 /// Example matches the CXXDefaultArgExpr placeholder inserted for the
1343 /// \brief Matches overloaded operator calls.
1350 /// Example matches both operator<<((o << b), c) and operator<<(o, b)
1361 /// \brief Matches expressions.
1363 /// Example matches x()
1369 /// \brief Matches expressions that refer to declarations.
1371 /// Example matches x in if (x)
1378 /// \brief Matches if statements.
1380 /// Example matches 'if (x) {}'
1386 /// \brief Matches for statements.
1388 /// Example matches 'for (;;) {}'
1395 /// \brief Matches the increment statement of a for loop.
1399 /// matches '++x' in
1407 InnerMatcher.matches(*Increment, Finder, Builder)); in AST_MATCHER_P()
1410 /// \brief Matches the initialization statement of a for loop.
1414 /// matches 'int x = 0' in
1421 return (Init != nullptr && InnerMatcher.matches(*Init, Finder, Builder)); in AST_MATCHER_P()
1424 /// \brief Matches range-based for statements.
1426 /// cxxForRangeStmt() matches 'for (auto a : i)'
1435 /// \brief Matches the initialization statement of a for loop.
1439 /// matches 'int x' in
1446 return (Var != nullptr && InnerMatcher.matches(*Var, Finder, Builder)); in AST_MATCHER_P()
1449 /// \brief Matches the range initialization statement of a for loop.
1453 /// matches 'a' in
1460 return (Init != nullptr && InnerMatcher.matches(*Init, Finder, Builder)); in AST_MATCHER_P()
1463 /// \brief Matches while statements.
1470 /// matches 'while (true) {}'.
1473 /// \brief Matches do statements.
1480 /// matches 'do {} while(true)'
1483 /// \brief Matches break statements.
1490 /// matches 'break'
1493 /// \brief Matches continue statements.
1500 /// matches 'continue'
1503 /// \brief Matches return statements.
1510 /// matches 'return 1'
1513 /// \brief Matches goto statements.
1521 /// matches 'goto FOO'
1524 /// \brief Matches label statements.
1532 /// matches 'FOO:'
1535 /// \brief Matches address of label statements (GNU extension).
1544 /// matches '&&FOO'
1547 /// \brief Matches switch statements.
1554 /// matches 'switch(a)'.
1557 /// \brief Matches case and default statements inside switch statements.
1564 /// matches 'case 42: break;' and 'default: break;'.
1567 /// \brief Matches case statements inside switch statements.
1574 /// matches 'case 42: break;'.
1577 /// \brief Matches default statements inside switch statements.
1584 /// matches 'default: break;'.
1587 /// \brief Matches compound statements.
1589 /// Example matches '{}' and '{{}}'in 'for (;;) {{}}'
1595 /// \brief Matches catch statements.
1601 /// matches 'catch(int i)'
1604 /// \brief Matches try statements.
1610 /// matches 'try {}'
1613 /// \brief Matches throw expressions.
1619 /// matches 'throw 5'
1622 /// \brief Matches null statements.
1628 /// matches the second ';'
1631 /// \brief Matches asm statements.
1638 /// matches '__asm("mov al, 2")'
1641 /// \brief Matches bool literals.
1643 /// Example matches true
1651 /// \brief Matches string literals (also matches wide string literals).
1653 /// Example matches "abcd", L"abcd"
1662 /// \brief Matches character literals (also matches wchar_t).
1667 /// Example matches 'a', L'a'
1676 /// \brief Matches integer literals of all sizes / encodings, e.g.
1684 /// \brief Matches float literals of all sizes / encodings, e.g.
1695 /// \brief Matches user defined literal operator call.
1702 /// \brief Matches compound (i.e. non-scalar) literals
1713 /// \brief Matches nullptr literal.
1718 /// \brief Matches GNU __null expression.
1721 /// \brief Matches atomic builtins.
1722 /// Example matches __atomic_load_n(ptr, 1)
1728 /// \brief Matches statement expression (GNU extension).
1736 /// \brief Matches binary operator expressions.
1738 /// Example matches a || b
1746 /// \brief Matches unary operator expressions.
1748 /// Example matches !a
1756 /// \brief Matches conditional operator expressions.
1758 /// Example matches a ? b : c
1766 /// \brief Matches binary conditional operator expressions (GNU extension).
1768 /// Example matches a ?: b
1776 /// \brief Matches opaque value expressions. They are used as helpers
1780 /// Example matches 'a'
1788 /// \brief Matches a C++ static_assert declaration.
1792 /// matches
1805 /// \brief Matches a reinterpret_cast expression.
1811 /// Example matches reinterpret_cast<char*>(&p) in
1819 /// \brief Matches a C++ static_cast expression.
1826 /// matches
1836 /// \brief Matches a dynamic_cast expression.
1840 /// matches
1852 /// \brief Matches a const_cast expression.
1854 /// Example: Matches const_cast<int*>(&r) in
1864 /// \brief Matches a C-style cast expression.
1866 /// Example: Matches (int*) 2.2f in
1874 /// \brief Matches explicit cast expressions.
1876 /// Matches any cast expression written in user code, whether it be a
1887 /// Example: matches all five of the casts in
1899 /// \brief Matches the implicit cast nodes of Clang's AST.
1901 /// This matches many different places, including function call return value
1907 /// \brief Matches any cast nodes of Clang's AST.
1909 /// Example: castExpr() matches each of the following:
1922 /// \brief Matches functional cast expressions
1924 /// Example: Matches Foo(bar);
1934 /// \brief Matches functional cast expressions having N != 1 arguments
1936 /// Example: Matches Foo(bar, bar)
1944 /// \brief Matches predefined identifier expressions [C99 6.4.2.2].
1946 /// Example: Matches __func__
1954 /// \brief Matches C99 designated initializer expressions [C99 6.7.8].
1956 /// Example: Matches { [2].y = 1.0, [0].x = 1.0 }
1964 /// \brief Matches designated initializer expressions that contain
1973 /// matches '{ [2].y = 1.0, [0].x = 1.0 }',
1979 /// \brief Matches \c QualTypes in the clang AST.
1982 /// \brief Matches \c Types in the clang AST.
1985 /// \brief Matches \c TypeLocs in the clang AST.
1988 /// \brief Matches if any of the given matchers matches.
2011 /// \brief Matches if any of the given matchers matches.
2018 /// \brief Matches if all given matchers match.
2025 /// \brief Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
2033 /// matches \c sizeof(x) and \c alignof(x)
2038 /// \brief Matches unary expressions that have a specific type of argument.
2045 /// matches \c sizeof(a) and \c alignof(c)
2049 return InnerMatcher.matches(ArgumentType, Finder, Builder); in AST_MATCHER_P()
2052 /// \brief Matches unary expressions of a certain kind.
2060 /// matches \c sizeof(x)
2081 /// \brief Matches NamedDecl nodes that have the specified name.
2087 /// Example matches X (Name == "X")
2092 /// Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
2102 /// \brief Matches NamedDecl nodes that have any of the specified names.
2116 /// \brief Matches NamedDecl nodes whose fully qualified names contain
2123 /// Example matches X (regexp == "::X")
2128 /// Example matches X (regexp is one of "::X", "^foo::.*X", among others)
2139 /// \brief Matches overloaded operator names.
2141 /// Matches overloaded operator names specified in strings without the
2149 /// a << a; // <-- This matches
2152 /// \c cxxOperatorCallExpr(hasOverloadedOperatorName("<<"))) matches the
2155 /// matches the declaration of \c A.
2167 /// \brief Matches C++ classes that are directly or indirectly derived from
2172 /// Example matches Y, Z, C (Base == hasName("X"))
2182 /// In the following example, Bar matches isDerivedFrom(hasName("X")):
2196 return isDerivedFrom(hasName(BaseName)).matches(Node, Finder, Builder);
2199 /// \brief Similar to \c isDerivedFrom(), but also matches classes that directly
2204 .matches(Node, Finder, Builder);
2212 return isSameOrDerivedFrom(hasName(BaseName)).matches(Node, Finder, Builder);
2215 /// \brief Matches the first method of a class or struct that satisfies \c
2224 /// \c cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
2232 /// \brief Matches the generated class of lambda expressions.
2239 /// \c cxxRecordDecl(isLambda()) matches the implicit class declaration of
2245 /// \brief Matches AST nodes that have child AST nodes that match the
2248 /// Example matches X, Y
2251 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2259 /// Note that has is direct matcher, so it also matches things like implicit
2266 /// \brief Matches AST nodes that have descendant AST nodes that match the
2269 /// Example matches X, Y, Z
2272 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2283 /// \brief Matches AST nodes that have child AST nodes that match the
2286 /// Example matches X, Y
2289 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2297 /// matches instead of only on the first one.
2303 /// \brief Matches AST nodes that have descendant AST nodes that match the
2306 /// Example matches X, A, B, C
2309 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2317 /// each result that matches instead of only on the first one.
2319 /// Note: Recursively combined ForEachDescendant can cause many matches:
2323 /// will match 10 times (plus injected class name matches) on:
2332 /// \brief Matches if the node or any descendant matches.
2353 /// \brief Matches AST nodes that have a parent that matches the provided
2360 /// \c compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
2369 /// \brief Matches AST nodes that have an ancestor that matches the provided
2377 /// \c expr(integerLiteral(hasAncestor(ifStmt()))) matches \c 42, but not 43.
2386 /// \brief Matches if the provided matcher does not match.
2388 /// Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
2399 /// \brief Matches a node if the declaration associated with that node
2400 /// matches the given matcher.
2426 /// \brief Matches on the implicit object argument of a member call expression.
2428 /// Example matches y.x()
2441 InnerMatcher.matches(*ExprNode, Finder, Builder)); in AST_MATCHER_P()
2445 /// \brief Matches on the receiver of an ObjectiveC Message expression.
2449 /// matches the [webView ...] message invocation.
2458 return InnerMatcher.matches(TypeDecl, Finder, Builder); in AST_MATCHER_P()
2461 /// \brief Matches when BaseName == Selector.getAsString()
2464 /// matches the outer message expr in the code below, but NOT the message
2475 /// \brief Matches ObjC selectors whose name contains
2478 /// matches the outer message expr in the code below, but NOT the message
2490 /// \brief Matches when the selector is the empty selector
2492 /// Matches only when the selector of the objCMessageExpr is NULL. This may
2498 /// \brief Matches when the selector is a Unary Selector
2501 /// matches self.bodyView in the code below, but NOT the outer message
2510 /// \brief Matches when the selector is a keyword selector
2512 /// objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
2520 /// // ^---- matches here
2526 /// \brief Matches when the selector has the specified number of arguments
2529 /// matches self.bodyView in the code below
2532 /// matches the invocation of "loadHTMLString:baseURL:" but not that
2541 /// \brief Matches if the call expression's callee expression matches.
2549 /// matches this->x(), x(), y.x(), f()
2561 InnerMatcher.matches(*ExprNode, Finder, Builder)); in AST_MATCHER_P()
2564 /// \brief Matches if the call expression's callee's declaration matches the
2567 /// Example matches y.x() (matcher = callExpr(callee(
2575 return callExpr(hasDeclaration(InnerMatcher)).matches(Node, Finder, Builder);
2578 /// \brief Matches if the expression's or declaration's type matches a type
2581 /// Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
2592 return InnerMatcher.matches(internal::getUnderlyingType(Node),
2601 /// declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
2602 /// X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
2605 /// Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
2618 .matches(Node.getType(), Finder, Builder);
2621 /// \brief Matches if the type location of the declarator decl's type matches
2629 /// matches int x
2634 return Inner.matches(Node.getTypeSourceInfo()->getTypeLoc(), Finder, Builder); in AST_MATCHER_P()
2637 /// \brief Matches if the matched type is represented by the given string.
2645 /// matches y->x()
2650 /// \brief Matches if the matched type is a pointer type and the pointee type
2651 /// matches the specified matcher.
2653 /// Example matches y->x()
2664 InnerMatcher.matches(Node->getPointeeType(), Finder, Builder)); in AST_MATCHER_P()
2671 .matches(Node, Finder, Builder);
2674 /// \brief Matches if the matched type is a reference type and the referenced
2675 /// type matches the specified matcher.
2677 /// Example matches X &x and const X &y
2690 InnerMatcher.matches(Node->getPointeeType(), Finder, Builder)); in AST_MATCHER_P()
2693 /// \brief Matches QualTypes whose canonical type matches InnerMatcher.
2709 return InnerMatcher.matches(Node.getCanonicalType(), Finder, Builder); in AST_MATCHER_P()
2716 .matches(Node, Finder, Builder);
2723 InnerMatcher.matches(*ExprNode, Finder, Builder)); in AST_MATCHER_P()
2726 /// \brief Matches if the expression's type either matches the specified
2727 /// matcher, or is a pointer to a type that matches the InnerMatcher.
2732 .matches(Node, Finder, Builder);
2740 .matches(Node, Finder, Builder);
2743 /// \brief Matches a DeclRefExpr that refers to a declaration that matches the
2746 /// Example matches x in if(x)
2756 InnerMatcher.matches(*DeclNode, Finder, Builder)); in AST_MATCHER_P()
2759 /// \brief Matches a \c DeclRefExpr that refers to a declaration through a
2767 /// f(); // Matches this ..
2772 /// matches \c f()
2777 return InnerMatcher.matches(*UsingDecl, Finder, Builder); in AST_MATCHER_P()
2781 /// \brief Matches the Decl of a DeclStmt which has a single declaration.
2789 /// matches 'int c;' but not 'int a, b;'.
2793 return InnerMatcher.matches(*FoundDecl, Finder, Builder); in AST_MATCHER_P()
2798 /// \brief Matches a variable declaration that has an initializer expression
2799 /// that matches the given matcher.
2801 /// Example matches x (matcher = varDecl(hasInitializer(callExpr())))
2811 InnerMatcher.matches(*Initializer, Finder, Builder)); in AST_MATCHER_P()
2814 /// \brief Matches a variable declaration that has function scope and is a
2817 /// Example matches x (matcher = varDecl(hasLocalStorage())
2829 /// \brief Matches a variable declaration that does not have local storage.
2831 /// Example matches y and z (matcher = varDecl(hasGlobalStorage())
2843 /// \brief Matches a variable declaration that has automatic storage duration.
2845 /// Example matches x, but not y, z, or a.
2859 /// \brief Matches a variable declaration that has static storage duration.
2861 /// Example matches y and a, but not x or z.
2875 /// \brief Matches a variable declaration that has thread storage duration.
2877 /// Example matches z, but not x, z, or a.
2891 /// \brief Matches a variable declaration that is an exception variable from
2894 /// Example matches x (matcher = varDecl(isExceptionVariable())
2909 /// Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
2922 /// \brief Matches the n'th argument of a call expression or a constructor
2925 /// Example matches y in x(y)
2936 InnerMatcher.matches( in AST_POLYMORPHIC_MATCHER_P2()
2940 /// \brief Matches declaration statements that contain a specific number of
2950 /// matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
2955 /// \brief Matches the n'th declaration of a declaration statement.
2968 /// matches only 'int d = 2, e;', and
2971 /// matches 'int a, b = 0' as well as 'int d = 2, e;'
2981 return InnerMatcher.matches(**Iterator, Finder, Builder); in AST_MATCHER_P2()
2984 /// \brief Matches a C++ catch statement that has a catch-all handler.
2996 /// cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
3001 /// \brief Matches a constructor initializer.
3013 /// record matches Foo, hasAnyConstructorInitializer matches foo_(1)
3020 /// \brief Matches the field declaration of a constructor initializer.
3031 /// matches Foo
3037 InnerMatcher.matches(*NodeAsDecl, Finder, Builder)); in AST_MATCHER_P()
3040 /// \brief Matches the initializer expression of a constructor initializer.
3051 /// matches Foo
3057 InnerMatcher.matches(*NodeAsExpr, Finder, Builder)); in AST_MATCHER_P()
3060 /// \brief Matches a constructor initializer if it is explicitly written in
3077 /// \brief Matches a constructor initializer if it is initializing a base, as
3097 /// \brief Matches a constructor initializer if it is initializing a member, as
3117 /// \brief Matches any argument of a call expression or a constructor call
3125 /// matches x(1, y, 42)
3134 if (InnerMatcher.matches(*Arg, Finder, &Result)) { in AST_POLYMORPHIC_MATCHER_P()
3142 /// \brief Matches a constructor call expression which uses list initialization.
3147 /// \brief Matches a constructor call expression which requires
3163 /// \brief Matches the n'th parameter of a function declaration.
3170 /// matches f(int x) {}
3177 InnerMatcher.matches( in AST_MATCHER_P2()
3181 /// \brief Matches all arguments and their respective ParmVarDecl.
3194 /// matches f(y);
3208 BoundNodesTreeBuilder Matches; in AST_POLYMORPHIC_MATCHER_P2() local
3210 .matches(Node, Finder, &Matches) in AST_POLYMORPHIC_MATCHER_P2()
3217 if (ArgMatcher.matches(*(Node.getArg(ArgIndex)->IgnoreParenCasts()), in AST_POLYMORPHIC_MATCHER_P2()
3224 .matches(Node, Finder, &ParamMatches)) { in AST_POLYMORPHIC_MATCHER_P2()
3235 /// \brief Matches any parameter of a function declaration.
3244 /// matches f(int x, int y, int z) {}
3253 /// \brief Matches \c FunctionDecls and \c FunctionProtoTypes that have a
3265 /// matches void g(int i, int j) {}
3267 /// matches void h(int i, int j)
3269 /// matches void k(int x, int y, int z, ...);
3277 /// \brief Matches the return type of a function declaration.
3284 /// matches int f() { return 1; }
3287 return InnerMatcher.matches(Node.getReturnType(), Finder, Builder); in AST_MATCHER_P()
3290 /// \brief Matches extern "C" function declarations.
3299 /// matches the declaration of f and g, but not the declaration h
3304 /// \brief Matches deleted function declarations.
3312 /// matches the declaration of DeletedFunc, but not Func.
3317 /// \brief Matches defaulted function declarations.
3325 /// matches the declaration of ~B, but not ~A.
3330 /// \brief Matches functions that have a dynamic exception specification.
3353 /// \brief Matches functions that have a non-throwing exception specification.
3383 /// \brief Matches constexpr variable and function declarations.
3391 /// matches the declaration of foo.
3393 /// matches the declaration of bar.
3400 /// \brief Matches the condition expression of an if statement, for loop,
3403 /// Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
3414 InnerMatcher.matches(*Condition, Finder, Builder)); in AST_POLYMORPHIC_MATCHER_P()
3417 /// \brief Matches the then-statement of an if statement.
3419 /// Examples matches the if statement
3426 return (Then != nullptr && InnerMatcher.matches(*Then, Finder, Builder)); in AST_MATCHER_P()
3429 /// \brief Matches the else-statement of an if statement.
3431 /// Examples matches the if statement
3438 return (Else != nullptr && InnerMatcher.matches(*Else, Finder, Builder)); in AST_MATCHER_P()
3441 /// \brief Matches if a node equals a previously bound node.
3443 /// Matches a node if it equals the node previously bound to \p ID.
3452 /// matches the class \c X, as \c a and \c b have the same type.
3454 /// Note that when multiple matches are involved via \c forEach* matchers,
3478 /// \brief Matches the condition variable statement in an if statement.
3485 /// matches 'A* a = GetAPointer()'.
3491 InnerMatcher.matches(*DeclarationStatement, Finder, Builder); in AST_MATCHER_P()
3494 /// \brief Matches the index expression of an array subscript expression.
3502 /// matches \c i[1] with the \c integerLiteral() matching \c 1
3506 return InnerMatcher.matches(*Expression, Finder, Builder); in AST_MATCHER_P()
3510 /// \brief Matches the base expression of an array subscript expression.
3519 /// matches \c i[1] with the \c declRefExpr() matching \c i
3523 return InnerMatcher.matches(*Expression, Finder, Builder); in AST_MATCHER_P()
3527 /// \brief Matches a 'for', 'while', 'do while' statement or a function
3535 /// matches 'for (;;) {}'
3546 InnerMatcher.matches(*Statement, Finder, Builder)); in AST_POLYMORPHIC_MATCHER_P()
3549 /// \brief Matches compound statements where at least one substatement matches
3550 /// a given matcher. Also matches StmtExprs that have CompoundStmt as children.
3557 /// matches '{ {}; 1+2; }'
3577 /// matches '{}'
3583 /// \brief Matches literals that are equal to the given value.
3585 /// Example matches true (matcher = cxxBoolLiteral(equals(true)))
3600 /// \brief Matches the operator Name of operator expressions (binary or
3603 /// Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3614 /// \brief Matches the left hand side of binary operator expressions.
3616 /// Example matches a (matcher = binaryOperator(hasLHS()))
3626 InnerMatcher.matches(*LeftHandSide, Finder, Builder)); in AST_POLYMORPHIC_MATCHER_P()
3629 /// \brief Matches the right hand side of binary operator expressions.
3631 /// Example matches b (matcher = binaryOperator(hasRHS()))
3641 InnerMatcher.matches(*RightHandSide, Finder, Builder)); in AST_POLYMORPHIC_MATCHER_P()
3644 /// \brief Matches if either the left hand side or the right hand side of a
3645 /// binary operator matches.
3651 /// \brief Matches if the operand of a unary operator matches.
3653 /// Example matches true (matcher = hasUnaryOperand(
3662 InnerMatcher.matches(*Operand, Finder, Builder)); in AST_MATCHER_P()
3665 /// \brief Matches if the cast's source expression
3666 /// or opaque value's source expression matches the given matcher.
3668 /// Example 1: matches "a string"
3675 /// Example 2: matches 'b' (matcher =
3688 InnerMatcher.matches(*SubExpression, Finder, Builder)); in AST_POLYMORPHIC_MATCHER_P()
3691 /// \brief Matches casts that has a given cast kind.
3693 /// Example: matches the implicit cast around \c 0
3702 /// \brief Matches casts whose destination type matches a given matcher.
3709 return InnerMatcher.matches(NodeType, Finder, Builder); in AST_MATCHER_P()
3712 /// \brief Matches implicit casts whose destination type matches a given
3718 return InnerMatcher.matches(Node.getType(), Finder, Builder); in AST_MATCHER_P()
3721 /// \brief Matches RecordDecl object that are spelled with "struct."
3723 /// Example matches S, but not C or U.
3733 /// \brief Matches RecordDecl object that are spelled with "union."
3735 /// Example matches U, but not C or S.
3745 /// \brief Matches RecordDecl object that are spelled with "class."
3747 /// Example matches C, but not S or U.
3757 /// \brief Matches the true branch expression of a conditional operator.
3759 /// Example 1 (conditional ternary operator): matches a
3764 /// Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
3772 InnerMatcher.matches(*Expression, Finder, Builder)); in AST_MATCHER_P()
3775 /// \brief Matches the false branch expression of a conditional operator
3778 /// Example matches b
3787 InnerMatcher.matches(*Expression, Finder, Builder)); in AST_MATCHER_P()
3790 /// \brief Matches if a declaration has a body attached.
3792 /// Example matches A, va, fa
3809 /// \brief Matches if a function declaration is variadic.
3811 /// Example matches f, but not g or h. The function i will not match, even when
3823 /// \brief Matches the class declaration that the given method declaration
3830 /// Example matches A() in the last line
3844 InnerMatcher.matches(*Parent, Finder, Builder)); in AST_MATCHER_P()
3847 /// \brief Matches each method overriden by the given method. This matcher may
3848 /// produce multiple matches.
3858 /// matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
3861 /// The check can produce multiple matches in case of multiple inheritance, e.g.
3869 /// matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
3878 InnerMatcher.matches(*Overridden, Finder, &OverriddenBuilder); in AST_MATCHER_P()
3888 /// \brief Matches if the given method declaration is virtual.
3897 /// matches A::x
3902 /// \brief Matches if the given method declaration has an explicit "virtual".
3915 /// matches A::x but not B::x
3920 /// \brief Matches if the given method or class declaration is final.
3934 /// matches A and C::f, but not B, C, or B::f
3941 /// \brief Matches if the given method declaration is pure.
3950 /// matches A::x
3955 /// \brief Matches if the given method declaration is const.
3965 /// cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
3970 /// \brief Matches if the given method declaration declares a copy assignment
3981 /// cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
3987 /// \brief Matches if the given method declaration declares a move assignment
3998 /// cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
4004 /// \brief Matches if the given method declaration overrides another method.
4017 /// matches B::x
4022 /// \brief Matches method declarations that are user-provided.
4037 /// \brief Matches member expressions that are called with '->' as opposed
4051 /// matches this->x, x, y.x, a, this->b
4056 /// \brief Matches QualType nodes that are of integer type.
4065 /// matches "a(int)", "b(long)", but not "c(double)".
4070 /// \brief Matches QualType nodes that are of unsigned integer type.
4079 /// matches "b(unsigned long)", but not "a(int)" and "c(double)".
4084 /// \brief Matches QualType nodes that are of signed integer type.
4093 /// matches "a(int)", but not "b(unsigned long)" and "c(double)".
4098 /// \brief Matches QualType nodes that are of character type.
4107 /// matches "a(char)", "b(wchar_t)", but not "c(double)".
4112 /// \brief Matches QualType nodes that are of any pointer type; this includes
4127 /// matches "int *i" and "Foo *f", but not "int j".
4132 /// \brief Matches QualType nodes that are const-qualified, i.e., that
4144 /// matches "void b(int const)", "void c(const int)" and
4151 /// \brief Matches QualType nodes that are volatile-qualified, i.e., that
4163 /// matches "void b(int volatile)", "void c(volatile int)" and
4170 /// \brief Matches QualType nodes that have local CV-qualifiers attached to
4181 /// \c varDecl(hasType(hasLocalQualifiers())) matches only \c j and \c k.
4187 /// \brief Matches a member expression where the member is matched by a
4197 /// matches second.first
4201 return InnerMatcher.matches(*Node.getMemberDecl(), Finder, Builder); in AST_MATCHER_P()
4204 /// \brief Matches a member expression where the object expression is
4213 /// matches "x.m" and "m"
4218 return InnerMatcher.matches(*Node.getBase(), Finder, Builder); in AST_MATCHER_P()
4221 /// \brief Matches any using shadow declaration.
4229 /// matches \code using X::b \endcode
4236 /// \brief Matches a using shadow declaration where the target declaration is
4246 /// matches \code using X::b \endcode
4250 return InnerMatcher.matches(*Node.getTargetDecl(), Finder, Builder); in AST_MATCHER_P()
4253 /// \brief Matches template instantiations of function, class, or static
4265 /// matches the template instantiation of X<A>.
4284 /// \brief Matches declarations that are template instantiations or are inside
4294 /// matches 'A(int) {...};' and 'A(unsigned) {...}'.
4301 /// \brief Matches statements inside of a template instantiation.
4311 /// matches 'int i;' and 'unsigned i'.
4321 /// \brief Matches explicit template specializations of function, class, or
4330 /// matches the specialization A<int>().
4339 /// \brief Matches \c TypeLocs for which the given inner
4340 /// QualType-matcher matches.
4347 /// \brief Matches type \c bool.
4354 /// matches "bool func();"
4359 /// \brief Matches type \c void.
4366 /// matches "void func();"
4371 /// \brief Matches builtin Types.
4382 /// matches "int b", "float c" and "bool d"
4385 /// \brief Matches all kinds of arrays.
4394 /// matches "int a[]", "int b[4]" and "int c[a[0]]";
4397 /// \brief Matches C99 complex types.
4404 /// matches "_Complex float f"
4407 /// \brief Matches any real floating-point type (float, double, long double).
4415 /// matches "float f" but not "int i"
4420 /// \brief Matches arrays and C99 complex types that have a specific element
4430 /// matches "int b[7]"
4437 /// \brief Matches C arrays with a specified constant size.
4448 /// matches "int a[2]"
4451 /// \brief Matches nodes that have the specified size.
4463 /// matches "int a[42]" and "int b[2 * 21]"
4465 /// matches "abcd", L"abcd"
4473 /// \brief Matches C++ arrays whose size is a value-dependent expression.
4483 /// matches "T data[Size]"
4486 /// \brief Matches C arrays with unspecified size.
4495 /// matches "int a[]" and "int c[]"
4498 /// \brief Matches C arrays with a specified size that is not an
4510 /// matches "int c[a[0]]"
4513 /// \brief Matches \c VariableArrayType nodes that have a specific size
4524 /// matches "int a[b]"
4527 return InnerMatcher.matches(*Node.getSizeExpr(), Finder, Builder); in AST_MATCHER_P()
4530 /// \brief Matches atomic types.
4537 /// matches "_Atomic(int) i"
4540 /// \brief Matches atomic types with a specific value type.
4548 /// matches "_Atomic(int) i"
4554 /// \brief Matches types nodes representing C++11 auto types.
4563 /// matches "auto n" and "auto i"
4566 /// \brief Matches \c AutoType nodes where the deduced type is a specific type.
4577 /// matches "auto a"
4583 /// \brief Matches \c FunctionType nodes.
4591 /// matches "int (*f)(int)" and the type of "g".
4594 /// \brief Matches \c FunctionProtoType nodes.
4602 /// matches "int (*f)(int)" and the type of "g" in C++ mode.
4606 /// \brief Matches \c ParenType nodes.
4614 /// \c varDecl(hasType(pointsTo(parenType()))) matches \c ptr_to_array but not
4618 /// \brief Matches \c ParenType nodes where the inner type is a specific type.
4626 /// \c varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
4633 /// \brief Matches block pointer types, i.e. types syntactically represented as
4639 /// \brief Matches member pointer types.
4646 /// matches "A::* ptr"
4649 /// \brief Matches pointer types, but does not match Objective-C object pointer
4663 /// matches "int *a", but does not match "Foo *f".
4666 /// \brief Matches an Objective-C object pointer type, which is different from
4678 /// matches "Foo *f", but does not match "int *a".
4681 /// \brief Matches both lvalue and rvalue reference types.
4694 /// \c referenceType() matches the types of \c b, \c c, \c d, \c e, and \c f.
4697 /// \brief Matches lvalue reference types.
4710 /// \c lValueReferenceType() matches the types of \c b, \c d, and \c e. \c e is
4714 /// \brief Matches rvalue reference types.
4727 /// \c rValueReferenceType() matches the types of \c c and \c f. \c e is not
4732 /// \c pointee matches a given matcher.
4741 /// matches "int const *b"
4751 /// \brief Matches typedef types.
4758 /// matches "typedef int X"
4761 /// \brief Matches enum types.
4772 /// \c enumType() matches the type of the variable declarations of both \c c and
4776 /// \brief Matches template specialization types.
4787 /// \c templateSpecializationType() matches the type of the explicit
4791 /// \brief Matches types nodes representing unary type transformations.
4798 /// matches "__underlying_type(T)"
4801 /// \brief Matches record types (e.g. structs, classes).
4812 /// \c recordType() matches the type of the variable declarations of both \c c
4816 /// \brief Matches types specified with an elaborated type keyword or with a
4832 /// \c elaboratedType() matches the type of the variable declarations of both
4836 /// \brief Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
4837 /// matches \c InnerMatcher if the qualifier exists.
4850 /// matches the type of the variable declaration of \c d.
4854 return InnerMatcher.matches(*Qualifier, Finder, Builder); in AST_MATCHER_P()
4859 /// \brief Matches ElaboratedTypes whose named type matches \c InnerMatcher.
4872 /// hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
4876 return InnerMatcher.matches(Node.getNamedType(), Finder, Builder); in AST_MATCHER_P()
4879 /// \brief Matches types that represent the result of substituting a type for a
4890 /// \c substTemplateTypeParmType() matches the type of 't' but not '1'
4893 /// \brief Matches template type parameter types.
4895 /// Example matches T, but not int.
4902 /// \brief Matches injected class name types.
4904 /// Example matches S s, but not S<T> s.
4914 /// \brief Matches decayed type
4915 /// Example matches i[] in declaration of f.
4917 /// Example matches i[1].
4926 /// \brief Matches the decayed type, whos decayed type matches \c InnerMatcher
4929 return InnerType.matches(Node.getDecayedType(), Finder, Builder); in AST_MATCHER_P()
4932 /// \brief Matches declarations whose declaration context, interpreted as a
4933 /// Decl, matches \c InnerMatcher.
4944 /// \c cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
4949 return InnerMatcher.matches(*Decl::castFromDeclContext(DC), Finder, Builder); in AST_MATCHER_P()
4952 /// \brief Matches nested name specifiers.
4964 /// matches "ns::" and both "A::"
4967 /// \brief Same as \c nestedNameSpecifier but matches \c NestedNameSpecifierLoc.
4971 /// \brief Matches \c NestedNameSpecifierLocs for which the given inner
4972 /// NestedNameSpecifier-matcher matches.
4981 /// \brief Matches nested name specifiers that specify a type matching the
4992 /// matches "A::"
4997 return InnerMatcher.matches(QualType(Node.getAsType(), 0), Finder, Builder); in AST_MATCHER_P()
5000 /// \brief Matches nested name specifier locs that specify a type matching the
5010 /// matches "A::"
5013 return Node && InnerMatcher.matches(Node.getTypeLoc(), Finder, Builder); in AST_MATCHER_P()
5016 /// \brief Matches on the prefix of a \c NestedNameSpecifier.
5024 /// matches "A::"
5031 return InnerMatcher.matches(*NextNode, Finder, Builder);
5034 /// \brief Matches on the prefix of a \c NestedNameSpecifierLoc.
5042 /// matches "A::"
5049 return InnerMatcher.matches(NextNode, Finder, Builder);
5052 /// \brief Matches nested name specifiers that specify a namespace matching the
5061 /// matches "ns::"
5066 return InnerMatcher.matches(*Node.getAsNamespace(), Finder, Builder); in AST_MATCHER_P()
5073 /// \brief Matches if a node equals another node.
5079 /// \brief Matches if a node equals another node.
5085 /// \brief Matches if a node equals another node.
5094 /// \brief Matches each case or default statement belonging to the given switch
5095 /// statement. This matcher may produce multiple matches.
5102 /// matches four times, with "c" binding each of "case 1:", "case 2:",
5116 bool CaseMatched = InnerMatcher.matches(*SC, Finder, &CaseBuilder); in AST_MATCHER_P()
5126 /// \brief Matches each constructor initializer in a constructor definition.
5135 /// will trigger two matches, binding for 'i' and 'j' respectively.
5142 if (InnerMatcher.matches(*I, Finder, &InitBuilder)) { in AST_MATCHER_P()
5151 /// \brief Matches constructor declarations that are copy constructors.
5166 /// \brief Matches constructor declarations that are move constructors.
5181 /// \brief Matches constructor declarations that are default constructors.
5196 /// \brief Matches constructors that delegate to another constructor.
5213 /// \brief Matches constructor and conversion declarations that are marked with
5233 /// \brief Matches function and namespace declarations that are marked with
5258 /// \brief Matches anonymous namespace declarations.
5272 /// extension, matches the constant given in the statement.
5279 /// matches "case 1:"
5285 return InnerMatcher.matches(*Node.getLHS(), Finder, Builder); in AST_MATCHER_P()
5288 /// \brief Matches declaration that has a given attribute.
5294 /// decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
5305 /// \brief Matches the return value expression of a return statement
5312 /// matches 'return a + b'
5318 return InnerMatcher.matches(*RetValue, Finder, Builder); in AST_MATCHER_P()
5323 /// \brief Matches CUDA kernel call expression.
5325 /// Example matches,
5334 /// \brief Matches expressions that resolve to a null pointer constant, such as
5347 /// matches the initializer for v1, v2, v3, cp, and ip. Does not match the
5355 /// \brief Matches declaration of the function the statemenet belongs to
5365 /// matches 'return *this'
5377 if(InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) { in AST_MATCHER_P()
5381 if(InnerMatcher.matches(*LambdaExprNode->getCallOperator(), in AST_MATCHER_P()