[PATCH] D121638: [lld-macho] Avoid using bump-alloc in TrieBuider

Vy Nguyen via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 14:13:59 PDT 2022


oontvoo updated this revision to Diff 415222.
oontvoo marked 2 inline comments as done.
oontvoo added a comment.

review comment


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D121638

Files:
  lld/MachO/ExportTrie.cpp
  lld/MachO/ExportTrie.h


Index: lld/MachO/ExportTrie.h
===================================================================
--- lld/MachO/ExportTrie.h
+++ lld/MachO/ExportTrie.h
@@ -22,6 +22,7 @@
 
 class TrieBuilder {
 public:
+  explicit ~TrieBuilder();
   void setImageBase(uint64_t addr) { imageBase = addr; }
   void addSymbol(const Symbol &sym) { exported.push_back(&sym); }
   // Returns the size in bytes of the serialized trie.
Index: lld/MachO/ExportTrie.cpp
===================================================================
--- lld/MachO/ExportTrie.cpp
+++ lld/MachO/ExportTrie.cpp
@@ -145,8 +145,13 @@
   }
 }
 
+TrieNode::~TrieNode() {
+  for (TrieNode *node : nodes)
+    delete node;
+}
+
 TrieNode *TrieBuilder::makeNode() {
-  auto *node = make<TrieNode>();
+  auto *node = new TrieNode();
   nodes.emplace_back(node);
   return node;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D121638.415222.patch
Type: text/x-patch
Size: 831 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220314/e265cdbd/attachment.bin>


More information about the llvm-commits mailing list