Simplify SymbolTable::add{Defined,Undefined,...} functions.

SymbolTable's add-family functions have lots of parameters because
when they have to create a new symbol, they forward given arguments
to Symbol's constructors. Therefore, the functions take at least as
many arguments as their corresponding constructors.

This patch simplifies the add-family functions. Now, the functions
take a symbol instead of arguments to construct a symbol. If there's
no existing symbol, a given symbol is memcpy'ed to the symbol table.
Otherwise, the functions attempt to merge the existing and a given
new symbol.

I also eliminated `CanOmitFromDynSym` parameter, so that the functions
take really one argument.

Symbol classes are trivially constructible, so looks like constructing
them to pass to add-family functions is as cheap as passing a lot of
arguments to the functions. A quick benchmark showed that this patch
seems performance-neutral.

This is a preparation for
http://lists.llvm.org/pipermail/llvm-dev/2019-April/131902.html

Differential Revision: https://reviews.llvm.org/D61855

llvm-svn: 360838
diff --git a/lld/ELF/Symbols.cpp b/lld/ELF/Symbols.cpp
index f07ee3b..cabffc8 100644
--- a/lld/ELF/Symbols.cpp
+++ b/lld/ELF/Symbols.cpp
@@ -239,7 +239,9 @@
           Verstr);
 }
 
-InputFile *LazyArchive::fetch() { return cast<ArchiveFile>(File)->fetch(Sym); }
+InputFile *LazyArchive::fetch() const {
+  return cast<ArchiveFile>(File)->fetch(Sym);
+}
 
 MemoryBufferRef LazyArchive::getMemberBuffer() {
   Archive::Child C = CHECK(
@@ -250,6 +252,10 @@
                    Sym.getName());
 }
 
+InputFile *LazyObject::fetch() const {
+  return cast<LazyObjFile>(File)->fetch();
+}
+
 uint8_t Symbol::computeBinding() const {
   if (Config->Relocatable)
     return Binding;