1//===--- MatchersInternal.cpp----------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8
9#include "mlir/Query/Matcher/MatchersInternal.h"
10
11namespace mlir::query::matcher {
12
13namespace internal {
14
15bool allOfVariadicOperator(Operation *op, SetVector<Operation *> *matchedOps,
16 ArrayRef<DynMatcher> innerMatchers) {
17 return llvm::all_of(Range&: innerMatchers, P: [&](const DynMatcher &matcher) {
18 if (matchedOps)
19 return matcher.match(op, matchedOps&: *matchedOps);
20 return matcher.match(op);
21 });
22}
23bool anyOfVariadicOperator(Operation *op, SetVector<Operation *> *matchedOps,
24 ArrayRef<DynMatcher> innerMatchers) {
25 return llvm::any_of(Range&: innerMatchers, P: [&](const DynMatcher &matcher) {
26 if (matchedOps)
27 return matcher.match(op, matchedOps&: *matchedOps);
28 return matcher.match(op);
29 });
30}
31} // namespace internal
32} // namespace mlir::query::matcher
33