Coverage Report

Created: 2018-11-16 02:38

/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
20.3k
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_booleanTypeMatcher::matcher_booleanTypeMatcher()
Line
Count
Source
100
114
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_isIntegerMatcher::matcher_isIntegerMatcher()
Line
Count
Source
100
2.64k
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_isMainMatcher::matcher_isMainMatcher()
Line
Count
Source
100
73
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_isConstQualifiedMatcher::matcher_isConstQualifiedMatcher()
Line
Count
Source
100
17.4k
    explicit matcher_##DefineMatcher##Matcher() = default;                     \
clang::ast_matchers::internal::matcher_hasStaticStorageDurationMatcher::matcher_hasStaticStorageDurationMatcher()
Line
Count
Source
100
9
    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
20.3k
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
20.3k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
20.3k
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
20.3k
  }                                                                            \
clang::ast_matchers::booleanType()
Line
Count
Source
107
114
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
114
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
114
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
114
  }                                                                            \
clang::ast_matchers::isInteger()
Line
Count
Source
107
2.64k
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
2.64k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
2.64k
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
2.64k
  }                                                                            \
clang::ast_matchers::isMain()
Line
Count
Source
107
73
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
73
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
73
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
73
  }                                                                            \
clang::ast_matchers::isConstQualified()
Line
Count
Source
107
17.4k
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
17.4k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
17.4k
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
17.4k
  }                                                                            \
