[PATCH] D77686: [mlir][AsmFormat] Avoid invalidating the iterator when verifying attributes

River Riddle via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Apr 7 15:49:46 PDT 2020


rriddle created this revision.
rriddle added a reviewer: benvanik.
Herald added subscribers: llvm-commits, grosul1, Joonsoo, liufengdb, lucyrfox, mgester, arpith-jacob, nicolasvasilache, antiagainst, shauheen, burmako, jpienaar, mehdi_amini.
Herald added a project: LLVM.
mehdi_amini accepted this revision.
mehdi_amini added inline comments.
This revision is now accepted and ready to land.
benvanik accepted this revision.


================
Comment at: mlir/tools/mlir-tblgen/OpFormatGen.cpp:1416
-        iteratorStack.emplace_back(elements.begin(), elements.end());
-        break;
-      }
----------------
Refactoring and "functional" for is so often better :)



'it' may get invalidated when recursing into optional groups. This revision refactors the inner loop to avoid the need to compare the iterator after invalidation.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D77686

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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: D77686.255841.patch
Type: text/x-patch
Size: 5208 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200407/b73aa3d6/attachment.bin>


More information about the llvm-commits mailing list