[ASTMatchers] Replace hand-coded copy of std::apply with the real C++17 function...
authorBenjamin Kramer <benny.kra@googlemail.com>
Mon, 8 Aug 2022 12:08:04 +0000 (14:08 +0200)
committerBenjamin Kramer <benny.kra@googlemail.com>
Mon, 8 Aug 2022 12:08:04 +0000 (14:08 +0200)
clang/include/clang/ASTMatchers/ASTMatchersInternal.h

index 49de9a458c3db597ac37fe08cfed9e11aeee868a..5785a72559987d8dda29a65fe6fd56b8795f073d 100644 (file)
@@ -1396,20 +1396,6 @@ struct VariadicOperatorMatcherFunc {
   }
 };
 
-template <typename F, typename Tuple, std::size_t... I>
-constexpr auto applyMatcherImpl(F &&f, Tuple &&args,
-                                std::index_sequence<I...>) {
-  return std::forward<F>(f)(std::get<I>(std::forward<Tuple>(args))...);
-}
-
-template <typename F, typename Tuple>
-constexpr auto applyMatcher(F &&f, Tuple &&args) {
-  return applyMatcherImpl(
-      std::forward<F>(f), std::forward<Tuple>(args),
-      std::make_index_sequence<
-          std::tuple_size<typename std::decay<Tuple>::type>::value>());
-}
-
 template <typename T, bool IsBaseOf, typename Head, typename Tail>
 struct GetCladeImpl {
   using Type = Head;
@@ -1428,12 +1414,11 @@ struct MapAnyOfMatcherImpl {
   template <typename... InnerMatchers>
   BindableMatcher<CladeType>
   operator()(InnerMatchers &&... InnerMatcher) const {
-    // TODO: Use std::apply from c++17
-    return VariadicAllOfMatcher<CladeType>()(applyMatcher(
+    return VariadicAllOfMatcher<CladeType>()(std::apply(
         internal::VariadicOperatorMatcherFunc<
             0, std::numeric_limits<unsigned>::max()>{
             internal::DynTypedMatcher::VO_AnyOf},
-        applyMatcher(
+        std::apply(
             [&](auto... Matcher) {
               return std::make_tuple(Matcher(InnerMatcher...)...);
             },