[mlir] Move InterfaceMap::InterfaceMap to the cpp file
authorBenjamin Kramer <benny.kra@googlemail.com>
Thu, 17 Mar 2022 19:13:52 +0000 (20:13 +0100)
committerBenjamin Kramer <benny.kra@googlemail.com>
Thu, 17 Mar 2022 19:14:24 +0000 (20:14 +0100)
So we don't end up with a copy of std::sort in every dialect definition.
NFCI.

mlir/include/mlir/Support/InterfaceSupport.h
mlir/lib/Support/InterfaceSupport.cpp

index 53caebc..e0f5dd3 100644 (file)
@@ -220,12 +220,7 @@ public:
   /// Create an InterfaceMap given with the implementation of the interfaces.
   /// The use of this constructor is in general discouraged in favor of
   /// 'InterfaceMap::get<InterfaceA, ...>()'.
-  InterfaceMap(MutableArrayRef<std::pair<TypeID, void *>> elements)
-      : interfaces(elements.begin(), elements.end()) {
-    llvm::sort(interfaces, [](const auto &lhs, const auto &rhs) {
-      return compare(lhs.first, rhs.first);
-    });
-  }
+  InterfaceMap(MutableArrayRef<std::pair<TypeID, void *>> elements);
 
   /// Insert the given models as implementations of the corresponding interfaces
   /// for the concrete attribute class.
index 5287dd0..4b8dd58 100644 (file)
 
 using namespace mlir;
 
+detail::InterfaceMap::InterfaceMap(
+    MutableArrayRef<std::pair<TypeID, void *>> elements)
+    : interfaces(elements.begin(), elements.end()) {
+  llvm::sort(interfaces, [](const auto &lhs, const auto &rhs) {
+    return compare(lhs.first, rhs.first);
+  });
+}
+
 void detail::InterfaceMap::insert(
     ArrayRef<std::pair<TypeID, void *>> elements) {
   // Insert directly into the right position to keep the interfaces sorted.