Index: include/clang/ASTMatchers/ASTMatchers.h =================================================================== --- include/clang/ASTMatchers/ASTMatchers.h +++ include/clang/ASTMatchers/ASTMatchers.h @@ -180,6 +180,16 @@ /// matches "using Y = int", but not "typedef int X" const internal::VariadicDynCastAllOfMatcher typeAliasDecl; +/// \brief Matches type alias template declarations. +/// +/// typeAliasTemplateDecl() matches +/// \code +/// template +/// using Y = X; +/// \endcode +const internal::VariadicDynCastAllOfMatcher + typeAliasTemplateDecl; + /// \brief Matches AST nodes that were expanded within the main-file. /// /// Example matches X but not Y Index: unittests/ASTMatchers/ASTMatchersNodeTest.cpp =================================================================== --- unittests/ASTMatchers/ASTMatchersNodeTest.cpp +++ unittests/ASTMatchers/ASTMatchersNodeTest.cpp @@ -1494,6 +1494,22 @@ typedefNameDecl(hasName("typedefNameDeclTest2")))); } +TEST(TypeAliasTemplateDeclMatcher, Match) { + std::string Code = R"( + template + class X { T t; }; + + template + using typeAliasTemplateDecl = X; + + using typeAliasDecl = X; + )"; + EXPECT_TRUE( + matches(Code, typeAliasTemplateDecl(hasName("typeAliasTemplateDecl")))); + EXPECT_TRUE( + notMatches(Code, typeAliasTemplateDecl(hasName("typeAliasDecl")))); +} + TEST(ObjCMessageExprMatcher, SimpleExprs) { // don't find ObjCMessageExpr where none are present EXPECT_TRUE(notMatchesObjC("", objcMessageExpr(anything())));