Coverage Report

Created: 2018-07-22 10:17

/Users/buildslave/jenkins/workspace/clang-stage2-coverage-R/llvm/tools/clang/include/clang/ASTMatchers/ASTMatchersMacros.h
Line
Count
Source
1
//===--- ASTMatchersMacros.h - Structural query framework -------*- C++ -*-===//
2
//
3
//                     The LLVM Compiler Infrastructure
4
//
5
// This file is distributed under the University of Illinois Open Source
6
// License. See LICENSE.TXT for details.
7
//
8
//===----------------------------------------------------------------------===//
9
//
10
//  Defines macros that enable us to define new matchers in a single place.
11
//  Since a matcher is a function which returns a Matcher<T> object, where
12
//  T is the type of the actual implementation of the matcher, the macros allow
13
//  us to write matchers like functions and take care of the definition of the
14
//  class boilerplate.
15
//
16
//  Note that when you define a matcher with an AST_MATCHER* macro, only the
17
//  function which creates the matcher goes into the current namespace - the
18
//  class that implements the actual matcher, which gets returned by the
19
//  generator function, is put into the 'internal' namespace. This allows us
20
//  to only have the functions (which is all the user cares about) in the
21
//  'ast_matchers' namespace and hide the boilerplate.
22
//
23
//  To define a matcher in user code, put it into your own namespace. This would
24
//  help to prevent ODR violations in case a matcher with the same name is
25
//  defined in multiple translation units:
26
//
27
//  namespace my_matchers {
28
//  AST_MATCHER_P(clang::MemberExpr, Member,
29
//                clang::ast_matchers::internal::Matcher<clang::ValueDecl>,
30
//                InnerMatcher) {
31
//    return InnerMatcher.matches(*Node.getMemberDecl(), Finder, Builder);
32
//  }
33
//  } // namespace my_matchers
34
//
35
//  Alternatively, an unnamed namespace may be used:
36
//
37
//  namespace clang {
38
//  namespace ast_matchers {
39
//  namespace {
40
//  AST_MATCHER_P(MemberExpr, Member,
41
//                internal::Matcher<ValueDecl>, InnerMatcher) {
42
//    return InnerMatcher.matches(*Node.getMemberDecl(), Finder, Builder);
43
//  }
44
//  } // namespace
45
//  } // namespace ast_matchers
46
//  } // namespace clang
47
//
48
//===----------------------------------------------------------------------===//
49
50
#ifndef LLVM_CLANG_ASTMATCHERS_ASTMATCHERSMACROS_H
51
#define LLVM_CLANG_ASTMATCHERS_ASTMATCHERSMACROS_H
52
53
/// AST_MATCHER_FUNCTION(ReturnType, DefineMatcher) { ... }
54
/// defines a zero parameter function named DefineMatcher() that returns a
55
/// ReturnType object.
56
#define AST_MATCHER_FUNCTION(ReturnType, DefineMatcher)                        \
57
  inline ReturnType DefineMatcher##_getInstance();                             \
58
  inline ReturnType DefineMatcher() {                                          \
59
    return ::clang::ast_matchers::internal::MemoizedMatcher<                   \
60
        ReturnType, DefineMatcher##_getInstance>::getInstance();               \
61
  }                                                                            \
62
  inline ReturnType DefineMatcher##_getInstance()
63
64
/// AST_MATCHER_FUNCTION_P(ReturnType, DefineMatcher, ParamType, Param) {
65
/// ... }
66
/// defines a single-parameter function named DefineMatcher() that returns a
67
/// ReturnType object.
68
///
69
/// The code between the curly braces has access to the following variables:
70
///
71
///   Param:                 the parameter passed to the function; its type
72
///                          is ParamType.
73
///
74
/// The code should return an instance of ReturnType.
75
#define AST_MATCHER_FUNCTION_P(ReturnType, DefineMatcher, ParamType, Param)    \
76
  AST_MATCHER_FUNCTION_P_OVERLOAD(ReturnType, DefineMatcher, ParamType, Param, \
77
                                  0)
78
#define AST_MATCHER_FUNCTION_P_OVERLOAD(ReturnType, DefineMatcher, ParamType,  \
79
                                        Param, OverloadId)                     \
80
  inline ReturnType DefineMatcher(ParamType const &Param);                     \
