[PATCH] D132321: [ADT] Remove `is_invocable` from `STLExtras.h`

Joe Loser via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Aug 20 17:49:59 PDT 2022


jloser created this revision.
jloser added reviewers: scott.linder, zturner, dblaikie.
Herald added a project: All.
jloser requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

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.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D132321

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


Index: llvm/unittests/ADT/TypeTraitsTest.cpp
===================================================================
--- llvm/unittests/ADT/TypeTraitsTest.cpp
+++ llvm/unittests/ADT/TypeTraitsTest.cpp
@@ -64,16 +64,3 @@
 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");
Index: llvm/include/llvm/ADT/STLExtras.h
===================================================================
--- llvm/include/llvm/ADT/STLExtras.h
+++ llvm/include/llvm/ADT/STLExtras.h
@@ -97,16 +97,6 @@
 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>


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D132321.454264.patch
Type: text/x-patch
Size: 1881 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220821/3ab88c4d/attachment.bin>


More information about the llvm-commits mailing list