From: Benjamin Kramer Date: Wed, 17 Jan 2018 16:50:14 +0000 (+0000) Subject: Update dump_ast_matchers for many recent changes. X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=584c883bb0dd01d97f21c1fa617fd03e438d41c7;p=clang 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. git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@322687 91177308-0d34-0410-b5e6-96231b3b80d8 --- diff --git a/docs/LibASTMatchersReference.html b/docs/LibASTMatchersReference.html index ed1ec193d8..ab6255260f 100644 --- a/docs/LibASTMatchersReference.html +++ b/docs/LibASTMatchersReference.html @@ -1255,10 +1255,9 @@ NSString's "alloc". This matcher should match both message sends. Matcher<Stmt>objcThrowStmtMatcher<ObjCAtThrowStmt>... -
Matches Objective-C @throw statements.
+
Matches Objective-C statements.
 
-Example matches @throw
-  @throw obj;
+Example matches @throw obj;
 
@@ -1927,7 +1926,11 @@ Example matches a || b (matcher = binaryOperator(hasOperatorName("||")))
-Matcher<CXXBoolLiteralExpr>equalsValueT Value +Matcher<CXXBoolLiteralExpr>equalsbool Value +

+
+
+Matcher<CXXBoolLiteralExpr>equalsconst ValueT  Value
 
Matches literals that are equal to the given value of type ValueT.
 
 Given
@@ -1953,10 +1956,6 @@ Usable as: Matcher<CXXBoolLiteralExpr>equalsbool Value
-

-
-
 Matcher<CXXBoolLiteralExpr>equalsdouble Value
 

 
@@ -2409,7 +2408,11 @@ Example: matches the implicit cast around 0
 
-Matcher<CharacterLiteral>equalsValueT Value +Matcher<CharacterLiteral>equalsbool Value +

+
+
+Matcher<CharacterLiteral>equalsconst ValueT  Value
 
Matches literals that are equal to the given value of type ValueT.
 
 Given
@@ -2435,10 +2438,6 @@ Usable as: Matcher<CharacterLiteral>equalsbool Value
-

-
-
 Matcher<CharacterLiteral>equalsdouble Value
 

 
@@ -2673,7 +2672,7 @@ fieldDecl(isBitField())
 
-Matcher<FloatingLiteral>equalsValueT Value +Matcher<FloatingLiteral>equalsconst ValueT Value
Matches literals that are equal to the given value of type ValueT.
 
 Given
@@ -2811,6 +2810,7 @@ functionDecl(isExplicitTemplateSpecialization())
 Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl>
 
+ Matcher<FunctionDecl>isExternC
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.
 
+ Matcher<FunctionDecl>isInline
Matches function and namespace declarations that are marked with
 the inline keyword.
@@ -2974,7 +2975,11 @@ functionProtoType(parameterCountIs(3))
 
-Matcher<IntegerLiteral>equalsValueT Value +Matcher<IntegerLiteral>equalsbool Value +

+
+
+Matcher<IntegerLiteral>equalsconst ValueT  Value
 
Matches literals that are equal to the given value of type ValueT.
 
 Given
@@ -3000,10 +3005,6 @@ Usable as: Matcher<IntegerLiteral>equalsbool Value
-

-
-
 Matcher<IntegerLiteral>equalsdouble Value
 

 
@@ -3049,7 +3050,7 @@ void f() {}
 
-Matcher<NamedDecl>hasNamestd::string Name +Matcher<NamedDecl>hasNameconst std::string Name
Matches NamedDecl nodes that have the specified name.
 
 Supports specifying enclosing namespaces or classes by prefixing the name
@@ -3798,6 +3799,7 @@ functionDecl(isExplicitTemplateSpecialization())
 Usable as: Matcher<FunctionDecl>, Matcher<VarDecl>, Matcher<CXXRecordDecl>
 
+ Matcher<VarDecl>isExternC
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.
 
+ Matcher<VarDecl>isStaticStorageClass
Matches variablefunction declarations that have "static" storage
 class specifier ("static" keyword) written in the source.
@@ -4079,7 +4082,7 @@ Example 2 (conditional binary operator): matches opaqueValueExpr(condition)
 
-Matcher<AddrLabelExpr>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<AddrLabelExpr>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -4214,7 +4226,7 @@ Usable as: Matcher<BinaryOperator>hasEitherOperandMatcher<Expr>  InnerMatcher
+Matcher<BinaryOperator>hasEitherOperandconst Matcher<Expr>  InnerMatcher
 
Matches if either the left hand side or the right hand side of a
 binary operator matches.
 
@@ -4311,7 +4323,7 @@ Example matches y in x(y)
-Matcher<CXXConstructExpr>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<CXXConstructExpr>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -4505,7 +4526,7 @@ cxxNewExpr(hasArraySize(intgerLiteral(equals(10))))
 
-Matcher<CXXNewExpr>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<CXXNewExpr>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -4640,7 +4670,7 @@ Example matches y in x(y)
 
