Home | History | Annotate | Download | only in ASTMatchers

Lines Matching refs:Matches

98 /// \brief If the provided matcher matches a node, binds the node to \c ID.
119 /// \brief Matches any node.
125 /// Example: \c DeclarationMatcher(anything()) matches all declarations, e.g.,
135 /// \brief Matches the top declaration context.
145 /// matches "int X", but not "int Y".
149 /// \brief Matches typedef declarations.
157 /// matches "typedef int X", but not "using Y = int"
160 /// \brief Matches typedef name declarations.
168 /// matches "typedef int X" and "using Y = int"
172 /// \brief Matches type alias declarations.
180 /// matches "using Y = int", but not "typedef int X"
183 /// \brief Matches type alias template declarations.
185 /// typeAliasTemplateDecl() matches
193 /// \brief Matches AST nodes that were expanded within the main-file.
195 /// Example matches X but not Y
214 /// \brief Matches AST nodes that were expanded within system-header-files.
216 /// Example matches Y but not X
238 /// \brief Matches AST nodes that were expanded within files whose name is
241 /// Example matches Y but not X
272 /// \brief Matches declarations.
274 /// Examples matches \c X, \c C, and the friend declaration inside \c C;
283 /// \brief Matches a declaration of a linkage specification.
290 /// matches "extern "C" {}"
294 /// \brief Matches a declaration of anything that could have a name.
296 /// Example matches \c X, \c S, the anonymous union type, \c i, and \c U;
307 /// \brief Matches a declaration of label.
315 /// matches 'FOO:'
318 /// \brief Matches a declaration of a namespace.
326 /// matches "namespace {}" and "namespace test {}"
329 /// \brief Matches a declaration of a namespace alias.
337 /// matches "namespace alias" but not "namespace test"
341 /// \brief Matches class, struct, and union declarations.
343 /// Example matches \c X, \c Z, \c U, and \c S
354 /// \brief Matches C++ class declarations.
356 /// Example matches \c X, \c Z
365 /// \brief Matches C++ class template declarations.
367 /// Example matches \c Z
375 /// \brief Matches C++ class template specializations.
384 /// matches the specializations \c A<int> and \c A<double>
389 /// \brief Matches declarator declarations (field, variable, function
397 /// matches \c int y.
401 /// \brief Matches parameter variable declarations.
408 /// matches \c int x.
411 /// \brief Matches C++ access specifier declarations.
421 /// matches 'public:'
426 /// \brief Matches constructor initializers.
428 /// Examples matches \c i(42).
437 /// \brief Matches template arguments.
445 /// matches 'int' in C<int>.
448 /// \brief Matches template name.
456 /// matches 'X' in X<int>.
459 /// \brief Matches non-type template parameter declarations.
466 /// matches 'N', but not 'T'.
471 /// \brief Matches template type parameter declarations.
478 /// matches 'T', but not 'N'.
483 /// \brief Matches public C++ declarations.
494 /// matches 'int a;'
499 /// \brief Matches protected C++ declarations.
510 /// matches 'int b;'
515 /// \brief Matches private C++ declarations.
526 /// matches 'int c;'
531 /// \brief Matches non-static data members that are bit-fields.
541 /// matches 'int a;' but not 'int b;'.
546 /// \brief Matches non-static data members that are bit-fields of the specified
558 /// matches 'int a;' and 'int c;' but not 'int b;'.
564 /// \brief Matches non-static data members that have an in-class initializer.
575 /// matches 'int a;' but not 'int b;'.
577 /// matches 'int a;' and 'int b;' but not 'int c;'.
582 InnerMatcher.matches(*Initializer, Finder, Builder));
585 /// \brief Matches
591 /// \brief Matches classTemplateSpecializations, templateSpecializationType and
608 /// matches the specialization \c A<int>
611 /// matches the specialization \c f<int>
624 /// \brief Matches expressions that match InnerMatcher after any implicit AST
647 return InnerMatcher.matches(*Node.IgnoreImplicit(), Finder, Builder);
650 /// \brief Matches expressions that match InnerMatcher after any implicit casts
677 return InnerMatcher.matches(*Node.IgnoreImpCasts(), Finder, Builder);
680 /// \brief Matches expressions that match InnerMatcher after parentheses and
698 return InnerMatcher.matches(*Node.IgnoreParenCasts(), Finder, Builder);
701 /// \brief Matches expressions that match InnerMatcher after implicit casts and
724 return InnerMatcher.matches(*Node.IgnoreParenImpCasts(), Finder, Builder);
727 /// \brief Matches types that match InnerMatcher after any parens are stripped.
740 return InnerMatcher.matches(Node.IgnoreParens(), Finder, Builder);
743 /// \brief Matches classTemplateSpecializations, templateSpecializationType and
744 /// functionDecl where the n'th TemplateArgument matches the given InnerMatcher.
757 /// matches the specialization \c A<bool, int>
760 /// matches the specialization \c f<int>
771 return InnerMatcher.matches(List[N], Finder, Builder);
774 /// \brief Matches if the number of template arguments equals \p N.
782 /// matches C<int>.
791 /// \brief Matches a TemplateArgument that refers to a certain type.
801 /// matches the specialization \c A<X>
806 return InnerMatcher.matches(Node.getAsType(), Finder, Builder);
809 /// \brief Matches a TemplateArgument that refers to a certain template.
819 /// matches the specialization \c X<Y>
824 return InnerMatcher.matches(Node.getAsTemplate(), Finder, Builder);
827 /// \brief Matches a canonical TemplateArgument that refers to a certain
838 /// matches the specialization \c A<&B::next> with \c fieldDecl(...) matching
843 return InnerMatcher.matches(*Node.getAsDecl(), Finder, Builder);
847 /// \brief Matches a sugar TemplateArgument that refers to a certain expression.
857 /// matches the specialization \c A<&B::next> with \c fieldDecl(...) matching
861 return InnerMatcher.matches(*Node.getAsExpr(), Finder, Builder);
865 /// \brief Matches a TemplateArgument that is an integral value.
874 /// matches the implicit instantiation of C in C<42>
880 /// \brief Matches a TemplateArgument that referes to an integral type.
889 /// matches the implicit instantiation of C in C<42>.
894 return InnerMatcher.matches(Node.getIntegralType(), Finder, Builder);
897 /// \brief Matches a TemplateArgument of integral type with a given value.
910 /// matches the implicit instantiation of C in C<42>.
918 /// \brief Matches any value declaration.
920 /// Example matches A, B, C and F
927 /// \brief Matches C++ constructor declarations.
929 /// Example matches Foo::Foo() and Foo::Foo(int)
942 /// \brief Matches explicit C++ destructor declarations.
944 /// Example matches Foo::~Foo()
955 /// \brief Matches enum declarations.
957 /// Example matches X
965 /// \brief Matches enum constants.
967 /// Example matches A, B, C
977 /// \brief Matches method declarations.
979 /// Example matches y
985 /// \brief Matches conversion operator declarations.
987 /// Example matches the operator.
994 /// \brief Matches variable declarations.
999 /// Example matches a
1005 /// \brief Matches field declarations.
1012 /// matches 'm'.
1015 /// \brief Matches function declarations.
1017 /// Example matches f
1023 /// \brief Matches C++ function template declarations.
1025 /// Example matches f
1033 /// \brief Matches friend declarations.
1040 /// matches 'friend void foo()'.
1043 /// \brief Matches statements.
1050 /// matches both the compound statement '{ ++a; }' and '++a'.
1053 /// \brief Matches declaration statements.
1060 /// matches 'int a'.
1065 /// \brief Matches member expressions.
1075 /// matches this->x, x, y.x, a, this->b
1078 /// \brief Matches call expressions.
1080 /// Example matches x.y() and y()
1088 /// \brief Matches lambda expressions.
1090 /// Example matches [&](){return 5;}
1096 /// \brief Matches member call expressions.
1098 /// Example matches x.y()
1107 /// \brief Matches ObjectiveC Message invocation expressions.
1120 /// \brief Matches Objective-C interface declarations.
1122 /// Example matches Foo
1131 /// \brief Matches Objective-C protocol declarations.
1133 /// Example matches FooDelegate
1142 /// \brief Matches Objective-C category declarations.
1144 /// Example matches Foo (Additions)
1153 /// \brief Matches
1155 /// Example matches both declaration and definition of -[Foo method]
1169 /// \brief Matches Objective-C instance variable declarations.
1171 /// Example matches _enabled
1182 /// \brief Matches Objective-C property declarations.
1184 /// Example matches enabled
1194 /// \brief Matches expressions that introduce cleanups to be run at the end
1197 /// Example matches std::string()
1205 /// \brief Matches init list expressions.
1214 /// matches "{ 1, 2 }" and "{ 5, 6 }"
1217 /// \brief Matches the syntactic form of init list expressions
1223 InnerMatcher.matches(*SyntForm, Finder, Builder));
1226 /// \brief Matches C++ initializer list expressions.
1236 /// matches "{ 1, 2, 3 }" and "{ 4, 5 }"
1240 /// \brief Matches implicit initializers of init list expressions.
1247 /// matches "[0].y" (implicitly)
1251 /// \brief Matches paren list expressions.
1264 /// parenListExpr() matches "*this" but NOT matches (a, b) because (a, b)
1268 /// \brief Matches substitutions of non-type template parameters.
1277 /// matches "N" in the right-hand side of "static const int n = N;"
1282 /// \brief Matches using declarations.
1290 /// matches \code using X::x \endcode
1293 /// \brief Matches using namespace declarations.
1301 /// matches \code using namespace X \endcode
1306 /// \brief Matches reference to a name that can be looked up during parsing
1319 /// matches \code foo<T>() \endcode
1324 /// \brief Matches unresolved using value declarations.
1334 /// matches \code using X::x \endcode
1339 /// \brief Matches unresolved using value declarations that involve the
1353 /// matches \code using Base<T>::Foo \endcode
1358 /// \brief Matches parentheses used in expressions.
1360 /// Example matches (foo() + 1)
1369 /// \brief Matches constructor call expressions (including implicit ones).
1371 /// Example matches string(ptr, n) and ptr within arguments of f
1383 /// \brief Matches unresolved constructor call expressions.
1385 /// Example matches T(t) in return statement of f
1395 /// \brief Matches implicit and explicit this expressions.
1397 /// Example matches the implicit this expression in "return i".
1407 /// \brief Matches nodes where temporaries are created.
1409 /// Example matches FunctionTakesString(GetStringByValue())
1419 /// \brief Matches nodes where temporaries are materialized.
1427 /// materializeTemporaryExpr() matches 'f()' in these statements
1441 /// \brief Matches new expressions.
1448 /// matches 'new X'.
1451 /// \brief Matches delete expressions.
1458 /// matches 'delete X'.
1461 /// \brief Matches array subscript expressions.
1468 /// matches "a[1]"
1473 /// \brief Matches the value of a default argument at the call site.
1475 /// Example matches the CXXDefaultArgExpr placeholder inserted for the
1486 /// \brief Matches overloaded operator calls.
1493 /// Example matches both operator<<((o << b), c) and operator<<(o, b)
1504 /// \brief Matches expressions.
1506 /// Example matches x()
1512 /// \brief Matches expressions that refer to declarations.
1514 /// Example matches x in if (x)
1521 /// \brief Matches if statements.
1523 /// Example matches 'if (x) {}'
1529 /// \brief Matches for statements.
1531 /// Example matches 'for (;;) {}'
1538 /// \brief Matches the increment statement of a for loop.
1542 /// matches '++x' in
1550 InnerMatcher.matches(*Increment, Finder, Builder));
1553 /// \brief Matches the initialization statement of a for loop.
1557 /// matches 'int x = 0' in
1564 return (Init != nullptr && InnerMatcher.matches(*Init, Finder, Builder));
1567 /// \brief Matches range-based for statements.
1569 /// cxxForRangeStmt() matches 'for (auto a : i)'
1578 /// \brief Matches the initialization statement of a for loop.
1582 /// matches 'int x' in
1589 return (Var != nullptr && InnerMatcher.matches(*Var, Finder, Builder));
1592 /// \brief Matches the range initialization statement of a for loop.
1596 /// matches 'a' in
1603 return (Init != nullptr && InnerMatcher.matches(*Init, Finder, Builder));
1606 /// \brief Matches while statements.
1613 /// matches 'while (true) {}'.
1616 /// \brief Matches do statements.
1623 /// matches 'do {} while(true)'
1626 /// \brief Matches break statements.
1633 /// matches 'break'
1636 /// \brief Matches continue statements.
1643 /// matches 'continue'
1646 /// \brief Matches return statements.
1653 /// matches 'return 1'
1656 /// \brief Matches goto statements.
1664 /// matches 'goto FOO'
1667 /// \brief Matches label statements.
1675 /// matches 'FOO:'
1678 /// \brief Matches address of label statements (GNU extension).
1687 /// matches '&&FOO'
1690 /// \brief Matches switch statements.
1697 /// matches 'switch(a)'.
1700 /// \brief Matches case and default statements inside switch statements.
1707 /// matches 'case 42: break;' and 'default: break;'.
1710 /// \brief Matches case statements inside switch statements.
1717 /// matches 'case 42: break;'.
1720 /// \brief Matches default statements inside switch statements.
1727 /// matches 'default: break;'.
1730 /// \brief Matches compound statements.
1732 /// Example matches '{}' and '{{}}'in 'for (;;) {{}}'
1738 /// \brief Matches catch statements.
1744 /// matches 'catch(int i)'
1747 /// \brief Matches try statements.
1753 /// matches 'try {}'
1756 /// \brief Matches throw expressions.
1762 /// matches 'throw 5'
1765 /// \brief Matches null statements.
1771 /// matches the second ';'
1774 /// \brief Matches asm statements.
1781 /// matches '__asm("mov al, 2")'
1784 Matches bool literals.
1786 /// Example matches true
1794 /// \brief Matches string literals (also matches wide string literals).
1796 /// Example matches "abcd", L"abcd"
1805 /// \brief Matches character literals (also matches wchar_t).
1810 /// Example matches 'a', L'a'
1819 /// \brief Matches integer literals of all sizes / encodings, e.g.
1827 /// \brief Matches float literals of all sizes / encodings, e.g.
1838 /// \brief Matches user defined literal operator call.
1845 /// \brief Matches compound (i.e. non-scalar) literals
1856 /// \brief Matches nullptr literal.
1861 /// \brief Matches GNU __null expression.
1864 /// \brief Matches atomic builtins.
1865 /// Example matches __atomic_load_n(ptr, 1)
1871 /// \brief Matches statement expression (GNU extension).
1879 /// \brief Matches binary operator expressions.
1881 /// Example matches a || b
1889 /// \brief Matches unary operator expressions.
1891 /// Example matches !a
1899 /// \brief Matches conditional operator expressions.
1901 /// Example matches a ? b : c
1909 /// \brief Matches binary conditional operator expressions (GNU extension).
1911 /// Example matches a ?: b
1919 /// \brief Matches opaque value expressions. They are used as helpers
1923 /// Example matches 'a'
1931 /// \brief Matches a C++ static_assert declaration.
1935 /// matches
1948 /// \brief Matches a reinterpret_cast expression.
1954 /// Example matches reinterpret_cast<char*>(&p) in
1962 /// \brief Matches a C++ static_cast expression.
1969 /// matches
1979 /// \brief Matches a dynamic_cast expression.
1983 /// matches
1995 /// \brief Matches a const_cast expression.
1997 /// Example: Matches const_cast<int*>(&r) in
2007 /// \brief Matches a C-style cast expression.
2009 /// Example: Matches (int) 2.2f in
2017 /// \brief Matches explicit cast expressions.
2019 /// Matches any cast expression written in user code, whether it be a
2030 /// Example: matches all five of the casts in
2042 /// \brief Matches the implicit cast nodes of Clang's AST.
2044 /// This matches many different places, including function call return value
2050 /// \brief Matches any cast nodes of Clang's AST.
2052 /// Example: castExpr() matches each of the following:
2065 /// \brief Matches functional cast expressions
2067 /// Example: Matches Foo(bar);
2077 /// \brief Matches functional cast expressions having N != 1 arguments
2079 /// Example: Matches Foo(bar, bar)
2087 /// \brief Matches predefined identifier expressions [C99 6.4.2.2].
2089 /// Example: Matches __func__
2097 /// \brief Matches C99 designated initializer expressions [C99 6.7.8].
2099 /// Example: Matches { [2].y = 1.0, [0].x = 1.0 }
2107 /// \brief Matches designated initializer expressions that contain
2116 /// matches '{ [2].y = 1.0, [0].x = 1.0 }',
2122 /// \brief Matches \c QualTypes in the clang AST.
2125 /// \brief Matches \c Types in the clang AST.
2128 /// \brief Matches \c TypeLocs in the clang AST.
2131 /// \brief Matches if any of the given matchers matches.
2154 /// \brief Matches if any of the given matchers matches.
2161 /// \brief Matches if all given matchers match.
2168 /// \brief Matches sizeof (C99), alignof (C++11) and vec_step (OpenCL)
2176 /// matches \c sizeof(x) and \c alignof(x)
2181 /// \brief Matches unary expressions that have a specific type of argument.
2188 /// matches \c sizeof(a) and \c alignof(c)
2192 return InnerMatcher.matches(ArgumentType, Finder, Builder);
2195 /// \brief Matches unary expressions of a certain kind.
2203 /// matches \c sizeof(x)
2224 /// \brief Matches NamedDecl nodes that have the specified name.
2230 /// Example matches X (Name == "X")
2235 /// Example matches X (Name is one of "::a::b::X", "a::b::X", "b::X", "X")
2245 /// \brief Matches NamedDecl nodes that have any of the specified names.
2259 /// \brief Matches NamedDecl nodes whose fully qualified names contain
2266 /// Example matches X (regexp == "::X")
2271 /// Example matches X (regexp is one of "::X", "^foo::.*X", among others)
2282 /// \brief Matches overloaded operator names.
2284 /// Matches overloaded operator names specified in strings without the
2292 /// a << a; // <-- This matches
2295 /// \c cxxOperatorCallExpr(hasOverloadedOperatorName("<<"))) matches the
2298 /// matches the declaration of \c A.
2310 /// \brief Matches C++ classes that are directly or indirectly derived from
2315 /// Example matches Y, Z, C (Base == hasName("X"))
2325 /// In the following example, Bar matches isDerivedFrom(hasName("X")):
2339 return isDerivedFrom(hasName(BaseName)).matches(Node, Finder, Builder);
2342 /// \brief Similar to \c isDerivedFrom(), but also matches classes that directly
2347 .matches(Node, Finder, Builder);
2355 return isSameOrDerivedFrom(hasName(BaseName)).matches(Node, Finder, Builder);
2358 /// \brief Matches the first method of a class or struct that satisfies \c
2367 /// \c cxxRecordDecl(hasMethod(hasName("func"))) matches the declaration of
2375 /// \brief Matches the generated class of lambda expressions.
2382 /// \c cxxRecordDecl(isLambda()) matches the implicit class declaration of
2388 /// \brief Matches AST nodes that have child AST nodes that match the
2391 /// Example matches X, Y
2394 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2402 /// Note that has is direct matcher, so it also matches things like implicit
2409 /// \brief Matches AST nodes that have descendant AST nodes that match the
2412 /// Example matches X, Y, Z
2415 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2426 /// \brief Matches AST nodes that have child AST nodes that match the
2429 /// Example matches X, Y
2432 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2440 /// matches instead of only on the first one.
2446 /// \brief Matches AST nodes that have descendant AST nodes that match the
2449 /// Example matches X, A, B, C
2452 /// class X {}; // Matches X, because X::X is a class of name X inside X.
2460 /// each result that matches instead of only on the first one.
2462 /// Note: Recursively combined ForEachDescendant can cause many matches:
2466 /// will match 10 times (plus injected class name matches) on:
2475 /// \brief Matches if the node or any descendant matches.
2496 /// \brief Matches AST nodes that have a parent that matches the provided
2503 /// \c compoundStmt(hasParent(ifStmt())) matches "{ int x = 43; }".
2512 /// \brief Matches AST nodes that have an ancestor that matches the provided
2520 /// \c expr(integerLiteral(hasAncestor(ifStmt()))) matches \c 42, but not 43.
2529 /// \brief Matches if the provided matcher does not match.
2531 /// Example matches Y (matcher = cxxRecordDecl(unless(hasName("X"))))
2542 /// \brief Matches a node if the declaration associated with that node
2543 /// matches the given matcher.
2571 /// \brief Matches a \c NamedDecl whose underlying declaration matches the given
2581 /// matches the use of \c f in \c g() .
2587 InnerMatcher.matches(*UnderlyingDecl, Finder, Builder);
2590 /// \brief Matches on the implicit object argument of a member call expression.
2592 /// Example matches y.x()
2605 InnerMatcher.matches(*ExprNode, Finder, Builder));
2609 /// \brief Matches on the receiver of an ObjectiveC Message expression.
2613 /// matches the [webView ...] message invocation.
2622 return InnerMatcher.matches(TypeDecl, Finder, Builder);
2625 /// \brief Matches when BaseName == Selector.getAsString()
2628 /// matches the outer message expr in the code below, but NOT the message
2639 /// \brief Matches ObjC selectors whose name contains
2642 /// matches the outer message expr in the code below, but NOT the message
2654 /// \brief Matches when the selector is the empty selector
2656 /// Matches only when the selector of the objCMessageExpr is NULL. This may
2662 /// \brief Matches when the selector is a Unary Selector
2665 /// matches self.bodyView in the code below, but NOT the outer message
2674 /// \brief Matches when the selector is a keyword selector
2676 /// objCMessageExpr(hasKeywordSelector()) matches the generated setFrame
2684 /// // ^---- matches here
2690 /// \brief Matches when the selector has the specified number of arguments
2693 /// matches self.bodyView in the code below
2696 /// matches the invocation of "loadHTMLString:baseURL:" but not that
2705 /// \brief Matches if the call expression's callee expression matches.
2713 /// matches this->x(), x(), y.x(), f()
2725 InnerMatcher.matches(*ExprNode, Finder, Builder));
2728 /// \brief Matches if the call expression's callee's declaration matches the
2731 /// Example matches y.x() (matcher = callExpr(callee(
2739 return callExpr(hasDeclaration(InnerMatcher)).matches(Node, Finder, Builder);
2742 /// \brief Matches if the expression's or declaration's type matches a type
2745 /// Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
2756 return InnerMatcher.matches(internal::getUnderlyingType(Node),
2765 /// declaration "X x;", cxxRecordDecl(hasName("X")) matches the declaration of
2766 /// X, while varDecl(hasType(cxxRecordDecl(hasName("X")))) matches the
2769 /// Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
2782 .matches(Node.getType(), Finder, Builder);
2785 /// \brief Matches if the type location of the declarator decl's type matches
2793 /// matches int x
2798 return Inner.matches(Node.getTypeSourceInfo()->getTypeLoc(), Finder, Builder);
2801 /// \brief Matches if the matched type is represented by the given string.
2809 /// matches y->x()
2814 /// \brief Matches if the matched type is a pointer type and the pointee type
2815 matches the specified matcher.
2817 /// Example matches y->x()
2828 InnerMatcher.matches(Node->getPointeeType(), Finder, Builder));
2835 .matches(Node, Finder, Builder);
2838 /// \brief Matches if the matched type matches the unqualified desugared
2846 /// The matcher type(hasUniqualifeidDesugaredType(recordType())) matches
2850 return InnerMatcher.matches(*Node.getUnqualifiedDesugaredType(), Finder,
2854 /// \brief Matches if the matched type is a reference type and the referenced
2855 /// type matches the specified matcher.
2857 /// Example matches X &x and const X &y
2870 InnerMatcher.matches(Node->getPointeeType(), Finder, Builder));
2873 /// \brief Matches QualTypes whose canonical type matches InnerMatcher.
2889 return InnerMatcher.matches(Node.getCanonicalType(), Finder, Builder);
2896 .matches(Node, Finder, Builder);
2903 InnerMatcher.matches(*ExprNode, Finder, Builder));
2906 /// \brief Matches if the expression's type either matches the specified
2907 /// matcher, or is a pointer to a type that matches the InnerMatcher.
2912 .matches(Node, Finder, Builder);
2920 .matches(Node, Finder, Builder);
2923 /// \brief Matches a DeclRefExpr that refers to a declaration that matches the
2926 /// Example matches x in if(x)
2936 InnerMatcher.matches(*DeclNode, Finder, Builder));
2939 /// \brief Matches a \c DeclRefExpr that refers to a declaration through a
2947 /// f(); // Matches this ..
2952 /// matches \c f()
2957 return InnerMatcher.matches(*UsingDecl, Finder, Builder);
2961 /// \brief Matches an \c OverloadExpr if any of the declarations in the set of
2962 /// overloads matches the given matcher.
2975 /// matches \c foo in \c foo(t); but not \c bar in \c bar(t);
2982 /// \brief Matches the Decl of a DeclStmt which has a single declaration.
2990 /// matches 'int c;' but not 'int a, b;'.
2994 return InnerMatcher.matches(*FoundDecl, Finder, Builder);
2999 /// \brief Matches a variable declaration that has an initializer expression
3000 /// that matches the given matcher.
3002 /// Example matches x (matcher = varDecl(hasInitializer(callExpr())))
3012 InnerMatcher.matches(*Initializer, Finder, Builder));
3015 /// \brief Matches a variable declaration that has function scope and is a
3018 /// Example matches x (matcher = varDecl(hasLocalStorage())
3030 /// \brief Matches a variable declaration that does not have local storage.
3032 /// Example matches y and z (matcher = varDecl(hasGlobalStorage())
3044 /// \brief Matches a variable declaration that has automatic storage duration.
3046 /// Example matches x, but not y, z, or a.
3060 /// \brief Matches a variable declaration that has static storage duration.
3074 /// matches the function declaration y, a, b and c.
3080 /// \brief Matches a variable declaration that has thread storage duration.
3082 /// Example matches z, but not x, z, or a.
3096 /// \brief Matches a variable declaration that is an exception variable from
3099 /// Example matches x (matcher = varDecl(isExceptionVariable())
3114 /// Example matches f(0, 0) (matcher = callExpr(argumentCountIs(2)))
3127 /// \brief Matches the n'th argument of a call expression or a constructor
3130 /// Example matches y in x(y)
3141 InnerMatcher.matches(
3145 /// \brief Matches declaration statements that contain a specific number of
3155 /// matches 'int a, b;' and 'int d = 2, e;', but not 'int c;'.
3160 /// \brief Matches the n'th declaration of a declaration statement.
3173 /// matches only 'int d = 2, e;', and
3176 /// matches 'int a, b = 0' as well as 'int d = 2, e;'
3186 return InnerMatcher.matches(**Iterator, Finder, Builder);
3189 /// \brief Matches a C++ catch statement that has a catch-all handler.
3201 /// cxxCatchStmt(isCatchAll()) matches catch(...) but not catch(int).
3206 /// \brief Matches a constructor initializer.
3218 /// record matches Foo, hasAnyConstructorInitializer matches foo_(1)
3225 /// \brief Matches the field declaration of a constructor initializer.
3236 /// matches Foo
3242 InnerMatcher.matches(*NodeAsDecl, Finder, Builder));
3245 /// \brief Matches the initializer expression of a constructor initializer.
3256 /// matches Foo
3262 InnerMatcher.matches(*NodeAsExpr, Finder, Builder));
3265 /// \brief Matches a constructor initializer if it is explicitly written in
3282 /// \brief Matches a constructor initializer if it is initializing a base, as
3302 /// \brief Matches a constructor initializer if it is initializing a member, as
3322 /// \brief Matches any argument of a call expression or a constructor call
3330 /// matches x(1, y, 42)
3339 if (InnerMatcher.matches(*Arg, Finder, &Result)) {
3347 /// \brief Matches a constructor call expression which uses list initialization.
3352 /// \brief Matches
3368 /// \brief Matches the n'th parameter of a function declaration.
3375 /// matches f(int x) {}
3382 InnerMatcher.matches(
3386 /// \brief Matches all arguments and their respective ParmVarDecl.
3399 /// matches f(y);
3413 BoundNodesTreeBuilder Matches;
3415 .matches(Node, Finder, &Matches)
3422 if (ArgMatcher.matches(*(Node.getArg(ArgIndex)->IgnoreParenCasts()),
3429 .matches(Node, Finder, &ParamMatches)) {
3440 /// \brief Matches any parameter of a function declaration.
3449 /// matches f(int x, int y, int z) {}
3458 /// \brief Matches \c FunctionDecls and \c FunctionProtoTypes that have a
3470 /// matches void g(int i, int j) {}
3472 /// matches void h(int i, int j)
3474 /// matches void k(int x, int y, int z, ...);
3482 /// \brief Matches the return type of a function declaration.
3489 /// matches int f() { return 1; }
3492 return InnerMatcher.matches(Node.getReturnType(), Finder, Builder);
3495 /// \brief Matches extern "C" function declarations.
3504 /// matches the declaration of f and g, but not the declaration h
3510 /// \brief Matches variable/function declarations that have "static" storage
3521 /// matches the function declaration f.
3523 /// matches the variable declaration i.
3530 /// \brief Matches deleted function declarations.
3538 /// matches the declaration of DeletedFunc, but not Func.
3543 /// \brief Matches defaulted function declarations.
3551 /// matches the declaration of ~B, but not ~A.
3556 /// \brief Matches functions that have a dynamic exception specification.
3579 /// \brief Matches functions that have a non-throwing exception specification.
3609 /// \brief Matches constexpr variable and function declarations.
3617 /// matches the declaration of foo.
3619 /// matches the declaration of bar.
3626 /// \brief Matches the condition expression of an if statement, for loop,
3629 /// Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
3640 InnerMatcher.matches(*Condition, Finder, Builder));
3643 /// \brief Matches the then-statement of an if statement.
3645 /// Examples matches the if statement
3652 return (Then != nullptr && InnerMatcher.matches(*Then, Finder, Builder));
3655 /// \brief Matches the else-statement of an if statement.
3657 /// Examples matches the if statement
3664 return (Else != nullptr && InnerMatcher.matches(*Else, Finder, Builder));
3667 /// \brief Matches if a node equals a previously bound node.
3669 /// Matches a node if it equals the node previously bound to \p ID.
3678 /// matches the class \c X, as \c a and \c b have the same type.
3680 /// Note that when multiple matches are involved via \c forEach* matchers,
3704 /// \brief Matches the condition variable statement in an if statement.
3711 /// matches 'A* a = GetAPointer()'.
3717 InnerMatcher.matches(*DeclarationStatement, Finder, Builder);
3720 /// \brief Matches the index expression of an array subscript expression.
3728 /// matches \c i[1] with the \c integerLiteral() matching \c 1
3732 return InnerMatcher.matches(*Expression, Finder, Builder);
3736 /// \brief Matches the base expression of an array subscript expression.
3745 /// matches \c i[1] with the \c declRefExpr() matching \c i
3749 return InnerMatcher.matches(*Expression, Finder, Builder);
3753 /// \brief Matches a 'for', 'while', 'do while' statement or a function
3761 /// matches 'for (;;) {}'
3772 InnerMatcher.matches(*Statement, Finder, Builder));
3775 /// \brief Matches compound statements where at least one substatement matches
3776 /// a given matcher. Also matches StmtExprs that have CompoundStmt as children.
3783 /// matches '{ {}; 1+2; }'
3803 /// matches '{}'
3809 /// \brief Matches literals that are equal to the given value of type ValueT.
3816 /// matches '\0'
3822 /// matches 42
3862 /// \brief Matches the operator Name of operator expressions (binary or
3865 /// Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
3876 /// \brief Matches the left hand side of binary operator expressions.
3878 /// Example matches a (matcher = binaryOperator(hasLHS()))
3888 InnerMatcher.matches(*LeftHandSide, Finder, Builder));
3891 /// \brief Matches the right hand side of binary operator expressions.
3893 /// Example matches b (matcher = binaryOperator(hasRHS()))
3903 InnerMatcher.matches(*RightHandSide, Finder, Builder));
3906 /// \brief Matches if either the left hand side or the right hand side of a
3907 /// binary operator matches.
3913 /// \brief Matches if the operand of a unary operator matches.
3915 /// Example matches true (matcher = hasUnaryOperand(
3924 InnerMatcher.matches(*Operand, Finder, Builder));
3927 /// \brief Matches if the cast's source expression
3928 /// or opaque value's source expression matches the given matcher.
3930 /// Example 1: matches "a string"
3937 /// Example 2: matches 'b' (matcher =
3950 InnerMatcher.matches(*SubExpression, Finder, Builder));
3953 /// \brief Matches casts that has a given cast kind.
3955 /// Example: matches the implicit cast around \c 0
3964 /// \brief Matches casts whose destination type matches a given matcher.
3971 return InnerMatcher.matches(NodeType, Finder, Builder);
3974 /// \brief Matches implicit casts whose destination type matches a given
3980 return InnerMatcher.matches(Node.getType(), Finder, Builder);
3983 /// \brief Matches RecordDecl object that are spelled with "struct."
3985 /// Example matches S, but not C or U.
3995 /// \brief Matches RecordDecl object that are spelled with "union."
3997 /// Example matches U, but not C or S.
4007 /// \brief Matches RecordDecl object that are spelled with "class."
4009 /// Example matches C, but not S or U.
4019 /// \brief Matches the true branch expression of a conditional operator.
4021 /// Example 1 (conditional ternary operator): matches a
4026 /// Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
4034 InnerMatcher.matches(*Expression, Finder, Builder));
4037 /// \brief Matches the false branch expression of a conditional operator
4040 /// Example matches b
4049 InnerMatcher.matches(*Expression, Finder, Builder));
4052 /// \brief Matches if a declaration has a body attached.
4054 /// Example matches A, va, fa
4071 /// \brief Matches if a function declaration is variadic.
4073 /// Example matches f, but not g or h. The function i will not match, even when
4085 /// \brief Matches the class declaration that the given method declaration
4092 /// Example matches A() in the last line
4106 InnerMatcher.matches(*Parent, Finder, Builder));
4109 /// \brief Matches each method overriden by the given method. This matcher may
4110 /// produce multiple matches.
4120 /// matches once, with "b" binding "A::f" and "d" binding "C::f" (Note
4123 /// The check can produce multiple matches in case of multiple inheritance, e.g.
4131 /// matches twice, once with "b" binding "A1::f" and "d" binding "C::f", and
4140 InnerMatcher.matches(*Overridden, Finder, &OverriddenBuilder);
4150 /// \brief Matches if the given method declaration is virtual.
4159 /// matches A::x
4164 /// \brief Matches if the given method declaration has an explicit "virtual".
4177 /// matches A::x but not B::x
4182 /// \brief Matches if the given method or class declaration is final.
4196 /// matches A and C::f, but not B, C, or B::f
4203 /// \brief Matches if the given method declaration is pure.
4212 /// matches A::x
4217 /// \brief Matches if the given method declaration is const.
4227 /// cxxMethodDecl(isConst()) matches A::foo() but not A::bar()
4232 /// \brief Matches if the given method declaration declares a copy assignment
4243 /// cxxMethodDecl(isCopyAssignmentOperator()) matches the first method but not
4249 /// \brief Matches if the given method declaration declares a move assignment
4260 /// cxxMethodDecl(isMoveAssignmentOperator()) matches the second method but not
4266 /// \brief Matches if the given method declaration overrides another method.
4279 /// matches B::x
4284 /// \brief Matches method declarations that are user-provided.
4299 /// \brief Matches member expressions that are called with '->' as opposed
4313 /// matches this->x, x, y.x, a, this->b
4318 /// \brief Matches QualType nodes that are of integer type.
4327 /// matches "a(int)", "b(long)", but not "c(double)".
4332 /// \brief Matches QualType nodes that are of unsigned integer type.
4341 /// matches "b(unsigned long)", but not "a(int)" and "c(double)".
4346 /// \brief Matches QualType nodes that are of signed integer type.
4355 /// matches "a(int)", but not "b(unsigned long)" and "c(double)".
4360 /// \brief Matches QualType nodes that are of character type.
4369 /// matches "a(char)", "b(wchar_t)", but not "c(double)".
4374 /// \brief Matches QualType nodes that are of any pointer type; this includes
4389 /// matches "int *i" and "Foo *f", but not "int j".
4394 /// \brief Matches QualType nodes that are const-qualified, i.e., that
4406 /// matches "void b(int const)", "void c(const int)" and
4413 /// \brief Matches QualType nodes that are volatile-qualified, i.e., that
4425 /// matches "void b(int volatile)", "void c(volatile int)" and
4432 /// \brief Matches QualType nodes that have local CV-qualifiers attached to
4443 /// \c varDecl(hasType(hasLocalQualifiers())) matches only \c j and \c k.
4449 /// \brief Matches a member expression where the member is matched by a
4459 /// matches second.first
4463 return InnerMatcher.matches(*Node.getMemberDecl(), Finder, Builder);
4466 /// \brief Matches a member expression where the object expression is
4475 /// matches "x.m" and "m"
4480 return InnerMatcher.matches(*Node.getBase(), Finder, Builder);
4483 /// \brief Matches any using shadow declaration.
4491 /// matches \code using X::b \endcode
4498 /// \brief Matches a using shadow declaration where the target declaration is
4508 /// matches \code using X::b \endcode
4512 return InnerMatcher.matches(*Node.getTargetDecl(), Finder, Builder);
4515 /// \brief Matches template instantiations of function, class, or static
4527 /// matches the template instantiation of X<A>.
4546 /// \brief Matches declarations that are template instantiations or are inside
4556 /// matches 'A(int) {...};' and 'A(unsigned) {...}'.
4563 /// \brief Matches statements inside of a template instantiation.
4573 /// matches 'int i;' and 'unsigned i'.
4583 /// \brief Matches explicit template specializations of function, class, or
4592 /// matches the specialization A<int>().
4601 /// \brief Matches \c TypeLocs for which the given inner
4602 /// QualType-matcher matches.
4609 /// \brief Matches type \c bool.
4616 /// matches "bool func();"
4621 /// \brief Matches type \c void.
4628 /// matches "void func();"
4633 /// \brief Matches builtin Types.
4644 /// matches "int b", "float c" and "bool d"
4647 /// \brief Matches all kinds of arrays.
4656 /// matches "int a[]", "int b[4]" and "int c[a[0]]";
4659 /// \brief Matches C99 complex types.
4666 /// matches "_Complex float f"
4669 /// \brief Matches any real floating-point type (float, double, long double).
4677 /// matches "float f" but not "int i"
4682 /// \brief Matches arrays and C99 complex types that have a specific element
4692 /// matches "int b[7]"
4699 /// \brief Matches C arrays with a specified constant size.
4710 /// matches "int a[2]"
4713 /// \brief Matches nodes that have the specified size.
4725 /// matches "int a[42]" and "int b[2 * 21]"
4727 /// matches "abcd", L"abcd"
4735 /// \brief Matches C++ arrays whose size is a value-dependent expression.
4745 /// matches "T data[Size]"
4748 /// \brief Matches C arrays with unspecified size.
4757 /// matches "int a[]" and "int c[]"
4760 /// \brief Matches C arrays with a specified size that is not an
4772 /// matches "int c[a[0]]"
4775 /// \brief Matches \c VariableArrayType nodes that have a specific size
4786 /// matches "int a[b]"
4789 return InnerMatcher.matches(*Node.getSizeExpr(), Finder, Builder);
4792 /// \brief Matches atomic types.
4799 /// matches "_Atomic(int) i"
4802 /// \brief Matches atomic types with a specific value type.
4810 /// matches "_Atomic(int) i"
4816 /// \brief Matches types nodes representing C++11 auto types.
4825 /// matches "auto n" and "auto i"
4828 /// \brief Matches \c AutoType nodes where the deduced type is a specific type.
4839 /// matches "auto a"
4845 /// \brief Matches \c FunctionType nodes.
4853 /// matches "int (*f)(int)" and the type of "g".
4856 /// \brief Matches \c FunctionProtoType nodes.
4864 /// matches "int (*f)(int)" and the type of "g" in C++ mode.
4868 /// \brief Matches \c ParenType nodes.
4876 /// \c varDecl(hasType(pointsTo(parenType()))) matches \c ptr_to_array but not
4880 /// \brief Matches \c ParenType nodes where the inner type is a specific type.
4888 /// \c varDecl(hasType(pointsTo(parenType(innerType(functionType()))))) matches
4895 /// \brief Matches block pointer types, i.e. types syntactically represented as
4901 /// \brief Matches member pointer types.
4908 /// matches "A::* ptr"
4911 /// \brief Matches pointer types, but does not match Objective-C object pointer
4925 /// matches "int *a", but does not match "Foo *f".
4928 /// \brief Matches an Objective-C object pointer type, which is different from
4940 /// matches "Foo *f", but does not match "int *a".
4943 /// \brief Matches both lvalue and rvalue reference types.
4956 /// \c referenceType() matches the types of \c b, \c c, \c d, \c e, and \c f.
4959 /// \brief Matches lvalue reference types.
4972 /// \c lValueReferenceType() matches the types of \c b, \c d, and \c e. \c e is
4976 /// \brief Matches rvalue reference types.
4989 /// \c rValueReferenceType() matches
4994 /// \c pointee matches a given matcher.
5003 /// matches "int const *b"
5013 /// \brief Matches typedef types.
5020 /// matches "typedef int X"
5023 /// \brief Matches enum types.
5034 /// \c enumType() matches the type of the variable declarations of both \c c and
5038 /// \brief Matches template specialization types.
5049 /// \c templateSpecializationType() matches the type of the explicit
5053 /// \brief Matches types nodes representing unary type transformations.
5060 /// matches "__underlying_type(T)"
5063 /// \brief Matches record types (e.g. structs, classes).
5074 /// \c recordType() matches the type of the variable declarations of both \c c
5078 /// \brief Matches types specified with an elaborated type keyword or with a
5094 /// \c elaboratedType() matches the type of the variable declarations of both
5098 /// \brief Matches ElaboratedTypes whose qualifier, a NestedNameSpecifier,
5099 /// matches \c InnerMatcher if the qualifier exists.
5112 /// matches the type of the variable declaration of \c d.
5116 return InnerMatcher.matches(*Qualifier, Finder, Builder);
5121 /// \brief Matches ElaboratedTypes whose named type matches \c InnerMatcher.
5134 /// hasDeclaration(namedDecl(hasName("D")))))) matches the type of the variable
5138 return InnerMatcher.matches(Node.getNamedType(), Finder, Builder);
5141 /// \brief Matches types that represent the result of substituting a type for a
5152 /// \c substTemplateTypeParmType() matches the type of 't' but not '1'
5155 /// \brief Matches template type parameter substitutions that have a replacement
5156 /// type that matches the provided matcher.
5166 /// \c substTemplateTypeParmType(hasReplacementType(type())) matches int
5171 /// \brief Matches template type parameter types.
5173 /// Example matches T, but not int.
5180 /// \brief Matches injected class name types.
5182 /// Example matches S s, but not S<T> s.
5192 /// \brief Matches decayed type
5193 /// Example matches i[] in declaration of f.
5195 /// Example matches i[1].
5204 /// \brief Matches the decayed type, whos decayed type matches \c InnerMatcher
5207 return InnerType.matches(Node.getDecayedType(), Finder, Builder);
5210 /// \brief Matches declarations whose declaration context, interpreted as a
5211 /// Decl, matches \c InnerMatcher.
5222 /// \c cxxRcordDecl(hasDeclContext(namedDecl(hasName("M")))) matches the
5227 return InnerMatcher.matches(*Decl::castFromDeclContext(DC), Finder, Builder);
5230 /// \brief Matches nested name specifiers.
5242 /// matches "ns::" and both "A::"
5245 /// \brief Same as \c nestedNameSpecifier but matches \c NestedNameSpecifierLoc.
5249 /// \brief Matches \c NestedNameSpecifierLocs for which the given inner
5250 /// NestedNameSpecifier-matcher matches.
5259 /// \brief Matches nested name specifiers that specify a type matching the
5270 /// matches "A::"
5275 return InnerMatcher.matches(QualType(Node.getAsType(), 0), Finder, Builder);
5278 /// \brief Matches nested name specifier locs that specify a type matching the
5288 /// matches "A::"
5291 return Node && InnerMatcher.matches(Node.getTypeLoc(), Finder, Builder);
5294 /// \brief Matches on the prefix of a \c NestedNameSpecifier.
5302 /// matches "A::"
5309 return InnerMatcher.matches(*NextNode, Finder, Builder);
5312 /// \brief Matches on the prefix of a \c NestedNameSpecifierLoc.
5320 /// matches "A::"
5327 return InnerMatcher.matches(NextNode, Finder, Builder);
5330 /// \brief Matches nested name specifiers that specify a namespace matching the
5339 /// matches "ns::"
5344 return InnerMatcher.matches(*Node.getAsNamespace(), Finder, Builder);
5351 /// \brief Matches if a node equals another node.
5357 /// \brief Matches if a node equals another node.
5363 /// \brief Matches if a node equals another node.
5372 /// \brief Matches each case or default statement belonging to the given switch
5373 /// statement. This matcher may produce multiple matches.
5380 /// matches four times, with "c" binding each of "case 1:", "case 2:",
5394 bool CaseMatched = InnerMatcher.matches(*SC, Finder, &CaseBuilder);
5404 /// \brief Matches each constructor initializer in a constructor definition.
5413 /// will trigger two matches, binding for 'i' and 'j' respectively.
5420 if (InnerMatcher.matches(*I, Finder, &InitBuilder)) {
5429 /// \brief Matches constructor declarations that are copy constructors.
5444 /// \brief Matches constructor declarations that are move constructors.
5459 /// \brief Matches constructor declarations that are default constructors.
5474 /// \brief Matches constructors that delegate to another constructor.
5491 /// \brief Matches constructor and conversion declarations that are marked with
5511 /// \brief Matches function and namespace declarations that are marked with
5536 /// \brief Matches anonymous namespace declarations.
5550 /// extension, matches the constant given in the statement.
5557 /// matches "case 1:"
5563 return InnerMatcher.matches(*Node.getLHS(), Finder, Builder);
5566 /// \brief Matches declaration that has a given attribute.
5572 /// decl(hasAttr(clang::attr::CUDADevice)) matches the function declaration of
5583 /// \brief Matches the return value expression of a return statement
5590 /// matches 'return a + b'
5596 return InnerMatcher.matches(*RetValue, Finder, Builder);
5601 /// \brief Matches CUDA kernel call expression.
5603 /// Example matches,
5612 /// \brief Matches expressions that resolve to a null pointer constant, such as
5625 /// matches the initializer for v1, v2, v3, cp, and ip. Does not match the
5633 /// \brief Matches declaration of the function the statement belongs to
5643 /// matches 'return *this'
5655 if(InnerMatcher.matches(*FuncDeclNode, Finder, Builder)) {
5659 if(InnerMatcher.matches(*LambdaExprNode->getCallOperator(),
5671 /// \brief Matches a declaration that has external formal linkage.
5673 /// Example matches only z (matcher = varDecl(hasExternalFormalLinkage()))
5682 /// Example matches f() because it has external formal linkage despite being