[lld] r238901 - COFF: SymbolTable to manage symbols using BumpPtrAllocator.
Rui Ueyama
ruiu at google.com
Tue Jun 2 22:39:12 PDT 2015
Author: ruiu
Date: Wed Jun 3 00:39:12 2015
New Revision: 238901
URL: http://llvm.org/viewvc/llvm-project?rev=238901&view=rev
Log:
COFF: SymbolTable to manage symbols using BumpPtrAllocator.
Modified:
lld/trunk/COFF/SymbolTable.cpp
lld/trunk/COFF/SymbolTable.h
Modified: lld/trunk/COFF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.cpp?rev=238901&r1=238900&r2=238901&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.cpp (original)
+++ lld/trunk/COFF/SymbolTable.cpp Wed Jun 3 00:39:12 2015
@@ -22,9 +22,9 @@ namespace lld {
namespace coff {
SymbolTable::SymbolTable() {
- addSymbol(new DefinedAbsolute("__ImageBase", Config->ImageBase));
+ resolve(new (Alloc) DefinedAbsolute("__ImageBase", Config->ImageBase));
if (!Config->EntryName.empty())
- addUndefined(Config->EntryName);
+ resolve(new (Alloc) Undefined(Config->EntryName));
}
std::error_code SymbolTable::addFile(std::unique_ptr<InputFile> File) {
@@ -192,7 +192,7 @@ ErrorOr<StringRef> SymbolTable::findDefa
return StringRef(E[1]);
if (!find(E[0]))
continue;
- if (auto EC = addSymbol(new Undefined(E[1])))
+ if (auto EC = resolve(new (Alloc) Undefined(E[1])))
return EC;
return StringRef(E[1]);
}
@@ -201,7 +201,7 @@ ErrorOr<StringRef> SymbolTable::findDefa
}
std::error_code SymbolTable::addUndefined(StringRef Name) {
- return addSymbol(new Undefined(Name));
+ return resolve(new (Alloc) Undefined(Name));
}
// Resolve To, and make From an alias to To.
@@ -213,11 +213,6 @@ std::error_code SymbolTable::rename(Stri
return std::error_code();
}
-std::error_code SymbolTable::addSymbol(SymbolBody *Body) {
- OwningSymbols.push_back(std::unique_ptr<SymbolBody>(Body));
- return resolve(Body);
-}
-
void SymbolTable::dump() {
for (auto &P : Symtab) {
Symbol *Ref = P.second;
Modified: lld/trunk/COFF/SymbolTable.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/COFF/SymbolTable.h?rev=238901&r1=238900&r2=238901&view=diff
==============================================================================
--- lld/trunk/COFF/SymbolTable.h (original)
+++ lld/trunk/COFF/SymbolTable.h Wed Jun 3 00:39:12 2015
@@ -84,12 +84,10 @@ private:
std::error_code resolve(SymbolBody *Body);
std::error_code addMemberFile(Lazy *Body);
- std::error_code addSymbol(SymbolBody *Body);
std::unordered_map<StringRef, Symbol *> Symtab;
std::vector<std::unique_ptr<ArchiveFile>> ArchiveFiles;
std::vector<std::unique_ptr<BitcodeFile>> BitcodeFiles;
- std::vector<std::unique_ptr<SymbolBody>> OwningSymbols;
std::unique_ptr<MemoryBuffer> LTOObjectFile;
llvm::BumpPtrAllocator Alloc;
};
More information about the llvm-commits
mailing list