[Mlir-commits] [mlir] 1b08b27 - [mlir] Use std::is_invocable instead of llvm::is_invocable

Joe Loser llvmlistbot at llvm.org
Sat Aug 20 17:31:28 PDT 2022


Author: Joe Loser
Date: 2022-08-20T17:33:51-06:00
New Revision: 1b08b276ae6d72eba543b28e653b34dc2e77f9ea

URL: https://github.com/llvm/llvm-project/commit/1b08b276ae6d72eba543b28e653b34dc2e77f9ea
DIFF: https://github.com/llvm/llvm-project/commit/1b08b276ae6d72eba543b28e653b34dc2e77f9ea.diff

LOG: [mlir] Use std::is_invocable instead of llvm::is_invocable

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

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Support/DebugAction.h b/mlir/include/mlir/Support/DebugAction.h
index 49f1d2744bdbc..41ec8b111f94a 100644
--- a/mlir/include/mlir/Support/DebugAction.h
+++ b/mlir/include/mlir/Support/DebugAction.h
@@ -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 @@ class DebugAction {
   /// 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`.

diff  --git a/mlir/include/mlir/Transforms/DialectConversion.h b/mlir/include/mlir/Transforms/DialectConversion.h
index 678bf02d731ef..72ab780ee9b61 100644
--- a/mlir/include/mlir/Transforms/DialectConversion.h
+++ b/mlir/include/mlir/Transforms/DialectConversion.h
@@ -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 @@ class TypeConverter {
   /// 
diff erent 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 @@ class TypeConverter {
   /// 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 @@ class TypeConverter {
   /// 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 @@ class ConversionTarget {
     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 @@ class ConversionTarget {
     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)); });


        


More information about the Mlir-commits mailing list