COFF: Fix the case where an object defines a weak external and its alias.

This worked before, but only by accident, and only with assertions disabled.
We ended up storing a DefinedRegular symbol in the WeakAlias field,
and never using it as an Undefined.

Differential Revision: http://reviews.llvm.org/D10934

llvm-svn: 241376
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 395d510..3bb3c6f 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -199,7 +199,7 @@
   COFFObj->getSymbolName(Sym, Name);
   auto *U = new (Alloc) Undefined(Name);
   auto *Aux = (const coff_aux_weak_external *)AuxP;
-  U->WeakAlias = cast<Undefined>(SparseSymbolBodies[Aux->TagIndex]);
+  U->WeakAlias = SparseSymbolBodies[Aux->TagIndex];
   return U;
 }