clang::ast_matchers::hasStaticStorageDuration()
Line
Count
Source
107
9
  inline ::clang::ast_matchers::internal::Matcher<Type> DefineMatcher() {      \
108
9
    return ::clang::ast_matchers::internal::makeMatcher(                       \
109
9
        new internal::matcher_##DefineMatcher##Matcher());                     \
110
9
  }                                                                            \
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
163k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_isDerivedFrom0Matcher::matcher_isDerivedFrom0Matcher(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
140
494
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_isSameOrDerivedFrom0Matcher::matcher_isSameOrDerivedFrom0Matcher(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
140
197
        : 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
3.63k
        : 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
4.06k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_to0Matcher::matcher_to0Matcher(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
140
52.2k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasCanonicalType0Matcher::matcher_hasCanonicalType0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
140
965
        : 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
109
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasConditionVariableStatement0Matcher::matcher_hasConditionVariableStatement0Matcher(clang::ast_matchers::internal::Matcher<clang::DeclStmt> const&)
Line
Count
Source
140
107
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasTrueExpression0Matcher::matcher_hasTrueExpression0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
253
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasFalseExpression0Matcher::matcher_hasFalseExpression0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
255
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasSingleDecl0Matcher::matcher_hasSingleDecl0Matcher(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
140
281
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasInitializer0Matcher::matcher_hasInitializer0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
17.7k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasUnaryOperand0Matcher::matcher_hasUnaryOperand0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
17.0k
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasSelector0Matcher::matcher_hasSelector0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
140
284
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasReceiverType0Matcher::matcher_hasReceiverType0Matcher(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
140
140
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_asString0Matcher::matcher_asString0Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
140
289
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_hasReceiver0Matcher::matcher_hasReceiver0Matcher(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
140
142
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_equalsNode0Matcher::matcher_equalsNode0Matcher(clang::Decl const* const&)
Line
Count
Source
140
47.9k
        : 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_isSameOrDerivedFrom1Matcher::matcher_isSameOrDerivedFrom1Matcher(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
140
182
        : 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
102
        : 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
163k
      ParamType const &Param) {                                                \
152
163k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
163k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
163k
  }                                                                            \
clang::ast_matchers::isDerivedFrom(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
151
494
      ParamType const &Param) {                                                \
152
494
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
494
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
494
  }                                                                            \
clang::ast_matchers::isSameOrDerivedFrom(clang::ast_matchers::internal::Matcher<clang::NamedDecl> const&)
Line
Count
Source
151
197
      ParamType const &Param) {                                                \
152
197
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
197
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
197
  }                                                                            \
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
3.63k
      ParamType const &Param) {                                                \
152
3.63k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
3.63k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
3.63k
  }                                                                            \
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
4.06k
      ParamType const &Param) {                                                \
152
4.06k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
4.06k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
4.06k
  }                                                                            \
clang::ast_matchers::to(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
151
52.2k
      ParamType const &Param) {                                                \
152
52.2k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
52.2k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
52.2k
  }                                                                            \
clang::ast_matchers::hasCanonicalType(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
151
965
      ParamType const &Param) {                                                \
152
965
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
965
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
965
  }                                                                            \
clang::ast_matchers::isSameOrDerivedFrom(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
151
182
      ParamType const &Param) {                                                \
152
182
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
182
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
182
  }                                                                            \
clang::ast_matchers::matchesName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
151
109
      ParamType const &Param) {                                                \
152
109
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
109
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
109
  }                                                                            \
clang::ast_matchers::hasConditionVariableStatement(clang::ast_matchers::internal::Matcher<clang::DeclStmt> const&)
Line
Count
Source
151
107
      ParamType const &Param) {                                                \
152
107
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
107
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
107
  }                                                                            \
clang::ast_matchers::hasTrueExpression(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
253
      ParamType const &Param) {                                                \
152
253
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
253
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
253
  }                                                                            \
clang::ast_matchers::hasFalseExpression(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
255
      ParamType const &Param) {                                                \
152
255
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
255
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
255
  }                                                                            \
clang::ast_matchers::hasSingleDecl(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
151
281
      ParamType const &Param) {                                                \
152
281
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
281
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
281
  }                                                                            \
clang::ast_matchers::hasInitializer(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
17.7k
      ParamType const &Param) {                                                \
152
17.7k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
17.7k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
17.7k
  }                                                                            \
clang::ast_matchers::hasUnaryOperand(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
17.0k
      ParamType const &Param) {                                                \
152
17.0k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
17.0k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
17.0k
  }                                                                            \
clang::ast_matchers::hasSelector(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
151
284
      ParamType const &Param) {                                                \
152
284
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
284
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
284
  }                                                                            \
clang::ast_matchers::hasReceiverType(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
151
140
      ParamType const &Param) {                                                \
152
140
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
140
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
140
  }                                                                            \
clang::ast_matchers::asString(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
151
289
      ParamType const &Param) {                                                \
152
289
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
289
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
289
  }                                                                            \
clang::ast_matchers::hasReceiver(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
151
142
      ParamType const &Param) {                                                \
152
142
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
142
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
142
  }                                                                            \
clang::ast_matchers::equalsNode(clang::Decl const* const&)
Line
Count
Source
151
47.9k
      ParamType const &Param) {                                                \
152
47.9k
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
47.9k
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
47.9k
  }                                                                            \
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::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
102
      ParamType const &Param) {                                                \
152
102
    return ::clang::ast_matchers::internal::makeMatcher(                       \
153
102
        new internal::matcher_##DefineMatcher##OverloadId##Matcher(Param));    \
154
102
  }                                                                            \
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
405
  DefineMatcher() {                                                            \
246
405
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam0<      \
247
405
        internal::matcher_##DefineMatcher##Matcher, ReturnTypesF>();           \
248
405
  }                                                                            \
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
63.6k
        : 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
1.04k
        : 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
27
        : 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.16k
        : 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.67k
        : 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
842
        : 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
497
        : 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
312
        : 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.69k
        : 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
108
        : 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
110
        : 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
17.7k
        : 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
208
        : 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
19.1k
        : 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.6k
        : 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
99
        : 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
99
        : 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
99
        : Param(A##Param) {}                                                   \
clang::ast_matchers::internal::matcher_equalsBoundNode0Matcher<clang::ObjCMessageExpr, 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
280
        : 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
63.5k
  DefineMatcher(ParamType const &Param) {                                      \
292
63.5k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
63.5k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
63.5k
        ReturnTypesF>(Param);                                                  \
295
63.5k
  }                                                                            \
clang::ast_matchers::hasType(clang::ast_matchers::internal::Matcher<clang::QualType> const&)
Line
Count
Source
291
37.1k
  DefineMatcher(ParamType const &Param) {                                      \
292
37.1k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
37.1k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
37.1k
        ReturnTypesF>(Param);                                                  \
295
37.1k
  }                                                                            \
clang::ast_matchers::hasType(clang::ast_matchers::internal::Matcher<clang::Decl> const&)
Line
Count
Source
291
54
  DefineMatcher(ParamType const &Param) {                                      \
292
54
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
54
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
54
        ReturnTypesF>(Param);                                                  \
295
54
  }                                                                            \
clang::ast_matchers::hasLHS(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
1.67k
  DefineMatcher(ParamType const &Param) {                                      \
292
1.67k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
1.67k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
1.67k
        ReturnTypesF>(Param);                                                  \
295
1.67k
  }                                                                            \
clang::ast_matchers::hasRHS(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
1.16k
  DefineMatcher(ParamType const &Param) {                                      \
292
1.16k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
1.16k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
1.16k
        ReturnTypesF>(Param);                                                  \
295
1.16k
  }                                                                            \
clang::ast_matchers::hasAnyArgument(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
1.08k
  DefineMatcher(ParamType const &Param) {                                      \
292
1.08k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
1.08k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
1.08k
        ReturnTypesF>(Param);                                                  \
295
1.08k
  }                                                                            \
clang::ast_matchers::equalsBoundNode(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
291
2.26k
  DefineMatcher(ParamType const &Param) {                                      \
292
2.26k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
2.26k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
2.26k
        ReturnTypesF>(Param);                                                  \
295
2.26k
  }                                                                            \
clang::ast_matchers::hasOperatorName(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)
Line
Count
Source
291
19.4k
  DefineMatcher(ParamType const &Param) {                                      \
292
19.4k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
19.4k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
19.4k
        ReturnTypesF>(Param);                                                  \
295
19.4k
  }                                                                            \
clang::ast_matchers::hasCondition(clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
291
392
  DefineMatcher(ParamType const &Param) {                                      \
292
392
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
392
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
392
        ReturnTypesF>(Param);                                                  \
295
392
  }                                                                            \
clang::ast_matchers::hasAnyParameter(clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
291
107
  DefineMatcher(ParamType const &Param) {                                      \
292
107
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam1<      \
293
107
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType,     \
294
107
        ReturnTypesF>(Param);                                                  \
295
107
  }                                                                            \
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
17.5k
        : 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
614
        : 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.5k
        : 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
201
        : 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
220
        : 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
18.1k
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
18.1k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
18.1k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
18.1k
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
18.1k
  }                                                                            \
clang::ast_matchers::hasArgument(unsigned int const&, clang::ast_matchers::internal::Matcher<clang::Expr> const&)
Line
Count
Source
345
1.23k
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
1.23k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
1.23k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
1.23k
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
1.23k
  }                                                                            \
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.5k
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
16.5k
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
16.5k
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
16.5k
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
16.5k
  }                                                                            \
clang::ast_matchers::hasParameter(unsigned int const&, clang::ast_matchers::internal::Matcher<clang::ParmVarDecl> const&)
Line
Count
Source
345
431
  DefineMatcher(ParamType1 const &Param1, ParamType2 const &Param2) {          \
346
431
    return ::clang::ast_matchers::internal::PolymorphicMatcherWithParam2<      \
347
431
        internal::matcher_##DefineMatcher##OverloadId##Matcher, ParamType1,    \
348
431
        ParamType2, ReturnTypesF>(Param1, Param2);                             \
349
431
  }                                                                            \
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
559
    static QualType (T::*value())() const { return &T::FunctionName; }         \
clang::ast_matchers::internal::TypeMatcherpointeeGetter<clang::PointerType>::value()
Line
Count
Source
369
455
    static QualType (T::*value())() const { return &T::FunctionName; }         \
clang::ast_matchers::internal::TypeMatcherpointeeGetter<clang::ObjCObjectPointerType>::value()
Line
Count
Source
369
104
    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