81
  typedef ReturnType (&DefineMatcher##_Type##OverloadId)(ParamType const &);   \
82
  inline ReturnType DefineMatcher(ParamType const &Param)
83
84
/// AST_MATCHER(Type, DefineMatcher) { ... }
85
/// defines a zero parameter function named DefineMatcher() that returns a
86
/// Matcher<Type> object.
87
///
88
/// The code between the curly braces has access to the following variables:
89
///
90
///   Node:                  the AST node being matched; its type is Type.
91
///   Finder:                an ASTMatchFinder*.
92
///   Builder:               a BoundNodesTreeBuilder*.
93
///
94
/// The code should return true if 'Node' matches.
95
#define AST_MATCHER(Type, DefineMatcher)                                       \
96
  namespace internal {                                                         \
97
  class matcher_##DefineMatcher##Matcher                                       \
98
      : public ::clang::ast_matchers::internal::MatcherInterface<Type> {       \
99
  public:                                                                      \
100
18.8k
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_booleanTypeMatcher::matcher_booleanTypeMatcher()
Line
Count
Source
100
111
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_isIntegerMatcher::matcher_isIntegerMatcher()
Line
Count
Source
100
2.59k
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_isConstQualifiedMatcher::matcher_isConstQualifiedMatcher()
Line
Count
Source
100
16.1k
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
101
    bool matches(const Type &Node,                                             \
102
                 ::clang::ast_matchers::internal::ASTMatchFinder *Finder,      \
103
                 ::clang::ast_matchers::internal::BoundNodesTreeBuilder        \
104
                     *Builder) const override;                                 \
105
  };                                                                           \
106
  }                                                                            \
107
18.8k
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
18.8k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
18.8k
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
18.8k
  }                                                                            \
clang::ast_matchers::booleanType()
Line
Count
Source
107
111
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
111
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
111
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
111
  }                                                                            \
clang::ast_matchers::isInteger()
Line
Count
Source
107
2.59k
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
2.59k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
2.59k
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
2.59k
  }                                                                            \
clang::ast_matchers::isConstQualified()
Line
Count
Source
107
16.1k
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
16.1k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
16.1k
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
16.1k
  }                                                                            \
111
  inline bool internal::matcher_##DefineMatcher##Matcher::matches(             \
112
      const Type &Node,                                                        \
113
      ::clang::ast_matchers::internal::ASTMatchFinder *Finder,                 \
114
      ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder) const
115
116
/// AST_MATCHER_P(Type, DefineMatcher, ParamType, Param) { ... }
117
/// defines a single-parameter function named DefineMatcher() that returns a
118
/// Matcher<Type> object.
119
///
120
/// The code between the curly braces has access to the following variables:
121
///
122
///   Node:                  the AST node being matched; its type is Type.
123
///   Param:                 the parameter passed to the function; its type
124
///                          is ParamType.
125
///   Finder:                an ASTMatchFinder*.
126
///   Builder:               a BoundNodesTreeBuilder*.
127
///
128
/// The code should return true if 'Node' matches.
129
#define AST_MATCHER_P(Type, DefineMatcher, ParamType, Param)                   \
130
  AST_MATCHER_P_OVERLOAD(Type, DefineMatcher, ParamType, Param, 0)
131
132
#define AST_MATCHER_P_OVERLOAD(Type, DefineMatcher, ParamType, Param,          \
133
                               OverloadId)                                     \
