PR15149: crash when printing debug info metadata containing an invalid language spec
authorDavid Blaikie <dblaikie@gmail.com>
Mon, 4 Feb 2013 05:31:37 +0000 (05:31 +0000)
committerDavid Blaikie <dblaikie@gmail.com>
Mon, 4 Feb 2013 05:31:37 +0000 (05:31 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@174304 91177308-0d34-0410-b5e6-96231b3b80d8

lib/IR/DebugInfo.cpp

index c983787712675b586eb6aa4b9956762c5c33d832..ecaab1fd652782a48137eb4e7f8af66f0e9b7619 100644 (file)
@@ -1058,8 +1058,8 @@ void DIScope::printInternal(raw_ostream &OS) const {
 
 void DICompileUnit::printInternal(raw_ostream &OS) const {
   DIScope::printInternal(OS);
-  if (unsigned Lang = getLanguage())
-    OS << " [" << dwarf::LanguageString(Lang) << ']';
+  if (const char *Lang = dwarf::LanguageString(getLanguage()))
+    OS << " [" << Lang << ']';
 }
 
 void DIEnumerator::printInternal(raw_ostream &OS) const {