summaryrefslogtreecommitdiffstats
path: root/include/clang/ASTMatchers
diff options
context:
space:
mode:
authorMalcolm Parsons <malcolm.parsons@gmail.com>2016-12-08 11:46:22 +0000
committerMalcolm Parsons <malcolm.parsons@gmail.com>2016-12-08 11:46:22 +0000
commitba42896805731bb4a3fabf982f76d655b00aa0dd (patch)
tree3540bfc9d91c53a62421d13306adab3f5da208dd /include/clang/ASTMatchers
parentbd8606322a4dfc279e889608c09e1a3772fa218a (diff)
[ASTMatcher] Add hasReplacementType matcher for SubstTemplateTypeParmType
Summary: Needed for https://reviews.llvm.org/D27166 Reviewers: sbenza, bkramer, klimek Subscribers: aemerson, cfe-commits Differential Revision: https://reviews.llvm.org/D27447 git-svn-id: https://llvm.org/svn/llvm-project/cfe/trunk@289042 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'include/clang/ASTMatchers')
-rw-r--r--include/clang/ASTMatchers/ASTMatchers.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/clang/ASTMatchers/ASTMatchers.h b/include/clang/ASTMatchers/ASTMatchers.h
index 409786e8e9..ce01f45333 100644
--- a/include/clang/ASTMatchers/ASTMatchers.h
+++ b/include/clang/ASTMatchers/ASTMatchers.h
@@ -5019,6 +5019,22 @@ AST_MATCHER_P(ElaboratedType, namesType, internal::Matcher<QualType>,
/// \c substTemplateTypeParmType() matches the type of 't' but not '1'
AST_TYPE_MATCHER(SubstTemplateTypeParmType, substTemplateTypeParmType);
+/// \brief Matches template type parameter substitutions that have a replacement
+/// type that matches the provided matcher.
+///
+/// Given
+/// \code
+/// template <typename T>
+/// double F(T t);
+/// int i;
+/// double j = F(i);
+/// \endcode
+///
+/// \c substTemplateTypeParmType(hasReplacementType(type())) matches int
+AST_TYPE_TRAVERSE_MATCHER(
+ hasReplacementType, getReplacementType,
+ AST_POLYMORPHIC_SUPPORTED_TYPES(SubstTemplateTypeParmType));
+
/// \brief Matches template type parameter types.
///
/// Example matches T, but not int.