[lld] r321196 - LazyObject's file is never null, use a reference.
Rafael Espindola via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 20 09:52:36 PST 2017
Author: rafael
Date: Wed Dec 20 09:52:36 2017
New Revision: 321196
URL: http://llvm.org/viewvc/llvm-project?rev=321196&view=rev
Log:
LazyObject's file is never null, use a reference.
Modified:
lld/trunk/ELF/SymbolTable.cpp
lld/trunk/ELF/Symbols.cpp
lld/trunk/ELF/Symbols.h
Modified: lld/trunk/ELF/SymbolTable.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/SymbolTable.cpp?rev=321196&r1=321195&r2=321196&view=diff
==============================================================================
--- lld/trunk/ELF/SymbolTable.cpp (original)
+++ lld/trunk/ELF/SymbolTable.cpp Wed Dec 20 09:52:36 2017
@@ -563,7 +563,7 @@ void SymbolTable::addLazyObject(StringRe
bool WasInserted;
std::tie(S, WasInserted) = insert(Name);
if (WasInserted) {
- replaceSymbol<LazyObject>(S, &Obj, Name, Symbol::UnknownType);
+ replaceSymbol<LazyObject>(S, Obj, Name, Symbol::UnknownType);
return;
}
if (!S->isUndefined())
@@ -571,7 +571,7 @@ void SymbolTable::addLazyObject(StringRe
// See comment for addLazyArchive above.
if (S->isWeak())
- replaceSymbol<LazyObject>(S, &Obj, Name, S->Type);
+ replaceSymbol<LazyObject>(S, Obj, Name, S->Type);
else if (InputFile *F = Obj.fetch())
addFile<ELFT>(F);
}
Modified: lld/trunk/ELF/Symbols.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.cpp?rev=321196&r1=321195&r2=321196&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.cpp (original)
+++ lld/trunk/ELF/Symbols.cpp Wed Dec 20 09:52:36 2017
@@ -236,9 +236,9 @@ InputFile *LazyArchive::fetch() {
return createObjectFile(MBInfo.first, getFile()->getName(), MBInfo.second);
}
-LazyObjFile *LazyObject::getFile() { return cast<LazyObjFile>(File); }
+LazyObjFile &LazyObject::getFile() { return *cast<LazyObjFile>(File); }
-InputFile *LazyObject::fetch() { return getFile()->fetch(); }
+InputFile *LazyObject::fetch() { return getFile().fetch(); }
uint8_t Symbol::computeBinding() const {
if (Config->Relocatable)
Modified: lld/trunk/ELF/Symbols.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/Symbols.h?rev=321196&r1=321195&r2=321196&view=diff
==============================================================================
--- lld/trunk/ELF/Symbols.h (original)
+++ lld/trunk/ELF/Symbols.h Wed Dec 20 09:52:36 2017
@@ -295,12 +295,12 @@ private:
// --start-lib and --end-lib options.
class LazyObject : public Lazy {
public:
- LazyObject(InputFile *File, StringRef Name, uint8_t Type)
- : Lazy(LazyObjectKind, File, Name, Type) {}
+ LazyObject(InputFile &File, StringRef Name, uint8_t Type)
+ : Lazy(LazyObjectKind, &File, Name, Type) {}
static bool classof(const Symbol *S) { return S->kind() == LazyObjectKind; }
- LazyObjFile *getFile();
+ LazyObjFile &getFile();
InputFile *fetch();
};
More information about the llvm-commits
mailing list