134
  namespace internal {                                                         \
135
  class matcher_##DefineMatcher##OverloadId##Matcher                           \
136
      : public ::clang::ast_matchers::internal::MatcherInterface<Type> {       \
137
  public:                                                                      \
138
    explicit matcher_##DefineMatcher##OverloadId##Matcher(                     \
139
        ParamType const &A##Param)                                             \
140
158k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_isDerivedFrom0Matcher::matcher_isDerivedFrom0Matcher(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
140
313
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_isSameOrDerivedFrom0Matcher::matcher_isSameOrDerivedFrom0Matcher(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
140
16
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_pointsTo0Matcher::matcher_pointsTo0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
140
92
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_references0Matcher::matcher_references0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
140
16.1k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_onImplicitObjectArgument0Matcher::matcher_onImplicitObjectArgument0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
14
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_pointsTo1Matcher::matcher_pointsTo1Matcher(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
140
26
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_callee1Matcher::matcher_callee1Matcher(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
140
1.75k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_ignoringParenCasts0Matcher::matcher_ignoringParenCasts0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
459
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_ignoringParenImpCasts0Matcher::matcher_ignoringParenImpCasts0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
3.98k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_to0Matcher::matcher_to0Matcher(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
140
51.9k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasCanonicalType0Matcher::matcher_hasCanonicalType0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
140
941
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_matchesName0Matcher::matcher_matchesName0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
140
106
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasConditionVariableStatement0Matcher::matcher_hasConditionVariableStatement0Matcher(clang::ast_matchers::internal::Matcher<clang::DeclStmt> const&)
Line
Count
Source
140
104
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasTrueExpression0Matcher::matcher_hasTrueExpression0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
111
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasFalseExpression0Matcher::matcher_hasFalseExpression0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
113
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasSingleDecl0Matcher::matcher_hasSingleDecl0Matcher(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
140
278
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasInitializer0Matcher::matcher_hasInitializer0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
17.5k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasUnaryOperand0Matcher::matcher_hasUnaryOperand0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
16.5k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasLoopInit0Matcher::matcher_hasLoopInit0Matcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&)
Line
Count
Source
140
166
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasIncrement0Matcher::matcher_hasIncrement0Matcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&)
Line
Count
Source
140
164
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_equalsNode0Matcher::matcher_equalsNode0Matcher(clang::Decl const* const&)
Line
Count
Source
140
47.8k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasAnySelectorMatcher0Matcher::matcher_hasAnySelectorMatcher0Matcher(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)
Line
Count
Source
140
99
        : Param(A##Param) {}                                                   \
141
    bool matches(const Type &Node,                                             \
142
                 ::clang::ast_matchers::internal::ASTMatchFinder *Finder,      \
143
                 ::clang::ast_matchers::internal::BoundNodesTreeBuilder        \
144
                     *Builder) const override;                                 \
145
                                                                               \
146
  private:                                                                     \
147
    ParamType const Param;                                                     \
148
  };                                                                           \
149
  }                                                                            \
150
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher(         \
151
158k
      ParamType const &Param) {                                                \
152
158k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
158k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
158k
  }                                                                            \
clang::ast_matchers::isDerivedFrom(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
151
313
      ParamType const &Param) {                                                \
152
313
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
313
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
313
  }                                                                            \
clang::ast_matchers::isSameOrDerivedFrom(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
151
16
      ParamType const &Param) {                                                \
152
16
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
16
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
16
  }                                                                            \
clang::ast_matchers::pointsTo(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
151
92
      ParamType const &Param) {                                                \
152
92
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
92
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
92
  }                                                                            \
clang::ast_matchers::references(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
151
16.1k
      ParamType const &Param) {                                                \
152
16.1k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
16.1k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
16.1k
  }                                                                            \
clang::ast_matchers::onImplicitObjectArgument(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
14
      ParamType const &Param) {                                                \
152
14
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
14
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
14
  }                                                                            \
clang::ast_matchers::pointsTo(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
151
26
      ParamType const &Param) {                                                \
152
26
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
26
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
26
  }                                                                            \
clang::ast_matchers::callee(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
151
1.75k
      ParamType const &Param) {                                                \
152
1.75k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
1.75k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
1.75k
  }                                                                            \
clang::ast_matchers::ignoringParenCasts(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
459
      ParamType const &Param) {                                                \
152
459
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
459
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
459
  }                                                                            \
clang::ast_matchers::ignoringParenImpCasts(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
3.98k
      ParamType const &Param) {                                                \
152
3.98k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
3.98k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
3.98k
  }                                                                            \
clang::ast_matchers::to(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
151
51.9k
      ParamType const &Param) {                                                \
152
51.9k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
51.9k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
51.9k
  }                                                                            \
clang::ast_matchers::hasCanonicalType(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
151
941
      ParamType const &Param) {                                                \
152
941
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
941
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
941
  }                                                                            \
clang::ast_matchers::matchesName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
151
106
      ParamType const &Param) {                                                \
152
106
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
106
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
106
  }                                                                            \
clang::ast_matchers::hasConditionVariableStatement(clang::ast_matchers::internal::Matcher<clang::DeclStmt> const&)
Line
Count
Source
151
104
      ParamType const &Param) {                                                \
152
104
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
104
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
104
  }                                                                            \
clang::ast_matchers::hasTrueExpression(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
111
      ParamType const &Param) {                                                \
152
111
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
111
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
111
  }                                                                            \
clang::ast_matchers::hasFalseExpression(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
113
      ParamType const &Param) {                                                \
152
113
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
113
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
113
  }                                                                            \
clang::ast_matchers::hasSingleDecl(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
151
278
      ParamType const &Param) {                                                \
152
278
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
278
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
278
  }                                                                            \
clang::ast_matchers::hasInitializer(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
17.5k
      ParamType const &Param) {                                                \
152
17.5k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
17.5k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
17.5k
  }                                                                            \
clang::ast_matchers::hasUnaryOperand(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
16.5k
      ParamType const &Param) {                                                \
152
16.5k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
16.5k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
16.5k
  }                                                                            \
clang::ast_matchers::hasLoopInit(clang::ast_matchers::internal::Matcher<clang::Stmt> const&)
Line
Count
Source
151
166
      ParamType const &Param) {                                                \
152
166
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
166
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
166
  }                                                                            \
clang::ast_matchers::hasIncrement(clang::ast_matchers::internal::Matcher<clang::Stmt> const&)
Line
Count
Source
151
164
      ParamType const &Param) {                                                \
152
164
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
164
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
164
  }                                                                            \
clang::ast_matchers::equalsNode(clang::Decl const* const&)
Line
Count
Source
151
47.8k
      ParamType const &Param) {                                                \
152
47.8k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
47.8k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
47.8k
  }                                                                            \
clang::ast_matchers::hasAnySelectorMatcher(std::__1::vector<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >, std::__1::allocator<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > > > const&)
Line
Count
Source
151
99
      ParamType const &Param) {                                                \
152
99
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
99
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
99
  }                                                                            \
