[llvm] r179664 - PR15149/r174304 improvement - print hex for unknown dwarf language codes & add a test case

David Blaikie dblaikie at gmail.com
Tue Apr 16 20:41:36 PDT 2013


Author: dblaikie
Date: Tue Apr 16 22:41:36 2013
New Revision: 179664

URL: http://llvm.org/viewvc/llvm-project?rev=179664&view=rev
Log:
PR15149/r174304 improvement - print hex for unknown dwarf language codes & add a test case

CR feedback from Rafael Espindola and Paul Robinson.

Modified:
    llvm/trunk/lib/IR/DebugInfo.cpp
    llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll

Modified: llvm/trunk/lib/IR/DebugInfo.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/DebugInfo.cpp?rev=179664&r1=179663&r2=179664&view=diff
==============================================================================
--- llvm/trunk/lib/IR/DebugInfo.cpp (original)
+++ llvm/trunk/lib/IR/DebugInfo.cpp Tue Apr 16 22:41:36 2013
@@ -1054,8 +1054,13 @@ void DIScope::printInternal(raw_ostream
 
 void DICompileUnit::printInternal(raw_ostream &OS) const {
   DIScope::printInternal(OS);
-  if (const char *Lang = dwarf::LanguageString(getLanguage()))
-    OS << " [" << Lang << ']';
+  OS << " [";
+  unsigned Lang = getLanguage();
+  if (const char *LangStr = dwarf::LanguageString(Lang))
+    OS << LangStr;
+  else
+    (OS << "lang 0x").write_hex(Lang);
+  OS << ']';
 }
 
 void DIEnumerator::printInternal(raw_ostream &OS) const {

Modified: llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll?rev=179664&r1=179663&r2=179664&view=diff
==============================================================================
--- llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll (original)
+++ llvm/trunk/test/DebugInfo/2010-03-19-DbgDeclare.ll Tue Apr 16 22:41:36 2013
@@ -1,12 +1,17 @@
-; RUN: llvm-as < %s | opt -verify -disable-output
+; RUN: llvm-as < %s | opt -verify -S -asm-verbose | FileCheck %s
+
+; CHECK: lang 0x8001
 
 define void @Foo(i32 %a, i32 %b) {
 entry:
   call void @llvm.dbg.declare(metadata !{i32* null}, metadata !1)
   ret void
 }
-
+!llvm.dbg.cu = !{!2}
+!2 = metadata !{i32 786449, metadata !4, i32 32769, metadata !"clang version 3.3 ", i1 false, metadata !"", i32 0, metadata !3, metadata !3, metadata !3, metadata !3, metadata !""} ; [ DW_TAG_compile_unit ] [/usr/local/google/home/blaikie/dev/scratch/scratch.cpp] [lang 0x8001]
+!3 = metadata !{}
 !0 = metadata !{i32 662302, i32 26, metadata !1, null}
 !1 = metadata !{i32 4, metadata !"foo"}
+!4 = metadata !{metadata !"scratch.cpp", metadata !"/usr/local/google/home/blaikie/dev/scratch"}
 
 declare void @llvm.dbg.declare(metadata, metadata) nounwind readnone





More information about the llvm-commits mailing list