[Mlir-commits] [mlir] 5ac47c3 - Move explicit template class specialization out of the class to fix gcc builds (NFC)

Mehdi Amini llvmlistbot at llvm.org
Wed Jun 24 18:43:27 PDT 2020


Author: Mehdi Amini
Date: 2020-06-25T01:43:21Z
New Revision: 5ac47c3f5231aceb274e34be873986f6b49488fd

URL: https://github.com/llvm/llvm-project/commit/5ac47c3f5231aceb274e34be873986f6b49488fd
DIFF: https://github.com/llvm/llvm-project/commit/5ac47c3f5231aceb274e34be873986f6b49488fd.diff

LOG: Move explicit template class specialization out of the class to fix gcc builds (NFC)

gcc fails with:

   explicit specialization in non-namespace scope

Added: 
    

Modified: 
    mlir/include/mlir/Support/InterfaceSupport.h

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/Support/InterfaceSupport.h b/mlir/include/mlir/Support/InterfaceSupport.h
index c29c49d20e07..e7a7eca90df2 100644
--- a/mlir/include/mlir/Support/InterfaceSupport.h
+++ b/mlir/include/mlir/Support/InterfaceSupport.h
@@ -123,6 +123,24 @@ class Interface : public BaseType {
 // InterfaceMap
 //===----------------------------------------------------------------------===//
 
+/// Utility to filter a given sequence of types base upon a predicate.
+template <bool>
+struct FilterTypeT {
+  template <class E>
+  using type = std::tuple<E>;
+};
+template <>
+struct FilterTypeT<false> {
+  template <class E>
+  using type = std::tuple<>;
+};
+template <template <class> class Pred, class... Es>
+struct FilterTypes {
+  using type = decltype(std::tuple_cat(
+      std::declval<
+          typename FilterTypeT<Pred<Es>::value>::template type<Es>>()...));
+};
+
 /// This class provides an efficient mapping between a given `Interface` type,
 /// and a particular implementation of its concept.
 class InterfaceMap {
@@ -163,18 +181,6 @@ class InterfaceMap {
     template <typename T>
     using detect_get_interface_id = llvm::is_detected<has_get_interface_id, T>;
 
-    /// Utility to filter a given sequence of types base upon a predicate.
-    template <bool> struct FilterTypeT {
-      template <class E> using type = std::tuple<E>;
-    };
-    template <> struct FilterTypeT<false> {
-      template <class E> using type = std::tuple<>;
-    };
-    template <template <class> class Pred, class... Es> struct FilterTypes {
-      using type = decltype(std::tuple_cat(
-          std::declval<
-              typename FilterTypeT<Pred<Es>::value>::template type<Es>>()...));
-    };
     template <typename... Ts>
     static std::unique_ptr<llvm::SmallDenseMap<TypeID, void *>>
     createImpl(std::tuple<Ts...> *) {


        


More information about the Mlir-commits mailing list