diff options
Diffstat (limited to 'include/clang/ASTMatchers/ASTMatchers.h')
-rw-r--r-- | include/clang/ASTMatchers/ASTMatchers.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h index 33ef3dc8d6..55f0772bd8 100644 --- a/include/clang/ASTMatchers/ASTMatchers.h +++ b/include/clang/ASTMatchers/ASTMatchers.h @@ -164,6 +164,14 @@ const internal::VariadicDynCastAllOfMatcher< Decl, CXXRecordDecl> record; +/// \brief Matches C++ class template declarations. +/// +/// Example matches Z +/// template<class T> class Z {}; +const internal::VariadicDynCastAllOfMatcher< + Decl, + ClassTemplateDecl> classTemplate; + /// \brief Matches C++ class template specializations. /// /// Given @@ -385,6 +393,13 @@ const internal::VariadicDynCastAllOfMatcher<Decl, FieldDecl> field; /// void f(); const internal::VariadicDynCastAllOfMatcher<Decl, FunctionDecl> function; +/// \brief Matches C++ function template declarations. +/// +/// Example matches f +/// template<class T> void f(T t) {} +const internal::VariadicDynCastAllOfMatcher< + Decl, + FunctionTemplateDecl> functionTemplate; /// \brief Matches statements. /// @@ -1941,6 +1956,21 @@ isTemplateInstantiation() { internal::IsTemplateInstantiationMatcher>(); } +/// \brief Matches explicit template specializations of function, class, or +/// static member variable template instantiations. +/// +/// Given +/// template<typename T> void A(T t) { } +/// template<> void A(int N) { } +/// function(isExplicitSpecialization()) +/// matches the specialization A<int>(). +inline internal::PolymorphicMatcherWithParam0< + internal::IsExplicitTemplateSpecializationMatcher> +isExplicitTemplateSpecialization() { + return internal::PolymorphicMatcherWithParam0< + internal::IsExplicitTemplateSpecializationMatcher>(); +} + } // end namespace ast_matchers } // end namespace clang |