[PATCH] D114699: Fixed a memory leak in the PDLToPDLInterp RootOrderingTest.

Mehdi AMINI via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Nov 29 16:00:27 PST 2021


mehdi_amini added inline comments.


================
Comment at: mlir/unittests/Conversion/PDLToPDLInterp/RootOrderingTest.cpp:37
+  ~RootOrderingTest() {
+    for (int i = 0; i < 4; ++i)
+      v[i].getDefiningOp()->destroy();
----------------
bondhugula wrote:
> bondhugula wrote:
> > You need to be erasing those ops using `erase()`. 
> Nit: `unsigned` here and below.
@bondhugula unsigned is an anti-pattern (unless working with bit-fields or other bit-manipulation), this has been widely documented I believe, both in C++ standardization paper (they are stuck with size_t in the standard library) and with conference talks like this one: https://www.youtube.com/watch?v=yG1OZ69H_-o


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D114699/new/

https://reviews.llvm.org/D114699



More information about the cfe-commits mailing list