[lld] r246662 - Remove an allocator which was used for just one allocation.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Sep 2 09:07:11 PDT 2015
Author: rafael
Date: Wed Sep 2 11:07:11 2015
New Revision: 246662
URL: http://llvm.org/viewvc/llvm-project?rev=246662&view=rev
Log:
Remove an allocator which was used for just one allocation.
Modified:
lld/trunk/COFF/InputFiles.cpp
lld/trunk/COFF/InputFiles.h
lld/trunk/COFF/SymbolTable.cpp
Modified: lld/trunk/COFF/InputFiles.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.cpp?rev=246662&r1=246661&r2=246662&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.cpp (original)
+++ lld/trunk/COFF/InputFiles.cpp Wed Sep 2 11:07:11 2015
@@ -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
Modified: lld/trunk/COFF/InputFiles.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/InputFiles.h?rev=246662&r1=246661&r2=246662&view=diff
==============================================================================
--- lld/trunk/COFF/InputFiles.h (original)
+++ lld/trunk/COFF/InputFiles.h Wed Sep 2 11:07:11 2015
@@ -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.
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=246662&r1=246661&r2=246662&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Wed Sep 2 11:07:11 2015
@@ -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();
More information about the llvm-commits
mailing list