155
  typedef ::clang::ast_matchers::internal::Matcher<Type>(                      \
156
      &DefineMatcher##_Type##OverloadId)(ParamType const &Param);              \
157
  inline bool internal::matcher_##DefineMatcher##OverloadId##Matcher::matches( \
158
      const Type &Node,                                                        \
159
      ::clang::ast_matchers::internal::ASTMatchFinder *Finder,                 \
160
      ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder) const
161
162
/// AST_MATCHER_P2(
163
///     Type, DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ... }
164
/// defines a two-parameter function named DefineMatcher() that returns a
165
/// Matcher<Type> object.
166
///
167
/// The code between the curly braces has access to the following variables:
168
///
169
///   Node:                  the AST node being matched; its type is Type.
170
///   Param1, Param2:        the parameters passed to the function; their types
171
///                          are ParamType1 and ParamType2.
172
///   Finder:                an ASTMatchFinder*.
173
///   Builder:               a BoundNodesTreeBuilder*.
174
///
175
/// The code should return true if 'Node' matches.
176
#define AST_MATCHER_P2(Type, DefineMatcher, ParamType1, Param1, ParamType2,    \
177
                       Param2)                                                 \
178
  AST_MATCHER_P2_OVERLOAD(Type, DefineMatcher, ParamType1, Param1, ParamType2, \
179
                          Param2, 0)
180
181
#define AST_MATCHER_P2_OVERLOAD(Type, DefineMatcher, ParamType1, Param1,       \
182
                                ParamType2, Param2, OverloadId)                \
183
  namespace internal {                                                         \
184
  class matcher_##DefineMatcher##OverloadId##Matcher                           \
185
      : public ::clang::ast_matchers::internal::MatcherInterface<Type> {       \
186
  public:                                                                      \
187
    matcher_##DefineMatcher##OverloadId##Matcher(ParamType1 const &A##Param1,  \
188
                                                 ParamType2 const &A##Param2)  \
189
        : Param1(A##Param1), Param2(A##Param2) {}                              \
190
    bool matches(const Type &Node,                                             \
191
                 ::clang::ast_matchers::internal::ASTMatchFinder *Finder,      \
192
                 ::clang::ast_matchers::internal::BoundNodesTreeBuilder        \
193
                     *Builder) const override;                                 \
194
                                                                               \
195
  private:                                                                     \
196
    ParamType1 const Param1;                                                   \
197
    ParamType2 const Param2;                                                   \
198
  };                                                                           \
199
  }                                                                            \
200
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher(         \
201
      ParamType1 const &Param1, ParamType2 const &Param2) {                    \
202
    return ::clang::ast_matchers::internal::makeMatcher(                       \
203
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param1,     \
204
                                                                   Param2));   \
205
  }                                                                            \
206
  typedef ::clang::ast_matchers::internal::Matcher<Type>(                      \
207
      &DefineMatcher##_Type##OverloadId)(ParamType1 const &Param1,             \
208
                                         ParamType2 const &Param2);            \
209
  inline bool internal::matcher_##DefineMatcher##OverloadId##Matcher::matches( \
210
      const Type &Node,                                                        \
211
      ::clang::ast_matchers::internal::ASTMatchFinder *Finder,                 \
212
      ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder) const
213
214
/// Construct a type-list to be passed to the AST_POLYMORPHIC_MATCHER*
215
///   macros.
216
///
217
/// You can't pass something like \c TypeList<Foo, Bar> to a macro, because it
218
/// will look at that as two arguments. However, you can pass
219
/// \c void(TypeList<Foo, Bar>), which works thanks to the parenthesis.
220
/// The \c PolymorphicMatcherWithParam* classes will unpack the function type to
221
/// extract the TypeList object.
222
#define AST_POLYMORPHIC_SUPPORTED_TYPES(...)                                   \
223
  void(::clang::ast_matchers::internal::TypeList<__VA_ARGS__>)
224
225
/// AST_POLYMORPHIC_MATCHER(DefineMatcher) { ... }
226
/// defines a single-parameter function named DefineMatcher() that is
227
/// polymorphic in the return type.
228
///
229
/// The variables are the same as for AST_MATCHER, but NodeType will be deduced
230
/// from the calling context.
231
#define AST_POLYMORPHIC_MATCHER(DefineMatcher, ReturnTypesF)                   \
232
  namespace internal {                                                         \
233
  template <typename NodeType>                                                 \
234
  class matcher_##DefineMatcher##Matcher                                       \
235
      : public ::clang::ast_matchers::internal::MatcherInterface<NodeType> {   \
236
  public:                                                                      \
237
    bool matches(const NodeType &Node,                                         \
238
                 ::clang::ast_matchers::internal::ASTMatchFinder *Finder,      \
239
                 ::clang::ast_matchers::internal::BoundNodesTreeBuilder        \
240
                     *Builder) const override;                                 \
241
  };                                                                           \
242
  }                                                                            \
