COFF: Implement SymbolBody::getDebugName() for DefinedBitcode symbols.

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

llvm-svn: 241029
diff --git a/lld/COFF/InputFiles.cpp b/lld/COFF/InputFiles.cpp
index 2819d39..47a6d0a 100644
--- a/lld/COFF/InputFiles.cpp
+++ b/lld/COFF/InputFiles.cpp
@@ -291,7 +291,8 @@
     } else {
       bool Replaceable = (SymbolDef == LTO_SYMBOL_DEFINITION_TENTATIVE ||
                           (Attrs & LTO_SYMBOL_COMDAT));
-      SymbolBodies.push_back(new (Alloc) DefinedBitcode(SymName, Replaceable));
+      SymbolBodies.push_back(new (Alloc) DefinedBitcode(this, SymName,
+                                                        Replaceable));
     }
   }
 
diff --git a/lld/COFF/Symbols.cpp b/lld/COFF/Symbols.cpp
index 4f7d919..883666e 100644
--- a/lld/COFF/Symbols.cpp
+++ b/lld/COFF/Symbols.cpp
@@ -138,6 +138,9 @@
   if (auto *D = dyn_cast<DefinedCOFF>(this)) {
     N += " ";
     N += D->File->getShortName();
+  } else if (auto *D = dyn_cast<DefinedBitcode>(this)) {
+    N += " ";
+    N += D->File->getShortName();
   }
   return N;
 }
diff --git a/lld/COFF/Symbols.h b/lld/COFF/Symbols.h
index 58e0256..6710698 100644
--- a/lld/COFF/Symbols.h
+++ b/lld/COFF/Symbols.h
@@ -28,6 +28,7 @@
 using llvm::object::coff_symbol_generic;
 
 class ArchiveFile;
+class BitcodeFile;
 class InputFile;
 class ObjectFile;
 class SymbolBody;
@@ -334,15 +335,19 @@
 };
 
 class DefinedBitcode : public Defined {
+  friend SymbolBody;
 public:
-  DefinedBitcode(StringRef N, bool IsReplaceable)
-      : Defined(DefinedBitcodeKind, N) {
+  DefinedBitcode(BitcodeFile *F, StringRef N, bool IsReplaceable)
+      : Defined(DefinedBitcodeKind, N), File(F) {
     this->IsReplaceable = IsReplaceable;
   }
 
   static bool classof(const SymbolBody *S) {
     return S->kind() == DefinedBitcodeKind;
   }
+
+private:
+  BitcodeFile *File;
 };
 
 } // namespace coff