From bf13dd03e71d1e5ccd30eb4d18e74db221210a61 Mon Sep 17 00:00:00 2001 From: "Duncan P. N. Exon Smith" Date: Wed, 14 Jan 2015 22:14:26 +0000 Subject: [PATCH] IR: Always print MDLocation line Print `MDLocation`'s `line` field even when it's 0. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@226046 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/IR/AsmWriter.cpp | 4 ++-- test/Assembler/mdlocation.ll | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/IR/AsmWriter.cpp b/lib/IR/AsmWriter.cpp index 215332b8256..c494d6ce3f0 100644 --- a/lib/IR/AsmWriter.cpp +++ b/lib/IR/AsmWriter.cpp @@ -1291,8 +1291,8 @@ static void writeMDLocation(raw_ostream &Out, const MDLocation *DL, 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: "; diff --git a/test/Assembler/mdlocation.ll b/test/Assembler/mdlocation.ll index e1216fa2750..c1815ff50e0 100644 --- a/test/Assembler/mdlocation.ll +++ b/test/Assembler/mdlocation.ll @@ -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)