[llvm] r226046 - IR: Always print MDLocation line
Duncan P. N. Exon Smith
dexonsmith at apple.com
Wed Jan 14 14:14:26 PST 2015
Author: dexonsmith
Date: Wed Jan 14 16:14:26 2015
New Revision: 226046
URL: http://llvm.org/viewvc/llvm-project?rev=226046&view=rev
Log:
IR: Always print MDLocation line
Print `MDLocation`'s `line` field even when it's 0.
Modified:
llvm/trunk/lib/IR/AsmWriter.cpp
llvm/trunk/test/Assembler/mdlocation.ll
Modified: llvm/trunk/lib/IR/AsmWriter.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/IR/AsmWriter.cpp?rev=226046&r1=226045&r2=226046&view=diff
==============================================================================
--- llvm/trunk/lib/IR/AsmWriter.cpp (original)
+++ llvm/trunk/lib/IR/AsmWriter.cpp Wed Jan 14 16:14:26 2015
@@ -1291,8 +1291,8 @@ static void writeMDLocation(raw_ostream
const Module *Context) {
Out << "!MDLocation(";
FieldSeparator FS;
- if (DL->getLine())
- Out << FS << "line: " << DL->getLine();
+ // Always output the line, since 0 is a relevant and important value for it.
+ Out << FS << "line: " << DL->getLine();
if (DL->getColumn())
Out << FS << "column: " << DL->getColumn();
Out << FS << "scope: ";
Modified: llvm/trunk/test/Assembler/mdlocation.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Assembler/mdlocation.ll?rev=226046&r1=226045&r2=226046&view=diff
==============================================================================
--- llvm/trunk/test/Assembler/mdlocation.ll (original)
+++ llvm/trunk/test/Assembler/mdlocation.ll Wed Jan 14 16:14:26 2015
@@ -15,6 +15,6 @@
!3 = !MDLocation(scope: !0, inlinedAt: !1, column: 7, line: 3)
!4 = !MDLocation(column: 7, line: 3, scope: !0, inlinedAt: !1)
-; CHECK-NEXT: !3 = !MDLocation(scope: !0)
+; CHECK-NEXT: !3 = !MDLocation(line: 0, scope: !0)
!5 = !MDLocation(scope: !0)
!6 = !MDLocation(scope: !0, column: 0, line: 0)
More information about the llvm-commits
mailing list