ELF: Remove the function SymbolTable<ELFT>::findFile.

We already have the function SymbolBody::getSourceFile which does the same thing.

llvm-svn: 268353
diff --git a/lld/ELF/SymbolTable.cpp b/lld/ELF/SymbolTable.cpp
index b0bd525..88747c7 100644
--- a/lld/ELF/SymbolTable.cpp
+++ b/lld/ELF/SymbolTable.cpp
@@ -164,23 +164,6 @@
   memcpy(Sym->Body.buffer, Wrap->Body.buffer, sizeof(Wrap->Body));
 }
 
-// Returns a file from which symbol B was created.
-// If B does not belong to any file, returns a nullptr.
-template <class ELFT> InputFile *SymbolTable<ELFT>::findFile(SymbolBody *B) {
-  // If this symbol has a definition, follow pointers in the symbol to its
-  // defining file.
-  if (auto *R = dyn_cast<DefinedRegular<ELFT>>(B))
-    if (auto *S = R->Section)
-      return S->getFile();
-  if (auto *SS = dyn_cast<SharedSymbol<ELFT>>(B))
-    return SS->File;
-  if (auto *BC = dyn_cast<DefinedBitcode>(B))
-    return BC->File;
-  if (auto *U = dyn_cast<Undefined>(B))
-    return U->File;
-  return nullptr;
-}
-
 static uint8_t getMinVisibility(uint8_t VA, uint8_t VB) {
   if (VA == STV_DEFAULT)
     return VB;
diff --git a/lld/ELF/SymbolTable.h b/lld/ELF/SymbolTable.h
index 0a942fa..22be99c 100644
--- a/lld/ELF/SymbolTable.h
+++ b/lld/ELF/SymbolTable.h
@@ -84,7 +84,6 @@
   void scanVersionScript();
   SymbolBody *find(StringRef Name);
   void wrap(StringRef Name);
-  InputFile *findFile(SymbolBody *B);
 
 private:
   std::pair<Symbol *, bool> insert(StringRef Name);
diff --git a/lld/ELF/Writer.cpp b/lld/ELF/Writer.cpp
index 093fac8..7a4ec04 100644
--- a/lld/ELF/Writer.cpp
+++ b/lld/ELF/Writer.cpp
@@ -785,7 +785,7 @@
   }
 
   std::string Msg = "undefined symbol: " + Sym->getName().str();
-  if (InputFile *File = Symtab.findFile(Sym))
+  if (InputFile *File = Sym->getSourceFile<ELFT>())
     Msg += " in " + File->getName().str();
   if (Config->NoinhibitExec)
     warning(Msg);