Author: d0k Date: Wed Jan 17 08:50:14 2018 New Revision: 322687 URL: http://llvm.org/viewvc/llvm-project?rev=322687&view=rev Log: Update dump_ast_matchers for many recent changes.
The html file hasn't been updated in a long time so there are quite a few changes in there. No matchers were removed though. Modified: cfe/trunk/docs/LibASTMatchersReference.html cfe/trunk/docs/tools/dump_ast_matchers.py cfe/trunk/include/clang/ASTMatchers/ASTMatchersMacros.h Modified: cfe/trunk/docs/LibASTMatchersReference.html URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/LibASTMatchersReference.html?rev=322687&r1=322686&r2=322687&view=diff ============================================================================== --- cfe/trunk/docs/LibASTMatchersReference.html (original) +++ cfe/trunk/docs/LibASTMatchersReference.html Wed Jan 17 08:50:14 2018 @@ -1255,10 +1255,9 @@ NSString's "alloc". This matcher should <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('objcThrowStmt0')"><a name="objcThrowStmt0Anchor">objcThrowStmt</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ObjCAtThrowStmt.html">ObjCAtThrowStmt</a>>...</td></tr> -<tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C @throw statements. +<tr><td colspan="4" class="doc" id="objcThrowStmt0"><pre>Matches Objective-C statements. -Example matches @throw - @throw obj; +Example matches @throw obj; </pre></td></tr> @@ -1927,7 +1926,11 @@ Example matches a || b (matcher = binary </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>></td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>ValueT Value</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>></td><td class="name" onclick="toggle('equals5')"><a name="equals5Anchor">equals</a></td><td>bool Value</td></tr> +<tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr> + + +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>></td><td class="name" onclick="toggle('equals2')"><a name="equals2Anchor">equals</a></td><td>const ValueT Value</td></tr> <tr><td colspan="4" class="doc" id="equals2"><pre>Matches literals that are equal to the given value of type ValueT. Given @@ -1953,10 +1956,6 @@ Usable as: Matcher<<a href="http://cl </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>></td><td class="name" onclick="toggle('equals5')"><a name="equals5Anchor">equals</a></td><td>bool Value</td></tr> -<tr><td colspan="4" class="doc" id="equals5"><pre></pre></td></tr> - - <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXBoolLiteralExpr.html">CXXBoolLiteralExpr</a>></td><td class="name" onclick="toggle('equals11')"><a name="equals11Anchor">equals</a></td><td>double Value</td></tr> <tr><td colspan="4" class="doc" id="equals11"><pre></pre></td></tr> @@ -2409,7 +2408,11 @@ Example: matches the implicit cast aroun </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>></td><td class="name" onclick="toggle('equals3')"><a name="equals3Anchor">equals</a></td><td>ValueT Value</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>></td><td class="name" onclick="toggle('equals4')"><a name="equals4Anchor">equals</a></td><td>bool Value</td></tr> +<tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr> + + +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>></td><td class="name" onclick="toggle('equals3')"><a name="equals3Anchor">equals</a></td><td>const ValueT Value</td></tr> <tr><td colspan="4" class="doc" id="equals3"><pre>Matches literals that are equal to the given value of type ValueT. Given @@ -2435,10 +2438,6 @@ Usable as: Matcher<<a href="http://cl </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>></td><td class="name" onclick="toggle('equals4')"><a name="equals4Anchor">equals</a></td><td>bool Value</td></tr> -<tr><td colspan="4" class="doc" id="equals4"><pre></pre></td></tr> - - <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CharacterLiteral.html">CharacterLiteral</a>></td><td class="name" onclick="toggle('equals10')"><a name="equals10Anchor">equals</a></td><td>double Value</td></tr> <tr><td colspan="4" class="doc" id="equals10"><pre></pre></td></tr> @@ -2673,7 +2672,7 @@ fieldDecl(isBitField()) </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>></td><td class="name" onclick="toggle('equals1')"><a name="equals1Anchor">equals</a></td><td>ValueT Value</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FloatingLiteral.html">FloatingLiteral</a>></td><td class="name" onclick="toggle('equals1')"><a name="equals1Anchor">equals</a></td><td>const ValueT Value</td></tr> <tr><td colspan="4" class="doc" id="equals1"><pre>Matches literals that are equal to the given value of type ValueT. Given @@ -2811,6 +2810,7 @@ functionDecl(isExplicitTemplateSpecializ Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>> </pre></td></tr> + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('isExternC0')"><a name="isExternC0Anchor">isExternC</a></td><td></td></tr> <tr><td colspan="4" class="doc" id="isExternC0"><pre>Matches extern "C" function or variable declarations. @@ -2827,6 +2827,7 @@ varDecl(isExternC()) matches the declaration of x and y, but not the declaration of z. </pre></td></tr> + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>></td><td class="name" onclick="toggle('isInline1')"><a name="isInline1Anchor">isInline</a></td><td></td></tr> <tr><td colspan="4" class="doc" id="isInline1"><pre>Matches function and namespace declarations that are marked with the inline keyword. @@ -2974,7 +2975,11 @@ functionProtoType(parameterCountIs(3)) </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>></td><td class="name" onclick="toggle('equals0')"><a name="equals0Anchor">equals</a></td><td>ValueT Value</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>></td><td class="name" onclick="toggle('equals6')"><a name="equals6Anchor">equals</a></td><td>bool Value</td></tr> +<tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr> + + +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>></td><td class="name" onclick="toggle('equals0')"><a name="equals0Anchor">equals</a></td><td>const ValueT Value</td></tr> <tr><td colspan="4" class="doc" id="equals0"><pre>Matches literals that are equal to the given value of type ValueT. Given @@ -3000,10 +3005,6 @@ Usable as: Matcher<<a href="http://cl </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>></td><td class="name" onclick="toggle('equals6')"><a name="equals6Anchor">equals</a></td><td>bool Value</td></tr> -<tr><td colspan="4" class="doc" id="equals6"><pre></pre></td></tr> - - <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1IntegerLiteral.html">IntegerLiteral</a>></td><td class="name" onclick="toggle('equals13')"><a name="equals13Anchor">equals</a></td><td>double Value</td></tr> <tr><td colspan="4" class="doc" id="equals13"><pre></pre></td></tr> @@ -3049,7 +3050,7 @@ void f() {} </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>></td><td class="name" onclick="toggle('hasName0')"><a name="hasName0Anchor">hasName</a></td><td>std::string Name</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1NamedDecl.html">NamedDecl</a>></td><td class="name" onclick="toggle('hasName0')"><a name="hasName0Anchor">hasName</a></td><td>const std::string Name</td></tr> <tr><td colspan="4" class="doc" id="hasName0"><pre>Matches NamedDecl nodes that have the specified name. Supports specifying enclosing namespaces or classes by prefixing the name @@ -3798,6 +3799,7 @@ functionDecl(isExplicitTemplateSpecializ Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1FunctionDecl.html">FunctionDecl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXRecordDecl.html">CXXRecordDecl</a>> </pre></td></tr> + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('isExternC1')"><a name="isExternC1Anchor">isExternC</a></td><td></td></tr> <tr><td colspan="4" class="doc" id="isExternC1"><pre>Matches extern "C" function or variable declarations. @@ -3814,6 +3816,7 @@ varDecl(isExternC()) matches the declaration of x and y, but not the declaration of z. </pre></td></tr> + <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1VarDecl.html">VarDecl</a>></td><td class="name" onclick="toggle('isStaticStorageClass1')"><a name="isStaticStorageClass1Anchor">isStaticStorageClass</a></td><td></td></tr> <tr><td colspan="4" class="doc" id="isStaticStorageClass1"><pre>Matches variablefunction declarations that have "static" storage class specifier ("static" keyword) written in the source. @@ -4079,7 +4082,7 @@ Example 2 (conditional binary operator): </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>></td><td class="name" onclick="toggle('hasDeclaration15')"><a name="hasDeclaration15Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>></td><td class="name" onclick="toggle('hasDeclaration15')"><a name="hasDeclaration15Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration15"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -4090,8 +4093,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -4214,7 +4226,7 @@ Usable as: Matcher<<a href="http://cl </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>></td><td class="name" onclick="toggle('hasEitherOperand0')"><a name="hasEitherOperand0Anchor">hasEitherOperand</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1BinaryOperator.html">BinaryOperator</a>></td><td class="name" onclick="toggle('hasEitherOperand0')"><a name="hasEitherOperand0Anchor">hasEitherOperand</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasEitherOperand0"><pre>Matches if either the left hand side or the right hand side of a binary operator matches. </pre></td></tr> @@ -4311,7 +4323,7 @@ Example matches y in x(y) </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>></td><td class="name" onclick="toggle('hasDeclaration13')"><a name="hasDeclaration13Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>></td><td class="name" onclick="toggle('hasDeclaration13')"><a name="hasDeclaration13Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration13"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -4322,8 +4334,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -4505,7 +4526,7 @@ cxxNewExpr(hasArraySize(intgerLiteral(eq </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>></td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>></td><td class="name" onclick="toggle('hasDeclaration12')"><a name="hasDeclaration12Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration12"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -4516,8 +4537,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -4640,7 +4670,7 @@ Example matches y in x(y) </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('hasDeclaration14')"><a name="hasDeclaration14Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>></td><td class="name" onclick="toggle('hasDeclaration14')"><a name="hasDeclaration14Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration14"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -4651,8 +4681,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -4676,7 +4715,18 @@ caseStmt(hasCaseConstant(integerLiteral( <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CastExpr.html">CastExpr</a>></td><td class="name" onclick="toggle('hasSourceExpression0')"><a name="hasSourceExpression0Anchor">hasSourceExpression</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> -<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre></pre></td></tr> +<tr><td colspan="4" class="doc" id="hasSourceExpression0"><pre>Matches if the cast's source expression +or opaque value's source expression matches the given matcher. + +Example 1: matches "a string" +(matcher = castExpr(hasSourceExpression(cxxConstructExpr()))) +class URL { URL(string); }; +URL url = "a string"; + +Example 2: matches 'b' (matcher = +opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr()))) +int a = b ?: 1; +</pre></td></tr> <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1ClassTemplateSpecializationDecl.html">ClassTemplateSpecializationDecl</a>></td><td class="name" onclick="toggle('hasAnyTemplateArgument0')"><a name="hasAnyTemplateArgument0Anchor">hasAnyTemplateArgument</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateArgument.html">TemplateArgument</a>> InnerMatcher</td></tr> @@ -4781,7 +4831,7 @@ with compoundStmt() </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>></td><td class="name" onclick="toggle('hasDeclaration11')"><a name="hasDeclaration11Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>></td><td class="name" onclick="toggle('hasDeclaration11')"><a name="hasDeclaration11Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration11"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -4792,8 +4842,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -4945,7 +5004,7 @@ declaration of d. </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>></td><td class="name" onclick="toggle('hasDeclaration10')"><a name="hasDeclaration10Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1EnumType.html">EnumType</a>></td><td class="name" onclick="toggle('hasDeclaration10')"><a name="hasDeclaration10Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration10"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -4956,8 +5015,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5293,7 +5361,7 @@ FIXME: Unit test this matcher </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>></td><td class="name" onclick="toggle('hasDeclaration9')"><a name="hasDeclaration9Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1InjectedClassNameType.html">InjectedClassNameType</a>></td><td class="name" onclick="toggle('hasDeclaration9')"><a name="hasDeclaration9Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration9"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5304,8 +5372,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5317,7 +5394,7 @@ Usable as: Matcher<<a href="http://cl </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>></td><td class="name" onclick="toggle('hasDeclaration8')"><a name="hasDeclaration8Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1LabelStmt.html">LabelStmt</a>></td><td class="name" onclick="toggle('hasDeclaration8')"><a name="hasDeclaration8Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration8"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5328,8 +5405,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5341,7 +5427,7 @@ Usable as: Matcher<<a href="http://cl </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>></td><td class="name" onclick="toggle('hasDeclaration7')"><a name="hasDeclaration7Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1MemberExpr.html">MemberExpr</a>></td><td class="name" onclick="toggle('hasDeclaration7')"><a name="hasDeclaration7Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration7"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5352,8 +5438,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5522,7 +5617,18 @@ matches the [webView ...] message invoca <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1OpaqueValueExpr.html">OpaqueValueExpr</a>></td><td class="name" onclick="toggle('hasSourceExpression1')"><a name="hasSourceExpression1Anchor">hasSourceExpression</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Expr.html">Expr</a>> InnerMatcher</td></tr> -<tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre></pre></td></tr> +<tr><td colspan="4" class="doc" id="hasSourceExpression1"><pre>Matches if the cast's source expression +or opaque value's source expression matches the given matcher. + +Example 1: matches "a string" +(matcher = castExpr(hasSourceExpression(cxxConstructExpr()))) +class URL { URL(string); }; +URL url = "a string"; + +Example 2: matches 'b' (matcher = +opaqueValueExpr(hasSourceExpression(implicitCastExpr(declRefExpr()))) +int a = b ?: 1; +</pre></td></tr> <tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1OverloadExpr.html">OverloadExpr</a>></td><td class="name" onclick="toggle('hasAnyDeclaration0')"><a name="hasAnyDeclaration0Anchor">hasAnyDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> @@ -5601,7 +5707,7 @@ declaration of b but varDecl(hasType(qua </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('hasDeclaration6')"><a name="hasDeclaration6Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1QualType.html">QualType</a>></td><td class="name" onclick="toggle('hasDeclaration6')"><a name="hasDeclaration6Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration6"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5612,8 +5718,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5673,7 +5788,7 @@ Example matches X &x and const X &am </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>></td><td class="name" onclick="toggle('hasDeclaration5')"><a name="hasDeclaration5Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1RecordType.html">RecordType</a>></td><td class="name" onclick="toggle('hasDeclaration5')"><a name="hasDeclaration5Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration5"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5684,8 +5799,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5754,7 +5878,7 @@ with compoundStmt() </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('alignOfExpr0')"><a name="alignOfExpr0Anchor">alignOfExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('alignOfExpr0')"><a name="alignOfExpr0Anchor">alignOfExpr</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="alignOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching alignof. </pre></td></tr> @@ -5774,7 +5898,7 @@ returnStmt(forFunction(hasName("operator </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('sizeOfExpr0')"><a name="sizeOfExpr0Anchor">sizeOfExpr</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Stmt.html">Stmt</a>></td><td class="name" onclick="toggle('sizeOfExpr0')"><a name="sizeOfExpr0Anchor">sizeOfExpr</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnaryExprOrTypeTraitExpr.html">UnaryExprOrTypeTraitExpr</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="sizeOfExpr0"><pre>Same as unaryExprOrTypeTraitExpr, but only matching sizeof. </pre></td></tr> @@ -5816,7 +5940,7 @@ Example matches true (matcher = hasCondi </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>></td><td class="name" onclick="toggle('hasDeclaration4')"><a name="hasDeclaration4Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TagType.html">TagType</a>></td><td class="name" onclick="toggle('hasDeclaration4')"><a name="hasDeclaration4Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration4"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5827,8 +5951,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5929,7 +6062,7 @@ functionDecl(hasAnyTemplateArgument(refe </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>></td><td class="name" onclick="toggle('hasDeclaration3')"><a name="hasDeclaration3Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateSpecializationType.html">TemplateSpecializationType</a>></td><td class="name" onclick="toggle('hasDeclaration3')"><a name="hasDeclaration3Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration3"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5940,8 +6073,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5973,7 +6115,7 @@ functionDecl(hasTemplateArgument(0, refe </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>></td><td class="name" onclick="toggle('hasDeclaration2')"><a name="hasDeclaration2Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TemplateTypeParmType.html">TemplateTypeParmType</a>></td><td class="name" onclick="toggle('hasDeclaration2')"><a name="hasDeclaration2Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration2"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -5984,8 +6126,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -5997,7 +6148,7 @@ Usable as: Matcher<<a href="http://cl </pre></td></tr> -<tr><td>Matcher<T></td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>Matcher<T> Matcher</td></tr> +<tr><td>Matcher<T></td><td class="name" onclick="toggle('findAll0')"><a name="findAll0Anchor">findAll</a></td><td>const Matcher<T> Matcher</td></tr> <tr><td colspan="4" class="doc" id="findAll0"><pre>Matches if the node or any descendant matches. Generates results for each match. @@ -6026,7 +6177,7 @@ Example matches x (matcher = expr(hasTyp </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>></td><td class="name" onclick="toggle('hasDeclaration1')"><a name="hasDeclaration1Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1TypedefType.html">TypedefType</a>></td><td class="name" onclick="toggle('hasDeclaration1')"><a name="hasDeclaration1Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration1"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -6037,8 +6188,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, @@ -6057,7 +6217,7 @@ type of the matched node. For example, in: class A {}; using B = A; -The matcher type(hasUniqualifeidDesugaredType(recordType())) matches +The matcher type(hasUnqualifeidDesugaredType(recordType())) matches both B and A. </pre></td></tr> @@ -6081,7 +6241,7 @@ Example matches true (matcher = hasUnary </pre></td></tr> -<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>></td><td class="name" onclick="toggle('hasDeclaration0')"><a name="hasDeclaration0Anchor">hasDeclaration</a></td><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> +<tr><td>Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1UnresolvedUsingType.html">UnresolvedUsingType</a>></td><td class="name" onclick="toggle('hasDeclaration0')"><a name="hasDeclaration0Anchor">hasDeclaration</a></td><td>const Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1Decl.html">Decl</a>> InnerMatcher</td></tr> <tr><td colspan="4" class="doc" id="hasDeclaration0"><pre>Matches a node if the declaration associated with that node matches the given matcher. @@ -6092,8 +6252,17 @@ The associated declaration is: - for CXXConstructExpr, the declaration of the constructor - for CXXNewExpr, the declaration of the operator new -Also usable as Matcher<T> for any T supporting the getDecl() member -function. e.g. various subtypes of clang::Type and various expressions. +For type nodes, hasDeclaration will generally match the declaration of the +sugared type. Given + class X {}; + typedef X Y; + Y y; +in varDecl(hasType(hasDeclaration(decl()))) the decl will match the +typedefDecl. A common use case is to match the underlying, desugared type. +This can be achieved by using the hasUnqualifiedDesugaredType matcher: + varDecl(hasType(hasUnqualifiedDesugaredType( + recordType(hasDeclaration(decl()))))) +In this matcher, the decl will match the CXXRecordDecl of class X. Usable as: Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1AddrLabelExpr.html">AddrLabelExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CallExpr.html">CallExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXConstructExpr.html">CXXConstructExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1CXXNewExpr.html">CXXNewExpr</a>>, Matcher<<a href="http://clang.llvm.org/doxygen/classclang_1_1DeclRefExpr.html">DeclRefExpr</a>>, Modified: cfe/trunk/docs/tools/dump_ast_matchers.py URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/docs/tools/dump_ast_matchers.py?rev=322687&r1=322686&r2=322687&view=diff ============================================================================== --- cfe/trunk/docs/tools/dump_ast_matchers.py (original) +++ cfe/trunk/docs/tools/dump_ast_matchers.py Wed Jan 17 08:50:14 2018 @@ -95,7 +95,7 @@ def strip_doxygen(comment): def unify_arguments(args): """Gets rid of anything the user doesn't care about in the argument list.""" args = re.sub(r'internal::', r'', args) - args = re.sub(r'const\s+(.*)&', r'\1 ', args) + args = re.sub(r'extern const\s+(.*)&', r'\1 ', args) args = re.sub(r'&', r' ', args) args = re.sub(r'(^|\s)M\d?(\s)', r'\1Matcher<*>\2', args) return args @@ -150,11 +150,11 @@ def act_on_decl(declaration, comment, al comment, is_dyncast=True) return - # Parse the various matcher definition macros. - m = re.match(""".*AST_TYPE_MATCHER\( - \s*([^\s,]+\s*), - \s*([^\s,]+\s*) - \)\s*;\s*$""", declaration, flags=re.X) + # Special case of type matchers: + # AstTypeMatcher<ArgumentType> name + m = re.match(r""".*AstTypeMatcher\s*< + \s*([^\s>]+)\s*> + \s*([^\s;]+)\s*;\s*$""", declaration, flags=re.X) if m: inner, name = m.groups() add_matcher('Type', name, 'Matcher<%s>...' % inner, @@ -165,7 +165,8 @@ def act_on_decl(declaration, comment, al # comment, is_dyncast=True) return - m = re.match(""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER\( + # Parse the various matcher definition macros. + m = re.match(""".*AST_TYPE(LOC)?_TRAVERSE_MATCHER(?:_DECL)?\( \s*([^\s,]+\s*), \s*(?:[^\s,]+\s*), \s*AST_POLYMORPHIC_SUPPORTED_TYPES\(([^)]*)\) @@ -256,8 +257,8 @@ def act_on_decl(declaration, comment, al # Parse ArgumentAdapting matchers. m = re.match( - r"""^.*ArgumentAdaptingMatcherFunc<.*>\s*(?:LLVM_ATTRIBUTE_UNUSED\s*) - ([a-zA-Z]*)\s*=\s*{};$""", + r"""^.*ArgumentAdaptingMatcherFunc<.*>\s* + ([a-zA-Z]*);$""", declaration, flags=re.X) if m: name = m.groups()[0] @@ -267,7 +268,7 @@ def act_on_decl(declaration, comment, al # Parse Variadic functions. m = re.match( r"""^.*internal::VariadicFunction\s*<\s*([^,]+),\s*([^,]+),\s*[^>]+>\s* - ([a-zA-Z]*)\s*=\s*{.*};$""", + ([a-zA-Z]*);$""", declaration, flags=re.X) if m: result, arg, name = m.groups()[:3] @@ -276,15 +277,15 @@ def act_on_decl(declaration, comment, al # Parse Variadic operator matchers. m = re.match( - r"""^.*VariadicOperatorMatcherFunc\s*<\s*([^,]+),\s*([^\s>]+)\s*>\s* - ([a-zA-Z]*)\s*=\s*{.*};$""", + r"""^.*VariadicOperatorMatcherFunc\s*<\s*([^,]+),\s*([^\s]+)\s*>\s* + ([a-zA-Z]*);$""", declaration, flags=re.X) if m: min_args, max_args, name = m.groups()[:3] if max_args == '1': add_matcher('*', name, 'Matcher<*>', comment) return - elif max_args == 'UINT_MAX': + elif max_args == 'std::numeric_limits<unsigned>::max()': add_matcher('*', name, 'Matcher<*>, ..., Matcher<*>', comment) return Modified: cfe/trunk/include/clang/ASTMatchers/ASTMatchersMacros.h URL: http://llvm.org/viewvc/llvm-project/cfe/trunk/include/clang/ASTMatchers/ASTMatchersMacros.h?rev=322687&r1=322686&r2=322687&view=diff ============================================================================== --- cfe/trunk/include/clang/ASTMatchers/ASTMatchersMacros.h (original) +++ cfe/trunk/include/clang/ASTMatchers/ASTMatchersMacros.h Wed Jan 17 08:50:14 2018 @@ -359,11 +359,6 @@ ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder) \ const -/// \brief Creates a variadic matcher for both a specific \c Type as well as -/// the corresponding \c TypeLoc. -#define AST_TYPE_MATCHER(NodeType, MatcherName) \ - const ::clang::ast_matchers::internal::VariadicDynCastAllOfMatcher< \ - Type, NodeType> MatcherName // FIXME: add a matcher for TypeLoc derived classes using its custom casting // API (no longer dyn_cast) if/when we need such matching _______________________________________________ cfe-commits mailing list cfe-commits@lists.llvm.org http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits