@@ -1121,36 +1121,11 @@ class ForEachMatcher : public MatcherInterface<T> {
1121
1121
// / \brief VariadicOperatorMatcher related types.
1122
1122
// / @{
1123
1123
1124
- // / \brief Function signature for any variadic operator. It takes the inner
1125
- // / matchers as an array of DynTypedMatcher.
1126
- typedef bool (*VariadicOperatorFunction)(
1127
- const ast_type_traits::DynTypedNode DynNode, ASTMatchFinder *Finder,
1128
- BoundNodesTreeBuilder *Builder, ArrayRef<DynTypedMatcher> InnerMatchers);
1129
-
1130
- // / \brief \c MatcherInterface<T> implementation for an variadic operator.
1131
- template <typename T>
1132
- class VariadicOperatorMatcherInterface : public MatcherInterface <T> {
1133
- public:
1134
- VariadicOperatorMatcherInterface (VariadicOperatorFunction Func,
1135
- std::vector<DynTypedMatcher> InnerMatchers)
1136
- : Func(Func), InnerMatchers(std::move(InnerMatchers)) {}
1137
-
1138
- bool matches (const T &Node, ASTMatchFinder *Finder,
1139
- BoundNodesTreeBuilder *Builder) const override {
1140
- return Func (ast_type_traits::DynTypedNode::create (Node), Finder, Builder,
1141
- InnerMatchers);
1142
- }
1143
-
1144
- private:
1145
- const VariadicOperatorFunction Func;
1146
- const std::vector<DynTypedMatcher> InnerMatchers;
1147
- };
1148
-
1149
1124
// / \brief "No argument" placeholder to use as template paratemers.
1150
1125
struct VariadicOperatorNoArg {};
1151
1126
1152
- // / \brief Polymorphic matcher object that uses a \c VariadicOperatorFunction
1153
- // / operator.
1127
+ // / \brief Polymorphic matcher object that uses a \c
1128
+ // / DynTypedMatcher::VariadicOperatorFunction operator.
1154
1129
// /
1155
1130
// / Input matchers can have any type (including other polymorphic matcher
1156
1131
// / types), and the actual Matcher<T> is generated on demand with an implicit
@@ -1165,7 +1140,8 @@ template <typename P1, typename P2 = VariadicOperatorNoArg,
1165
1140
typename P9 = VariadicOperatorNoArg>
1166
1141
class VariadicOperatorMatcher {
1167
1142
public:
1168
- VariadicOperatorMatcher (VariadicOperatorFunction Func, const P1 &Param1,
1143
+ VariadicOperatorMatcher (DynTypedMatcher::VariadicOperatorFunction Func,
1144
+ const P1 &Param1,
1169
1145
const P2 &Param2 = VariadicOperatorNoArg(),
1170
1146
const P3 &Param3 = VariadicOperatorNoArg(),
1171
1147
const P4 &Param4 = VariadicOperatorNoArg(),
@@ -1189,9 +1165,8 @@ class VariadicOperatorMatcher {
1189
1165
addMatcher<T>(Param7, Matchers);
1190
1166
addMatcher<T>(Param8, Matchers);
1191
1167
addMatcher<T>(Param9, Matchers);
1192
- // FIXME: Use DynTypedMatcher::constructVariadic() instead.
1193
- return Matcher<T>(
1194
- new VariadicOperatorMatcherInterface<T>(Func, std::move (Matchers)));
1168
+ return DynTypedMatcher::constructVariadic (Func, std::move (Matchers))
1169
+ .template unconditionalConvertTo <T>();
1195
1170
}
1196
1171
1197
1172
private:
@@ -1206,7 +1181,7 @@ class VariadicOperatorMatcher {
1206
1181
static void addMatcher (VariadicOperatorNoArg,
1207
1182
std::vector<DynTypedMatcher> &Matchers) {}
1208
1183
1209
- const VariadicOperatorFunction Func;
1184
+ const DynTypedMatcher:: VariadicOperatorFunction Func;
1210
1185
const P1 Param1;
1211
1186
const P2 Param2;
1212
1187
const P3 Param3;
@@ -1224,7 +1199,7 @@ class VariadicOperatorMatcher {
1224
1199
// / It supports 1-9 argument overloaded operator(). More can be added if needed.
1225
1200
template <unsigned MinCount, unsigned MaxCount>
1226
1201
struct VariadicOperatorMatcherFunc {
1227
- VariadicOperatorFunction Func;
1202
+ DynTypedMatcher:: VariadicOperatorFunction Func;
1228
1203
1229
1204
template <unsigned Count, typename T>
1230
1205
struct EnableIfValidArity
@@ -1350,9 +1325,9 @@ BindableMatcher<T> makeAllOfComposite(
1350
1325
for (const auto *InnerMatcher : InnerMatchers) {
1351
1326
DynMatchers.push_back (*InnerMatcher);
1352
1327
}
1353
- // FIXME: Use DynTypedMatcher::constructVariadic() instead.
1354
- return BindableMatcher<T>( new VariadicOperatorMatcherInterface<T>(
1355
- AllOfVariadicOperator, std::move (DynMatchers) ));
1328
+ return BindableMatcher<T>( DynTypedMatcher::constructVariadic (
1329
+ AllOfVariadicOperator, std::move (DynMatchers))
1330
+ . template unconditionalConvertTo <T>( ));
1356
1331
}
1357
1332
1358
1333
// / \brief Creates a Matcher<T> that matches if
0 commit comments