[llvm-commits] [llvm] r90631 - in /llvm/trunk: lib/CodeGen/AsmPrinter/AsmPrinter.cpp test/FrontendC++/2009-07-15-LineNumbers.cpp

Dan Gohman gohman at apple.com
Fri Dec 4 16:23:29 PST 2009


Author: djg
Date: Fri Dec  4 18:23:29 2009
New Revision: 90631

URL: http://llvm.org/viewvc/llvm-project?rev=90631&view=rev
Log:
Fix this code to use DIScope instead of DICompileUnit, as in r90181.
Don't print "SrcLine"; just print the filename and line number, which
is obvious enough and more informative.

Modified:
    llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
    llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp

Modified: llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp?rev=90631&r1=90630&r2=90631&view=diff

==============================================================================
--- llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp (original)
+++ llvm/trunk/lib/CodeGen/AsmPrinter/AsmPrinter.cpp Fri Dec  4 18:23:29 2009
@@ -1837,15 +1837,16 @@
 
     // Print source line info.
     O.PadToColumn(MAI->getCommentColumn());
-    O << MAI->getCommentString() << " SrcLine ";
-    if (DLT.Scope) {
-      DICompileUnit CU(DLT.Scope);
-      if (!CU.isNull())
-        O << CU.getFilename() << " ";
-    }
-    O << DLT.Line;
+    O << MAI->getCommentString() << ' ';
+    DIScope Scope(DLT.Scope);
+    // Omit the directory, because it's likely to be long and uninteresting.
+    if (!Scope.isNull())
+      O << Scope.getFilename();
+    else
+      O << "<unknown>";
+    O << ':' << DLT.Line;
     if (DLT.Col != 0)
-      O << ":" << DLT.Col;
+      O << ':' << DLT.Col;
     Newline = true;
   }
 

Modified: llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/FrontendC%2B%2B/2009-07-15-LineNumbers.cpp?rev=90631&r1=90630&r2=90631&view=diff

==============================================================================
--- llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp (original)
+++ llvm/trunk/test/FrontendC++/2009-07-15-LineNumbers.cpp Fri Dec  4 18:23:29 2009
@@ -1,7 +1,7 @@
 // This is a regression test on debug info to make sure that we can
 // print line numbers in asm.
 // RUN: %llvmgcc -S -O0 -g %s -o - | \
-// RUN:    llc --disable-fp-elim -O0 -relocation-model=pic | grep {SrcLine 25}
+// RUN:    llc --disable-fp-elim -O0 -relocation-model=pic | grep { 2009-07-15-LineNumbers.cpp:25$}
 
 #include <stdlib.h>
 





More information about the llvm-commits mailing list