[clang] 99a5a02 - [ASTMatchers] Replace hand-coded copy of std::apply with the real C++17 function. NFCI

Benjamin Kramer via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 8 05:09:44 PDT 2022


Author: Benjamin Kramer
Date: 2022-08-08T14:08:04+02:00
New Revision: 99a5a029e66643364c87d3945fb6990e943915dc

URL: https://github.com/llvm/llvm-project/commit/99a5a029e66643364c87d3945fb6990e943915dc
DIFF: https://github.com/llvm/llvm-project/commit/99a5a029e66643364c87d3945fb6990e943915dc.diff

LOG: [ASTMatchers] Replace hand-coded copy of std::apply with the real C++17 function. NFCI

Added: 
    

Modified: 
    clang/include/clang/ASTMatchers/ASTMatchersInternal.h

Removed: 
    


################################################################################
diff  --git a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
index 49de9a458c3db..5785a72559987 100644
--- a/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
+++ b/clang/include/clang/ASTMatchers/ASTMatchersInternal.h
@@ -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...)...);
             },


        


More information about the cfe-commits mailing list