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

Jez Ng via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 14:23:14 PDT 2022


This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rGe049a87f04cf: [lld-macho] Avoid using bump-alloc in TrieBuider (authored by oontvoo, committed by int3).

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:
+  ~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.415225.patch
Type: text/x-patch
Size: 822 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220314/f147877b/attachment.bin>


More information about the llvm-commits mailing list