243
  inline ::clang::ast_matchers::internal::PolymorphicMatcherWithParam0<        \
244
      internal::matcher_##DefineMatcher##Matcher, ReturnTypesF>                \
245
166
  DefineMatcher() {                                                            \
246
166
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam0<      \
247
166
        internal::matcher_##DefineMatcher##Matcher, ReturnTypesF>();           \
248
166
  }                                                                            \
249
  template <typename NodeType>                                                 \
250
  bool internal::matcher_##DefineMatcher##Matcher<NodeType>::matches(          \
251
      const NodeType &Node,                                                    \
252
      ::clang::ast_matchers::internal::ASTMatchFinder *Finder,                 \
253
      ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder) const
254
255
/// AST_POLYMORPHIC_MATCHER_P(DefineMatcher, ParamType, Param) { ... }
256
/// defines a single-parameter function named DefineMatcher() that is
257
/// polymorphic in the return type.
258
///
259
/// The variables are the same as for
260
/// AST_MATCHER_P, with the addition of NodeType, which specifies the node type
261
/// of the matcher Matcher<NodeType> returned by the function matcher().
262
///
263
/// FIXME: Pull out common code with above macro?
264
#define AST_POLYMORPHIC_MATCHER_P(DefineMatcher, ReturnTypesF, ParamType,      \
265
                                  Param)                                       \
266
  AST_POLYMORPHIC_MATCHER_P_OVERLOAD(DefineMatcher, ReturnTypesF, ParamType,   \
267
                                     Param, 0)
268
269
#define AST_POLYMORPHIC_MATCHER_P_OVERLOAD(DefineMatcher, ReturnTypesF,        \
270
                                           ParamType, Param, OverloadId)       \