-Matcher<CallExpr>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<CallExpr>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -4676,7 +4715,18 @@ caseStmt(hasCaseConstant(integerLiteral()))
 
 
 Matcher<CastExpr>hasSourceExpressionMatcher<Expr> InnerMatcher
-

+
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;
+
Matcher<ClassTemplateSpecializationDecl>hasAnyTemplateArgumentMatcher<TemplateArgument> InnerMatcher @@ -4781,7 +4831,7 @@ with compoundStmt()
-Matcher<DeclRefExpr>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<DeclRefExpr>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -4945,7 +5004,7 @@ declaration of d.
 
-Matcher<EnumType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<EnumType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5293,7 +5361,7 @@ FIXME: Unit test this matcher
 
-Matcher<InjectedClassNameType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<InjectedClassNameType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5317,7 +5394,7 @@ Usable as: Matcher<LabelStmt>hasDeclarationMatcher<Decl>  InnerMatcher
+Matcher<LabelStmt>hasDeclarationconst Matcher<Decl>  InnerMatcher
 
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5341,7 +5427,7 @@ Usable as: Matcher<MemberExpr>hasDeclarationMatcher<Decl>  InnerMatcher
+Matcher<MemberExpr>hasDeclarationconst Matcher<Decl>  InnerMatcher
 
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5522,7 +5617,18 @@ matches the [webView ...] message invocation.
 
 
 Matcher<OpaqueValueExpr>hasSourceExpressionMatcher<Expr> InnerMatcher
-

+
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;
+
Matcher<OverloadExpr>hasAnyDeclarationMatcher<Decl> InnerMatcher @@ -5601,7 +5707,7 @@ declaration of b but varDecl(hasType(qualType(hasCanonicalType(referenceType()))
-Matcher<QualType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<QualType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5673,7 +5788,7 @@ Example matches X &x and const X &y
 
-Matcher<RecordType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<RecordType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5754,7 +5878,7 @@ with compoundStmt()
 
-Matcher<Stmt>alignOfExprMatcher<UnaryExprOrTypeTraitExpr> InnerMatcher +Matcher<Stmt>alignOfExprconst Matcher<UnaryExprOrTypeTraitExpr> InnerMatcher
Same as unaryExprOrTypeTraitExpr, but only matching
 alignof.
 
@@ -5774,7 +5898,7 @@ returnStmt(forFunction(hasName("operator=")))
-Matcher<Stmt>sizeOfExprMatcher<UnaryExprOrTypeTraitExpr> InnerMatcher +Matcher<Stmt>sizeOfExprconst Matcher<UnaryExprOrTypeTraitExpr> InnerMatcher
Same as unaryExprOrTypeTraitExpr, but only matching
 sizeof.
 
@@ -5816,7 +5940,7 @@ Example matches true (matcher = hasCondition(cxxBoolLiteral(equals(true))))
-Matcher<TagType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<TagType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5929,7 +6062,7 @@ functionDecl(hasAnyTemplateArgument(refersToType(asString("int"))))
 
-Matcher<TemplateSpecializationType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<TemplateSpecializationType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5973,7 +6115,7 @@ functionDecl(hasTemplateArgument(0, refersToType(asString("int"))))
 
-Matcher<TemplateTypeParmType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<TemplateTypeParmType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -5997,7 +6148,7 @@ Usable as: Matcher<findAllMatcher<T>  Matcher
+Matcher<T>findAllconst Matcher<T>  Matcher
 
Matches if the node or any descendant matches.
 
 Generates results for each match.
@@ -6026,7 +6177,7 @@ Example matches x (matcher = expr(hasType(cxxRecordDecl(hasName("X")))))
 
-Matcher<TypedefType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<TypedefType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
@@ -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.
 
@@ -6081,7 +6241,7 @@ Example matches true (matcher = hasUnaryOperand(
-Matcher<UnresolvedUsingType>hasDeclarationMatcher<Decl> InnerMatcher +Matcher<UnresolvedUsingType>hasDeclarationconst Matcher<Decl> InnerMatcher
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<AddrLabelExpr>, Matcher<CallExpr>,
   Matcher<CXXConstructExpr>, Matcher<CXXNewExpr>, Matcher<DeclRefExpr>,
diff --git a/docs/tools/dump_ast_matchers.py b/docs/tools/dump_ast_matchers.py
index 45540405de..ab7738fd76 100755
--- a/docs/tools/dump_ast_matchers.py
+++ b/docs/tools/dump_ast_matchers.py
@@ -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, allowed_types):
                   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 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, allowed_types):
       #             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, allowed_types):
 
     # 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, allowed_types):
     # 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, allowed_types):
 
     # 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::max()':
         add_matcher('*', name, 'Matcher<*>, ..., Matcher<*>', comment)
         return
 
diff --git a/include/clang/ASTMatchers/ASTMatchersMacros.h b/include/clang/ASTMatchers/ASTMatchersMacros.h
index 6a48da821a..19333244f0 100644
--- a/include/clang/ASTMatchers/ASTMatchersMacros.h
+++ b/include/clang/ASTMatchers/ASTMatchersMacros.h
@@ -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