[PATCH] D47463: [TableGen] Avoid leaking TreePatternNodes by using shared_ptr.

Daniel Sanders via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 29 08:21:55 PDT 2018


dsanders added a comment.

Generally LGTM. I have a couple questions on this one though



================
Comment at: utils/TableGen/CodeGenDAGPatterns.h:923
       ImpResults(impresults), ResultPattern(nullptr) {}
+  DAGInstruction(DAGInstruction &&Other) noexcept
+      : Pattern(Other.Pattern), Results(std::move(Other.Results)),
----------------
Given that we build with -fno-exceptions, is the noexcept really needed?


================
Comment at: utils/TableGen/CodeGenDAGPatterns.h:939-942
+  ~DAGInstruction() {
+    if (Pattern)
+      delete Pattern;
+  }
----------------
Does this object really own Pattern? It looks like it probably does but it's a raw pointer. If it really does own it we should be using unique_ptr


https://reviews.llvm.org/D47463





More information about the llvm-commits mailing list