Print out something, even if it's non-parseable later when we've
authorEric Christopher <echristo@apple.com>
Fri, 13 Nov 2009 23:00:14 +0000 (23:00 +0000)
committerEric Christopher <echristo@apple.com>
Fri, 13 Nov 2009 23:00:14 +0000 (23:00 +0000)
got ghost linkage. It's better than aborting.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@88715 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index 9a803a16628094a2482ad0cba72162836a75efd1..4954522691e149dc80fe3d92bc14c5807fa78228 100644 (file)
@@ -1497,8 +1497,8 @@ static void PrintLinkage(GlobalValue::LinkageTypes LT,
   case GlobalValue::AvailableExternallyLinkage:
     Out << "available_externally ";
     break;
-  case GlobalValue::GhostLinkage:
-    llvm_unreachable("GhostLinkage not allowed in AsmWriter!");
+    // This is invalid syntax and just a debugging aid.
+  case GlobalValue::GhostLinkage:        Out << "ghost ";          break;
   }
 }
 
@@ -1514,6 +1514,11 @@ static void PrintVisibility(GlobalValue::VisibilityTypes Vis,
 }
 
 void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
+  // If we're going to print a global that has GhostLinkage
+  // materialize it now.
+  if (GV->getLinkage() == GlobalValue::GhostLinkage) {
+  }
+
   WriteAsOperandInternal(Out, GV, &TypePrinter, &Machine);
   Out << " = ";