Move SymbolTableSection::getOutputSection to SymbolBody::getOutputSection.

That function doesn't use any member of SymbolTableSection, so I
couldn't see a reason to make it a member of that class. The function
takes a SymbolBody, so it is more natural to make it a member of
SymbolBody.

llvm-svn: 296433
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index 3ffb507..7707d3d 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -172,6 +172,31 @@
   return 0;
 }
 
+template <class ELFT>
+const OutputSection *SymbolBody::getOutputSection() const {
+  if (auto *S = dyn_cast<DefinedRegular<ELFT>>(this)) {
+    if (S->Section)
+      return S->Section->template getOutputSection<ELFT>();
+    return nullptr;
+  }
+
+  if (auto *S = dyn_cast<SharedSymbol>(this)) {
+    if (S->NeedsCopy)
+      return S->Section->OutSec;
+    return nullptr;
+  }
+
+  if (isa<DefinedCommon>(this)) {
+    if (Config->DefineCommon)
+      return In<ELFT>::Common->OutSec;
+    return nullptr;
+  }
+
+  if (auto *S = dyn_cast<DefinedSynthetic>(this))
+    return S->Section;
+  return nullptr;
+}
+
 // If a symbol name contains '@', the characters after that is
 // a symbol version name. This function parses that.
 void SymbolBody::parseSymbolVersion() {
@@ -359,6 +384,15 @@
 template uint64_t SymbolBody::template getSize<ELF64LE>() const;
 template uint64_t SymbolBody::template getSize<ELF64BE>() const;
 
+template const OutputSection *
+    SymbolBody::template getOutputSection<ELF32LE>() const;
+template const OutputSection *
+    SymbolBody::template getOutputSection<ELF32BE>() const;
+template const OutputSection *
+    SymbolBody::template getOutputSection<ELF64LE>() const;
+template const OutputSection *
+    SymbolBody::template getOutputSection<ELF64BE>() const;
+
 template class elf::DefinedRegular<ELF32LE>;
 template class elf::DefinedRegular<ELF32BE>;
 template class elf::DefinedRegular<ELF64LE>;