[Mlir-commits] [mlir] 0ffef0c - [mlir][ods] (NFC) don't use std::function for map_range

llvmlistbot at llvm.org llvmlistbot at llvm.org
Wed May 11 22:15:12 PDT 2022


Author: Mogball
Date: 2022-05-12T05:15:03Z
New Revision: 0ffef0c23b5157a1add546c4d764c1c2de21cea3

URL: https://github.com/llvm/llvm-project/commit/0ffef0c23b5157a1add546c4d764c1c2de21cea3
DIFF: https://github.com/llvm/llvm-project/commit/0ffef0c23b5157a1add546c4d764c1c2de21cea3.diff

LOG: [mlir][ods] (NFC) don't use std::function for map_range

Added: 
    

Modified: 
    mlir/tools/mlir-tblgen/OpFormatGen.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 43a16f554308..adeaecb1f0db 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -187,10 +187,7 @@ class OIListElement : public DirectiveElementBase<DirectiveElement::OIList> {
 
   /// Returns a range to iterate over the LiteralElements.
   auto getLiteralElements() const {
-    // The use of std::function is unfortunate but necessary here. Lambda
-    // functions cannot be copied but std::function can be copied. This copy
-    // constructor is used in llvm::zip.
-    std::function<LiteralElement *(FormatElement * el)>
+    function_ref<LiteralElement *(FormatElement * el)>
         literalElementCastConverter =
             [](FormatElement *el) { return cast<LiteralElement>(el); };
     return llvm::map_range(literalElements, literalElementCastConverter);


        


More information about the Mlir-commits mailing list