[Mlir-commits] [mlir] [MLIR] Fix a use-after-free in OpFormatGen.cpp (PR #114789)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Nov 4 05:05:30 PST 2024


llvmbot wrote:


<!--LLVM PR SUMMARY COMMENT-->

@llvm/pr-subscribers-mlir-core

Author: Haojian Wu (hokein)

<details>
<summary>Changes</summary>



---
Full diff: https://github.com/llvm/llvm-project/pull/114789.diff


1 Files Affected:

- (modified) mlir/tools/mlir-tblgen/OpFormatGen.cpp (+3-4) 


``````````diff
diff --git a/mlir/tools/mlir-tblgen/OpFormatGen.cpp b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
index 3bf6f2f6d38176..7e2b0694a860a3 100644
--- a/mlir/tools/mlir-tblgen/OpFormatGen.cpp
+++ b/mlir/tools/mlir-tblgen/OpFormatGen.cpp
@@ -229,10 +229,9 @@ class OIListElement : public DirectiveElementBase<DirectiveElement::OIList> {
 
   /// Returns a range to iterate over the LiteralElements.
   auto getLiteralElements() const {
-    function_ref<LiteralElement *(FormatElement * el)>
-        literalElementCastConverter =
-            [](FormatElement *el) { return cast<LiteralElement>(el); };
-    return llvm::map_range(literalElements, literalElementCastConverter);
+    return llvm::map_range(literalElements, [](FormatElement *el) {
+      return cast<LiteralElement>(el);
+    });
   }
 
   /// Returns a range to iterate over the parsing elements corresponding to the

``````````

</details>


https://github.com/llvm/llvm-project/pull/114789


More information about the Mlir-commits mailing list