271
  namespace internal {                                                         \
272
  template <typename NodeType, typename ParamT>                                \
273
  class matcher_##DefineMatcher##OverloadId##Matcher                           \
274
      : public ::clang::ast_matchers::internal::MatcherInterface<NodeType> {   \
275
  public:                                                                      \
276
    explicit matcher_##DefineMatcher##OverloadId##Matcher(                     \
277
        ParamType const &A##Param)                                             \
278
61.0k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasType0Matcher<clang::Expr, clang::ast_matchers::internal::Matcher<clang::QualType> >::matcher_hasType0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
278
787
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasType1Matcher<clang::Expr, clang::ast_matchers::internal::Matcher<clang::Decl> >::matcher_hasType1Matcher(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
278
25
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasRHS0Matcher<clang::BinaryOperator, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasRHS0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
278
1.15k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasLHS0Matcher<clang::BinaryOperator, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasLHS0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
278
1.41k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_equalsBoundNode0Matcher<clang::VarDecl, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::matcher_equalsBoundNode0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
278
869
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasAnyArgument0Matcher<clang::CallExpr, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasAnyArgument0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
278
594
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasAnyArgument0Matcher<clang::ObjCMessageExpr, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasAnyArgument0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
278
491
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_equalsBoundNode0Matcher<clang::Expr, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::matcher_equalsBoundNode0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
278
303
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasOperatorName0Matcher<clang::BinaryOperator, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::matcher_hasOperatorName0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
278
1.66k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasCondition0Matcher<clang::IfStmt, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasCondition0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
278
105
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasCondition0Matcher<clang::ConditionalOperator, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasCondition0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
278
107
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasOperatorName0Matcher<clang::UnaryOperator, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::matcher_hasOperatorName0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
278
16.9k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasType0Matcher<clang::ExplicitCastExpr, clang::ast_matchers::internal::Matcher<clang::QualType> >::matcher_hasType0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
278
202
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasType0Matcher<clang::VarDecl, clang::ast_matchers::internal::Matcher<clang::QualType> >::matcher_hasType0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
278
18.8k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasType0Matcher<clang::ParmVarDecl, clang::ast_matchers::internal::Matcher<clang::QualType> >::matcher_hasType0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
278
16.2k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasAnyParameter0Matcher<clang::ObjCMethodDecl, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> >::matcher_hasAnyParameter0Matcher(clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
278
96
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasAnyParameter0Matcher<clang::FunctionDecl, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> >::matcher_hasAnyParameter0Matcher(clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
278
96
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasAnyParameter0Matcher<clang::BlockDecl, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> >::matcher_hasAnyParameter0Matcher(clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
278
96
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasBody0Matcher<clang::ForStmt, clang::ast_matchers::internal::Matcher<clang::Stmt> >::matcher_hasBody0Matcher(clang::ast_matchers::internal::Matcher<clang::Stmt> const&)
Line
Count
Source
278
167
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasCondition0Matcher<clang::ForStmt, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasCondition0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
278
167
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_equalsBoundNode0Matcher<clang::Decl, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > >::matcher_equalsBoundNode0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
278
660
        : Param(A##Param) {}                                                   \
279
    bool matches(const NodeType &Node,                                         \
280
                 ::clang::ast_matchers::internal::ASTMatchFinder *Finder,      \
281
                 ::clang::ast_matchers::internal::BoundNodesTreeBuilder        \
282
                     *Builder) const override;                                 \
283
                                                                               \
284
  private:                                                                     \
285
    ParamType const Param;                                                     \
286
  };                                                                           \
287
  }                                                                            \
288
  inline ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<        \
289
      internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,       \
290
      ReturnTypesF>                                                            \
291
60.5k
  DefineMatcher(ParamType const &Param) {                                      \
292
60.5k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
60.5k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
60.5k
        ReturnTypesF>(Param);                                                  \
295
60.5k
  }                                                                            \
clang::ast_matchers::hasType(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
291
36.1k
  DefineMatcher(ParamType const &Param) {                                      \
292
36.1k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
36.1k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
36.1k
        ReturnTypesF>(Param);                                                  \
295
36.1k
  }                                                                            \
clang::ast_matchers::hasType(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
291
52
  DefineMatcher(ParamType const &Param) {                                      \
292
52
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
52
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
52
        ReturnTypesF>(Param);                                                  \
295
52
  }                                                                            \
clang::ast_matchers::hasLHS(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
1.41k
  DefineMatcher(ParamType const &Param) {                                      \
292
1.41k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
1.41k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
1.41k
        ReturnTypesF>(Param);                                                  \
295
1.41k
  }                                                                            \
clang::ast_matchers::hasRHS(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
1.15k
  DefineMatcher(ParamType const &Param) {                                      \
292
1.15k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
1.15k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
1.15k
        ReturnTypesF>(Param);                                                  \
295
1.15k
  }                                                                            \
clang::ast_matchers::hasAnyArgument(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
594
  DefineMatcher(ParamType const &Param) {                                      \
292
594
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
594
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
594
        ReturnTypesF>(Param);                                                  \
295
594
  }                                                                            \
clang::ast_matchers::equalsBoundNode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
291
1.84k
  DefineMatcher(ParamType const &Param) {                                      \
292
1.84k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
1.84k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
1.84k
        ReturnTypesF>(Param);                                                  \
295
1.84k
  }                                                                            \
clang::ast_matchers::hasOperatorName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
291
18.6k
  DefineMatcher(ParamType const &Param) {                                      \
292
18.6k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
18.6k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
18.6k
        ReturnTypesF>(Param);                                                  \
295
18.6k
  }                                                                            \
clang::ast_matchers::hasCondition(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
386
  DefineMatcher(ParamType const &Param) {                                      \
292
386
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
386
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
386
        ReturnTypesF>(Param);                                                  \
295
386
  }                                                                            \
clang::ast_matchers::hasAnyParameter(clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
291
104
  DefineMatcher(ParamType const &Param) {                                      \
292
104
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
104
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
104
        ReturnTypesF>(Param);                                                  \
295
104
  }                                                                            \
clang::ast_matchers::hasBody(clang::ast_matchers::internal::Matcher<clang::Stmt> const&)
Line
Count
Source
291
181
  DefineMatcher(ParamType const &Param) {                                      \
292
181
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
181
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
181
        ReturnTypesF>(Param);                                                  \
295
181
  }                                                                            \
296
  typedef ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<       \
297
      internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,       \
298
      ReturnTypesF>(&DefineMatcher##_Type##OverloadId)(                        \
299
      ParamType const &Param);                                                 \
300
  template <typename NodeType, typename ParamT>                                \
301
  bool internal::                                                              \
302
      matcher_##DefineMatcher##OverloadId##Matcher<NodeType, ParamT>::matches( \
303
          const NodeType &Node,                                                \
304
          ::clang::ast_matchers::internal::ASTMatchFinder *Finder,             \
305
          ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder)     \
306
          const
307
308
/// AST_POLYMORPHIC_MATCHER_P2(
309
///     DefineMatcher, ParamType1, Param1, ParamType2, Param2) { ... }
310
/// defines a two-parameter function named matcher() that is polymorphic in
311
/// the return type.
312
///
313
/// The variables are the same as for AST_MATCHER_P2, with the
314
/// addition of NodeType, which specifies the node type of the matcher
315
/// Matcher<NodeType> returned by the function DefineMatcher().
316
#define AST_POLYMORPHIC_MATCHER_P2(DefineMatcher, ReturnTypesF, ParamType1,    \
317
                                   Param1, ParamType2, Param2)                 \
318
  AST_POLYMORPHIC_MATCHER_P2_OVERLOAD(DefineMatcher, ReturnTypesF, ParamType1, \
319
                                      Param1, ParamType2, Param2, 0)
320
321
#define AST_POLYMORPHIC_MATCHER_P2_OVERLOAD(DefineMatcher, ReturnTypesF,       \
322
                                            ParamType1, Param1, ParamType2,    \
323
                                            Param2, OverloadId)                \
324
  namespace internal {                                                         \
325
  template <typename NodeType, typename ParamT1, typename ParamT2>             \
326
  class matcher_##DefineMatcher##OverloadId##Matcher                           \
327
      : public ::clang::ast_matchers::internal::MatcherInterface<NodeType> {   \
328
  public:                                                                      \
329
    matcher_##DefineMatcher##OverloadId##Matcher(ParamType1 const &A##Param1,  \
330
                                                 ParamType2 const &A##Param2)  \
331
16.6k
        : Param1(A##Param1), Param2(A##Param2) {}                              \
clang::ast_matchers::internal::matcher_hasArgument0Matcher<clang::CallExpr, unsigned int, clang::ast_matchers::internal::Matcher<clang::Expr> >::matcher_hasArgument0Matcher(unsigned int const&, clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
331
464
        : Param1(A##Param1), Param2(A##Param2) {}                              \
clang::ast_matchers::internal::matcher_forEachArgumentWithParam0Matcher<clang::CallExpr, clang::ast_matchers::internal::Matcher<clang::Expr>, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> >::matcher_forEachArgumentWithParam0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
331
16.1k
        : Param1(A##Param1), Param2(A##Param2) {}                              \
clang::ast_matchers::internal::matcher_hasParameter0Matcher<clang::CXXConstructorDecl, unsigned int, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> >::matcher_hasParameter0Matcher(unsigned int const&, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
331
32
        : Param1(A##Param1), Param2(A##Param2) {}                              \
clang::ast_matchers::internal::matcher_hasParameter0Matcher<clang::FunctionDecl, unsigned int, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> >::matcher_hasParameter0Matcher(unsigned int const&, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
331
54
        : Param1(A##Param1), Param2(A##Param2) {}                              \
332
    bool matches(const NodeType &Node,                                         \
333
                 ::clang::ast_matchers::internal::ASTMatchFinder *Finder,      \
334
                 ::clang::ast_matchers::internal::BoundNodesTreeBuilder        \
335
                     *Builder) const override;                                 \
336
                                                                               \
337
  private:                                                                     \
338
    ParamType1 const Param1;                                                   \
339
    ParamType2 const Param2;                                                   \
340
  };                                                                           \
341
  }                                                                            \
342
  inline ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<        \
343
      internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,      \
344
      ParamType2, ReturnTypesF>                                                \
345
16.6k
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
16.6k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
16.6k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
16.6k
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
16.6k
  }                                                                            \
clang::ast_matchers::hasArgument(unsigned int const&, clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
345
466
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
466
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
466
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
466
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
466
  }                                                                            \
clang::ast_matchers::forEachArgumentWithParam(clang::ast_matchers::internal::Matcher<clang::Expr> const&, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
345
16.1k
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
16.1k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
16.1k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
16.1k
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
16.1k
  }                                                                            \
clang::ast_matchers::hasParameter(unsigned int const&, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
345
96
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
96
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
96
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
96
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
96
  }                                                                            \
350
  typedef ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<       \
351
      internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,      \
352
      ParamType2, ReturnTypesF>(&DefineMatcher##_Type##OverloadId)(            \
353
      ParamType1 const &Param1, ParamType2 const &Param2);                     \
354
  template <typename NodeType, typename ParamT1, typename ParamT2>             \
355
  bool internal::matcher_##DefineMatcher##OverloadId##Matcher<                 \
356
      NodeType, ParamT1, ParamT2>::                                            \
357
      matches(const NodeType &Node,                                            \
358
              ::clang::ast_matchers::internal::ASTMatchFinder *Finder,         \
359
              ::clang::ast_matchers::internal::BoundNodesTreeBuilder *Builder) \
360
          const
361
362
// FIXME: add a matcher for TypeLoc derived classes using its custom casting
363
// API (no longer dyn_cast) if/when we need such matching
364
365
#define AST_TYPE_TRAVERSE_MATCHER_DECL(MatcherName, FunctionName,              \
366
                                       ReturnTypesF)                           \
367
  namespace internal {                                                         \
368
  template <typename T> struct TypeMatcher##MatcherName##Getter {              \
369
311
    static QualType (T::*value())() const { return &T::FunctionName; }         \
clang::ast_matchers::internal::TypeMatcherpointeeGetter<clang::PointerType>::value()
Line
Count
Source
369
210
    static QualType (T::*value())() const { return &T::FunctionName; }         \
clang::ast_matchers::internal::TypeMatcherpointeeGetter<clang::ObjCObjectPointerType>::value()
Line
Count
Source
369
101
    static QualType (T::*value())() const { return &T::FunctionName; }         \
370
  };                                                                           \
371
  }                                                                            \
372
  extern const ::clang::ast_matchers::internal::                               \
373
      TypeTraversePolymorphicMatcher<                                          \
374
          QualType,                                                            \
375
          ::clang::ast_matchers::internal::TypeMatcher##MatcherName##Getter,   \
376
          ::clang::ast_matchers::internal::TypeTraverseMatcher,                \
377
          ReturnTypesF>::Func MatcherName
378
379
#define AST_TYPE_TRAVERSE_MATCHER_DEF(MatcherName, ReturnTypesF)               \
380
  const ::clang::ast_matchers::internal::TypeTraversePolymorphicMatcher<       \
381
      QualType,                                                                \
382
      ::clang::ast_matchers::internal::TypeMatcher##MatcherName##Getter,       \
383
      ::clang::ast_matchers::internal::TypeTraverseMatcher,                    \
384
      ReturnTypesF>::Func MatcherName
385
386
/// AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName) defines
387
/// the matcher \c MatcherName that can be used to traverse from one \c Type
388
/// to another.
389
///
390
/// For a specific \c SpecificType, the traversal is done using
391
/// \c SpecificType::FunctionName. The existence of such a function determines
392
/// whether a corresponding matcher can be used on \c SpecificType.
393
#define AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName, ReturnTypesF)     \
394
  namespace internal {                                                         \
395
  template <typename T> struct TypeMatcher##MatcherName##Getter {              \
396
    static QualType (T::*value())() const { return &T::FunctionName; }         \
397
  };                                                                           \
398
  }                                                                            \
399
  const ::clang::ast_matchers::internal::TypeTraversePolymorphicMatcher<       \
400
      QualType,                                                                \
401
      ::clang::ast_matchers::internal::TypeMatcher##MatcherName##Getter,       \
402
      ::clang::ast_matchers::internal::TypeTraverseMatcher,                    \
403
      ReturnTypesF>::Func MatcherName
404
405
#define AST_TYPELOC_TRAVERSE_MATCHER_DECL(MatcherName, FunctionName,           \
406
                                          ReturnTypesF)                        \
407
  namespace internal {                                                         \
408
  template <typename T> struct TypeLocMatcher##MatcherName##Getter {           \
409
    static TypeLoc (T::*value())() const { return &T::FunctionName##Loc; }     \
410
  };                                                                           \
411
  }                                                                            \
412
  extern const ::clang::ast_matchers::internal::                               \
413
      TypeTraversePolymorphicMatcher<                                          \
414
          TypeLoc,                                                             \
415
          ::clang::ast_matchers::internal::                                    \
416
              TypeLocMatcher##MatcherName##Getter,                             \
417
          ::clang::ast_matchers::internal::TypeLocTraverseMatcher,             \
418
          ReturnTypesF>::Func MatcherName##Loc;                                \
419
  AST_TYPE_TRAVERSE_MATCHER_DECL(MatcherName, FunctionName##Type, ReturnTypesF)
420
421
#define AST_TYPELOC_TRAVERSE_MATCHER_DEF(MatcherName, ReturnTypesF)            \
422
  const ::clang::ast_matchers::internal::TypeTraversePolymorphicMatcher<       \
423
      TypeLoc,                                                                 \
424
      ::clang::ast_matchers::internal::TypeLocMatcher##MatcherName##Getter,    \
425
      ::clang::ast_matchers::internal::TypeLocTraverseMatcher,                 \
426
      ReturnTypesF>::Func MatcherName##Loc;                                    \
427
  AST_TYPE_TRAVERSE_MATCHER_DEF(MatcherName, ReturnTypesF)
428
429
/// AST_TYPELOC_TRAVERSE_MATCHER(MatcherName, FunctionName) works
430
/// identical to \c AST_TYPE_TRAVERSE_MATCHER but operates on \c TypeLocs.
431
#define AST_TYPELOC_TRAVERSE_MATCHER(MatcherName, FunctionName, ReturnTypesF)  \
432
  namespace internal {                                                         \
433
  template <typename T> struct TypeLocMatcher##MatcherName##Getter {           \
434
    static TypeLoc (T::*value())() const { return &T::FunctionName##Loc; }     \
435
  };                                                                           \
436
  }                                                                            \
437
  const ::clang::ast_matchers::internal::TypeTraversePolymorphicMatcher<       \
438
      TypeLoc,                                                                 \
439
      ::clang::ast_matchers::internal::TypeLocMatcher##MatcherName##Getter,    \
440
      ::clang::ast_matchers::internal::TypeLocTraverseMatcher,                 \
441
      ReturnTypesF>::Func MatcherName##Loc;                                    \
442
  AST_TYPE_TRAVERSE_MATCHER(MatcherName, FunctionName##Type, ReturnTypesF)
443
444
#endif // LLVM_CLANG_ASTMATCHERS_ASTMATCHERSMACROS_H