[lld] 0d5e276 - Reland "[lld-macho] Avoid using bump-alloc in TrieBuider""

Vy Nguyen via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 14 16:33:30 PDT 2022


Author: Vy Nguyen
Date: 2022-03-14T19:33:13-04:00
New Revision: 0d5e27623a699810ab2c8ec01f6edfebde66f888

URL: https://github.com/llvm/llvm-project/commit/0d5e27623a699810ab2c8ec01f6edfebde66f888
DIFF: https://github.com/llvm/llvm-project/commit/0d5e27623a699810ab2c8ec01f6edfebde66f888.diff

LOG: Reland  "[lld-macho] Avoid using bump-alloc in TrieBuider""

This reverts commit ee7a286cd3e4364d2f7d5b6ba4b8a6fc0d524854.

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/lld/MachO/ExportTrie.cpp b/lld/MachO/ExportTrie.cpp
index 372690a20df67..b95ad9be009e3 100644
--- a/lld/MachO/ExportTrie.cpp
+++ b/lld/MachO/ExportTrie.cpp
@@ -145,8 +145,13 @@ void TrieNode::writeTo(uint8_t *buf) const {
   }
 }
 
+TrieBuilder::~TrieBuilder() {
+  for (TrieNode *node : nodes)
+    delete node;
+}
+
 TrieNode *TrieBuilder::makeNode() {
-  auto *node = make<TrieNode>();
+  auto *node = new TrieNode();
   nodes.emplace_back(node);
   return node;
 }

diff  --git a/lld/MachO/ExportTrie.h b/lld/MachO/ExportTrie.h
index a43f4f2cce98b..0675d8257a2a6 100644
--- a/lld/MachO/ExportTrie.h
+++ b/lld/MachO/ExportTrie.h
@@ -22,6 +22,7 @@ class Symbol;
 
 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.


        


More information about the llvm-commits mailing list