[llvm] 4a51b0c - [ADT] Remove `is_invocable` from `STLExtras.h`

Joe Loser via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 21 17:15:59 PDT 2022


Author: Joe Loser
Date: 2022-08-21T18:15:38-06:00
New Revision: 4a51b0c05b3e734a4bb43563a3b5529be2839b41

URL: https://github.com/llvm/llvm-project/commit/4a51b0c05b3e734a4bb43563a3b5529be2839b41
DIFF: https://github.com/llvm/llvm-project/commit/4a51b0c05b3e734a4bb43563a3b5529be2839b41.diff

LOG: [ADT] Remove `is_invocable` from `STLExtras.h`

As a follow-up of https://reviews.llvm.org/D132318, now that the callers have
been adjusted to use `std::is_invocable`, remove `llvm::is_invocable` and its
tests.

Differential Revision: https://reviews.llvm.org/D132321

Added: 
    

Modified: 
    llvm/include/llvm/ADT/STLExtras.h
    llvm/unittests/ADT/TypeTraitsTest.cpp

Removed: 
    


################################################################################
diff  --git a/llvm/include/llvm/ADT/STLExtras.h b/llvm/include/llvm/ADT/STLExtras.h
index 3d914d71bcd3f..9173719d851df 100644
--- a/llvm/include/llvm/ADT/STLExtras.h
+++ b/llvm/include/llvm/ADT/STLExtras.h
@@ -96,16 +96,6 @@ struct detector<std::void_t<Op<Args...>>, Op, Args...> {
 template <template <class...> class Op, class... Args>
 using is_detected = typename detail::detector<void, Op, Args...>::value_t;
 
-namespace detail {
-template <typename Callable, typename... Args>
-using is_invocable =
-    decltype(std::declval<Callable &>()(std::declval<Args>()...));
-} // namespace detail
-
-/// Check if a Callable type can be invoked with the given set of arg types.
-template <typename Callable, typename... Args>
-using is_invocable = is_detected<detail::is_invocable, Callable, Args...>;
-
 /// This class provides various trait information about a callable object.
 ///   * To access the number of arguments: Traits::num_args
 ///   * To access the type of an argument: Traits::arg_t<Index>

diff  --git a/llvm/unittests/ADT/TypeTraitsTest.cpp b/llvm/unittests/ADT/TypeTraitsTest.cpp
index 74d3bbe1fcce0..30fb98a3f2f54 100644
--- a/llvm/unittests/ADT/TypeTraitsTest.cpp
+++ b/llvm/unittests/ADT/TypeTraitsTest.cpp
@@ -64,16 +64,3 @@ static_assert(is_detected<has_foo_method_t, HasFooMethod>::value,
 static_assert(!is_detected<has_foo_method_t, NoFooMethod>::value,
               "expected no foo method to be detected");
 } // end anonymous namespace
-
-//===----------------------------------------------------------------------===//
-// is_invocable
-//===----------------------------------------------------------------------===//
-
-void invocable_fn(int);
-
-static_assert(is_invocable<decltype(invocable_fn), int>::value,
-              "expected function to be invocable");
-static_assert(!is_invocable<decltype(invocable_fn), void *>::value,
-              "expected function not to be invocable");
-static_assert(!is_invocable<decltype(invocable_fn), int, int>::value,
-              "expected function not to be invocable");


        


More information about the llvm-commits mailing list