diff options
| -rw-r--r-- | lld/COFF/InputFiles.cpp | 4 | ||||
| -rw-r--r-- | lld/COFF/InputFiles.h | 5 | ||||
| -rw-r--r-- | lld/COFF/SymbolTable.cpp | 4 |
3 files changed, 5 insertions, 8 deletions
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp index 273e6d3c9ed..a8a35a5cfde 100644 --- a/lld/COFF/InputFiles.cpp +++ b/lld/COFF/InputFiles.cpp @@ -58,13 +58,11 @@ void ArchiveFile::parse() { // Allocate a buffer for Lazy objects. size_t NumSyms = File->getNumberOfSymbols(); - size_t BufSize = NumSyms * sizeof(Lazy); - Lazy *Buf = (Lazy *)Alloc.Allocate(BufSize, llvm::alignOf<Lazy>()); LazySymbols.reserve(NumSyms); // Read the symbol table to construct Lazy objects. for (const Archive::Symbol &Sym : File->symbols()) - LazySymbols.push_back(new (Buf++) Lazy(this, Sym)); + LazySymbols.emplace_back(this, Sym); // Seen is a map from member files to boolean values. Initially // all members are mapped to false, which indicates all these files diff --git a/lld/COFF/InputFiles.h b/lld/COFF/InputFiles.h index a3a9bd95a47..4f93a6749df 100644 --- a/lld/COFF/InputFiles.h +++ b/lld/COFF/InputFiles.h @@ -98,7 +98,7 @@ public: // (So that we don't instantiate same members more than once.) MemoryBufferRef getMember(const Archive::Symbol *Sym); - std::vector<Lazy *> &getLazySymbols() { return LazySymbols; } + llvm::MutableArrayRef<Lazy> getLazySymbols() { return LazySymbols; } // All symbols returned by ArchiveFiles are of Lazy type. std::vector<SymbolBody *> &getSymbols() override { @@ -108,9 +108,8 @@ public: private: std::unique_ptr<Archive> File; std::string Filename; - std::vector<Lazy *> LazySymbols; + std::vector<Lazy> LazySymbols; std::map<uint64_t, std::atomic_flag> Seen; - llvm::MallocAllocator Alloc; }; // .obj or .o file. This may be a member of an archive file. diff --git a/lld/COFF/SymbolTable.cpp b/lld/COFF/SymbolTable.cpp index 47b91f5df1b..c15f68aac2b 100644 --- a/lld/COFF/SymbolTable.cpp +++ b/lld/COFF/SymbolTable.cpp @@ -63,8 +63,8 @@ void SymbolTable::readArchives() { if (Config->Verbose) llvm::outs() << "Reading " << File->getShortName() << "\n"; File->parse(); - for (Lazy *Sym : File->getLazySymbols()) - addLazy(Sym, &LazySyms); + for (Lazy &Sym : File->getLazySymbols()) + addLazy(&Sym, &LazySyms); } ArchiveQueue.clear(); |

