Inline two trivial functions that are called only once. NFC.
authorRui Ueyama <ruiu@google.com>
Mon, 2 Apr 2018 23:58:50 +0000 (23:58 +0000)
committerRui Ueyama <ruiu@google.com>
Mon, 2 Apr 2018 23:58:50 +0000 (23:58 +0000)
llvm-svn: 329034

lld/ELF/Symbols.cpp
lld/ELF/Symbols.h

index 8ac3e5f..d32d44a 100644 (file)
@@ -213,21 +213,18 @@ InputFile *Lazy::fetch() {
   return cast<LazyObject>(this)->fetch();
 }
 
-ArchiveFile &LazyArchive::getFile() { return *cast<ArchiveFile>(File); }
-
 InputFile *LazyArchive::fetch() {
-  std::pair<MemoryBufferRef, uint64_t> MBInfo = getFile().getMember(&Sym);
+  auto *F = cast<ArchiveFile>(File);
+  std::pair<MemoryBufferRef, uint64_t> MBInfo = F->getMember(&Sym);
 
   // getMember returns an empty buffer if the member was already
   // read from the library.
   if (MBInfo.first.getBuffer().empty())
     return nullptr;
-  return createObjectFile(MBInfo.first, getFile().getName(), MBInfo.second);
+  return createObjectFile(MBInfo.first, F->getName(), MBInfo.second);
 }
 
-LazyObjFile &LazyObject::getFile() { return *cast<LazyObjFile>(File); }
-
-InputFile *LazyObject::fetch() { return getFile().fetch(); }
+InputFile *LazyObject::fetch() { return cast<LazyObjFile>(File)->fetch(); }
 
 uint8_t Symbol::computeBinding() const {
   if (Config->Relocatable)
index bef5897..dde708b 100644 (file)
@@ -283,7 +283,6 @@ public:
 
   static bool classof(const Symbol *S) { return S->kind() == LazyArchiveKind; }
 
-  ArchiveFile &getFile();
   InputFile *fetch();
 
 private:
@@ -299,7 +298,6 @@ public:
 
   static bool classof(const Symbol *S) { return S->kind() == LazyObjectKind; }
 
-  LazyObjFile &getFile();
   InputFile *fetch();
 };