[CodeView] Don't emit debuginfo for imported symbols

Emitting symbol information requires us to have a definition for the
symbol.  A symbol reference is insufficient.

This fixes PR28123.

llvm-svn: 272738
diff --git a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
index a90ce05..3b7815f 100644
--- a/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
+++ b/llvm/lib/CodeGen/AsmPrinter/CodeViewDebug.cpp
@@ -249,7 +249,8 @@
 
   // Emit per-function debug information.
   for (auto &P : FnDebugInfo)
-    emitDebugInfoForFunction(P.first, P.second);
+    if (!P.first->isDeclarationForLinker())
+      emitDebugInfoForFunction(P.first, P.second);
 
   // Emit global variable debug information.
   emitDebugInfoForGlobals();
@@ -1318,7 +1319,7 @@
     MCSymbol *EndLabel = nullptr;
     for (const DIGlobalVariable *G : CU->getGlobalVariables()) {
       if (const auto *GV = dyn_cast_or_null<GlobalVariable>(G->getVariable())) {
-        if (!GV->hasComdat()) {
+        if (!GV->hasComdat() && !GV->isDeclarationForLinker()) {
           if (!EndLabel) {
             OS.AddComment("Symbol subsection for globals");
             EndLabel = beginCVSubsection(ModuleSubstreamKind::Symbols);