Prevent a crash in debug dumps.
authorDale Johannesen <dalej@apple.com>
Tue, 3 Jun 2008 18:14:29 +0000 (18:14 +0000)
committerDale Johannesen <dalej@apple.com>
Tue, 3 Jun 2008 18:14:29 +0000 (18:14 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@51910 91177308-0d34-0410-b5e6-96231b3b80d8

lib/VMCore/AsmWriter.cpp

index d8372ef0063637af48f21c3895f095c5a3f6ea43..9e010051a51102c08c06818e5e4140d11ffbcfd8 100644 (file)
@@ -979,7 +979,11 @@ void AssemblyWriter::printGlobal(const GlobalVariable *GV) {
 }
 
 void AssemblyWriter::printAlias(const GlobalAlias *GA) {
-  Out << getLLVMName(GA->getName(), GlobalPrefix) << " = ";
+  // Don't crash when dumping partially built GA
+  if (!GA->hasName())
+    Out << "<<nameless>> = ";
+  else
+    Out << getLLVMName(GA->getName(), GlobalPrefix) << " = ";
   switch (GA->getVisibility()) {
   default: assert(0 && "Invalid visibility style!");
   case GlobalValue::DefaultVisibility: break;