LazyObject's file is never null, use a reference.

llvm-svn: 321196
This commit is contained in:
Rafael Espindola 2017-12-20 17:52:36 +00:00
parent 8cd6674f5b
commit 2e5c71eadc
3 changed files with 7 additions and 7 deletions

View File

@ -563,7 +563,7 @@ void SymbolTable::addLazyObject(StringRef Name, LazyObjFile &Obj) {
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(StringRef Name, LazyObjFile &Obj) {
// 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);
}

View File

@ -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)

View File

@ -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();
};