[ELF] Remove redundant isDefined() in Symbol::computeBinding() and delete one redundant call site

After r367869, VER_NDX_LOCAL can only be assigned to Defined and
CommonSymbol.  CommonSymbol becomes Defined after replaceCommonSymbols(),
thus `versionId == VER_NDX_LOCAL` will imply `isDefined()`.

In maybeReportUndefined(), computeBinding() is called when the symbol is
unknown to be Undefined. computeBinding() != STB_LOCAL will always be
true.

git-svn-id: https://llvm.org/svn/llvm-project/lld/trunk@368536 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/ELF/Relocations.cpp b/ELF/Relocations.cpp
index 6dd1b4d..c3288ff 100644
--- a/ELF/Relocations.cpp
+++ b/ELF/Relocations.cpp
@@ -770,8 +770,7 @@
   if (!sym.isUndefined() || sym.isWeak())
     return false;
 
-  bool canBeExternal = !sym.isLocal() && sym.computeBinding() != STB_LOCAL &&
-                       sym.visibility == STV_DEFAULT;
+  bool canBeExternal = !sym.isLocal() && sym.visibility == STV_DEFAULT;
   if (config->unresolvedSymbols == UnresolvedPolicy::Ignore && canBeExternal)
     return false;
 
diff --git a/ELF/Symbols.cpp b/ELF/Symbols.cpp
index 6652f48..84bc158 100644
--- a/ELF/Symbols.cpp
+++ b/ELF/Symbols.cpp
@@ -276,9 +276,8 @@
 uint8_t Symbol::computeBinding() const {
   if (config->relocatable)
     return binding;
-  if (visibility != STV_DEFAULT && visibility != STV_PROTECTED)
-    return STB_LOCAL;
-  if (versionId == VER_NDX_LOCAL && isDefined())
+  if ((visibility != STV_DEFAULT && visibility != STV_PROTECTED) ||
+      versionId == VER_NDX_LOCAL)
     return STB_LOCAL;
   if (!config->gnuUnique && binding == STB_GNU_UNIQUE)
     return STB_GLOBAL;