[mlir] Use std::is_invocable instead of llvm::is_invocable
authorJoe Loser <joeloser@fastmail.com>
Sat, 20 Aug 2022 23:30:14 +0000 (17:30 -0600)
committerJoe Loser <joeloser@fastmail.com>
Sat, 20 Aug 2022 23:33:51 +0000 (17:33 -0600)
Now that MLIR is built with C++17, use the standard library equivalent of
`llvm::is_invocable`: `std::is_invocable`.

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

mlir/include/mlir/Support/DebugAction.h
mlir/include/mlir/Transforms/DialectConversion.h

index 49f1d27..41ec8b1 100644 (file)
@@ -25,6 +25,7 @@
 #include "llvm/Support/TypeName.h"
 #include "llvm/Support/raw_ostream.h"
 #include <functional>
+#include <type_traits>
 
 namespace mlir {
 
@@ -218,8 +219,8 @@ private:
   /// parameter types.
   template <typename... CallerParameterTs>
   static constexpr bool canHandleWith() {
-    return llvm::is_invocable<function_ref<void(ParameterTs...)>,
-                              CallerParameterTs...>::value;
+    return std::is_invocable_v<function_ref<void(ParameterTs...)>,
+                               CallerParameterTs...>;
   }
 
   /// Allow access to `canHandleWith`.
index 678bf02..72ab780 100644 (file)
@@ -16,6 +16,7 @@
 #include "mlir/Rewrite/FrozenRewritePatternSet.h"
 #include "llvm/ADT/MapVector.h"
 #include "llvm/ADT/StringMap.h"
+#include <type_traits>
 
 namespace mlir {
 
@@ -245,7 +246,7 @@ private:
   /// different callback forms, that all compose into a single version.
   /// With callback of form: `Optional<Type>(T)`
   template <typename T, typename FnT>
-  std::enable_if_t<llvm::is_invocable<FnT, T>::value, ConversionCallbackFn>
+  std::enable_if_t<std::is_invocable_v<FnT, T>, ConversionCallbackFn>
   wrapCallback(FnT &&callback) {
     return wrapCallback<T>(
         [callback = std::forward<FnT>(callback)](
@@ -262,7 +263,7 @@ private:
   /// With callback of form: `Optional<LogicalResult>(T, SmallVectorImpl<Type>
   /// &)`
   template <typename T, typename FnT>
-  std::enable_if_t<llvm::is_invocable<FnT, T, SmallVectorImpl<Type> &>::value,
+  std::enable_if_t<std::is_invocable_v<FnT, T, SmallVectorImpl<Type> &>,
                    ConversionCallbackFn>
   wrapCallback(FnT &&callback) {
     return wrapCallback<T>(
@@ -274,9 +275,9 @@ private:
   /// With callback of form: `Optional<LogicalResult>(T, SmallVectorImpl<Type>
   /// &, ArrayRef<Type>)`.
   template <typename T, typename FnT>
-  std::enable_if_t<llvm::is_invocable<FnT, T, SmallVectorImpl<Type> &,
-                                      ArrayRef<Type>>::value,
-                   ConversionCallbackFn>
+  std::enable_if_t<
+      std::is_invocable_v<FnT, T, SmallVectorImpl<Type> &, ArrayRef<Type>>,
+      ConversionCallbackFn>
   wrapCallback(FnT &&callback) {
     return [callback = std::forward<FnT>(callback)](
                Type type, SmallVectorImpl<Type> &results,
@@ -720,8 +721,7 @@ public:
     addDynamicallyLegalOp<OpT2, OpTs...>(callback);
   }
   template <typename OpT, class Callable>
-  typename std::enable_if<
-      !llvm::is_invocable<Callable, Operation *>::value>::type
+  typename std::enable_if<!std::is_invocable_v<Callable, Operation *>>::type
   addDynamicallyLegalOp(Callable &&callback) {
     addDynamicallyLegalOp<OpT>(
         [=](Operation *op) { return callback(cast<OpT>(op)); });
@@ -760,8 +760,7 @@ public:
     markOpRecursivelyLegal<OpT2, OpTs...>(callback);
   }
   template <typename OpT, class Callable>
-  typename std::enable_if<
-      !llvm::is_invocable<Callable, Operation *>::value>::type
+  typename std::enable_if<!std::is_invocable_v<Callable, Operation *>>::type
   markOpRecursivelyLegal(Callable &&callback) {
     markOpRecursivelyLegal<OpT>(
         [=](Operation *op) { return callback(cast<OpT>(op)); });