forked from OSchip/llvm-project
[lld-macho] Avoid using bump-alloc in TrieBuider
The code can be used in multi-threads and the allocator is not thread safe. fixes PR/54378 Reviewed By: int3, #lld-macho Differential Revision: https://reviews.llvm.org/D121638
This commit is contained in:
parent
edd3e705bb
commit
e049a87f04
|
@ -145,8 +145,13 @@ void TrieNode::writeTo(uint8_t *buf) const {
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue