From 8cd6674f5bd2011641a13674b287a2880c627fb7 Mon Sep 17 00:00:00 2001 From: Rafael Espindola Date: Wed, 20 Dec 2017 17:48:28 +0000 Subject: [PATCH] Use a reference in addLazyArchive. NFC. llvm-svn: 321194 --- lld/ELF/InputFiles.cpp | 2 +- lld/ELF/SymbolTable.cpp | 18 +++++++++--------- lld/ELF/SymbolTable.h | 2 +- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/lld/ELF/InputFiles.cpp b/lld/ELF/InputFiles.cpp index 025651f..e85a504 100644 --- a/lld/ELF/InputFiles.cpp +++ b/lld/ELF/InputFiles.cpp @@ -660,7 +660,7 @@ ArchiveFile::ArchiveFile(std::unique_ptr &&File) template void ArchiveFile::parse() { Symbols.reserve(File->getNumberOfSymbols()); for (const Archive::Symbol &Sym : File->symbols()) - Symbols.push_back(Symtab->addLazyArchive(Sym.getName(), this, Sym)); + Symbols.push_back(Symtab->addLazyArchive(Sym.getName(), *this, Sym)); } // Returns a buffer pointing to a member file containing a given symbol. diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp index b8ffd3a..7e505d6 100644 --- a/lld/ELF/SymbolTable.cpp +++ b/lld/ELF/SymbolTable.cpp @@ -532,13 +532,13 @@ Symbol *SymbolTable::find(StringRef Name) { } template -Symbol *SymbolTable::addLazyArchive(StringRef Name, ArchiveFile *F, +Symbol *SymbolTable::addLazyArchive(StringRef Name, ArchiveFile &F, const object::Archive::Symbol Sym) { Symbol *S; bool WasInserted; std::tie(S, WasInserted) = insert(Name); if (WasInserted) { - replaceSymbol(S, F, Sym, Symbol::UnknownType); + replaceSymbol(S, &F, Sym, Symbol::UnknownType); return S; } if (!S->isUndefined()) @@ -547,13 +547,13 @@ Symbol *SymbolTable::addLazyArchive(StringRef Name, ArchiveFile *F, // An undefined weak will not fetch archive members. See comment on Lazy in // Symbols.h for the details. if (S->isWeak()) { - replaceSymbol(S, F, Sym, S->Type); + replaceSymbol(S, &F, Sym, S->Type); S->Binding = STB_WEAK; return S; } - std::pair MBInfo = F->getMember(&Sym); + std::pair MBInfo = F.getMember(&Sym); if (!MBInfo.first.getBuffer().empty()) - addFile(createObjectFile(MBInfo.first, F->getName(), MBInfo.second)); + addFile(createObjectFile(MBInfo.first, F.getName(), MBInfo.second)); return S; } @@ -820,16 +820,16 @@ template Defined *SymbolTable::addAbsolute(StringRef, uint8_t, uint8_t); template Symbol * -SymbolTable::addLazyArchive(StringRef, ArchiveFile *, +SymbolTable::addLazyArchive(StringRef, ArchiveFile &, const object::Archive::Symbol); template Symbol * -SymbolTable::addLazyArchive(StringRef, ArchiveFile *, +SymbolTable::addLazyArchive(StringRef, ArchiveFile &, const object::Archive::Symbol); template Symbol * -SymbolTable::addLazyArchive(StringRef, ArchiveFile *, +SymbolTable::addLazyArchive(StringRef, ArchiveFile &, const object::Archive::Symbol); template Symbol * -SymbolTable::addLazyArchive(StringRef, ArchiveFile *, +SymbolTable::addLazyArchive(StringRef, ArchiveFile &, const object::Archive::Symbol); template void SymbolTable::addLazyObject(StringRef, LazyObjFile &); diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h index 0123b68..db3459a 100644 --- a/lld/ELF/SymbolTable.h +++ b/lld/ELF/SymbolTable.h @@ -62,7 +62,7 @@ public: uint32_t VerdefIndex); template - Symbol *addLazyArchive(StringRef Name, ArchiveFile *F, + Symbol *addLazyArchive(StringRef Name, ArchiveFile &F, const llvm::object::Archive::Symbol S); template void addLazyObject(StringRef Name, LazyObjFile &Obj); -- 2.7.4