comparison lld/MachO/ExportTrie.h @ 207:2e18cbf3894f

LLVM12
author Shinji KONO <kono@ie.u-ryukyu.ac.jp>
date Tue, 08 Jun 2021 06:07:14 +0900
parents 0572611fdcc8
children c4bab56944e8
comparison
equal deleted inserted replaced
173:0572611fdcc8 207:2e18cbf3894f
20 struct TrieNode; 20 struct TrieNode;
21 class Symbol; 21 class Symbol;
22 22
23 class TrieBuilder { 23 class TrieBuilder {
24 public: 24 public:
25 void setImageBase(uint64_t addr) { imageBase = addr; }
25 void addSymbol(const Symbol &sym) { exported.push_back(&sym); } 26 void addSymbol(const Symbol &sym) { exported.push_back(&sym); }
26 // Returns the size in bytes of the serialized trie. 27 // Returns the size in bytes of the serialized trie.
27 size_t build(); 28 size_t build();
28 void writeTo(uint8_t *buf) const; 29 void writeTo(uint8_t *buf) const;
29 30
30 private: 31 private:
31 TrieNode *makeNode(); 32 TrieNode *makeNode();
32 void sortAndBuild(llvm::MutableArrayRef<const Symbol *> vec, TrieNode *node, 33 void sortAndBuild(llvm::MutableArrayRef<const Symbol *> vec, TrieNode *node,
33 size_t lastPos, size_t pos); 34 size_t lastPos, size_t pos);
34 35
36 uint64_t imageBase = 0;
35 std::vector<const Symbol *> exported; 37 std::vector<const Symbol *> exported;
36 std::vector<TrieNode *> nodes; 38 std::vector<TrieNode *> nodes;
37 }; 39 };
38 40
39 using TrieEntryCallback = 41 using TrieEntryCallback =