[llvm] r191471 - MCParser/Debug info: Accept line number 0 as a legitimate value, since

Adrian Prantl aprantl at apple.com
Thu Sep 26 16:37:11 PDT 2013


Author: adrian
Date: Thu Sep 26 18:37:11 2013
New Revision: 191471

URL: http://llvm.org/viewvc/llvm-project?rev=191471&view=rev
Log:
MCParser/Debug info: Accept line number 0 as a legitimate value, since
CFE produces it to indicate artificial locations.
c.f.: DWARF standard, Table 6.2:
line -- An unsigned integer indicating a source line number. Lines are numbered beginning at 1. The compiler may emit the value 0 in cases where an instruction cannot be attributed to any source line.

Modified:
    llvm/trunk/lib/MC/MCParser/AsmParser.cpp
    llvm/trunk/test/MC/AsmParser/directive_loc.s

Modified: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/MC/MCParser/AsmParser.cpp?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp (original)
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp Thu Sep 26 18:37:11 2013
@@ -2634,8 +2634,8 @@ bool AsmParser::parseDirectiveLoc() {
   int64_t LineNumber = 0;
   if (getLexer().is(AsmToken::Integer)) {
     LineNumber = getTok().getIntVal();
-    if (LineNumber < 1)
-      return TokError("line number less than one in '.loc' directive");
+    if (LineNumber < 0)
+      return TokError("line number less than zero in '.loc' directive");
     Lex();
   }
 

Modified: llvm/trunk/test/MC/AsmParser/directive_loc.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/AsmParser/directive_loc.s?rev=191471&r1=191470&r2=191471&view=diff
==============================================================================
--- llvm/trunk/test/MC/AsmParser/directive_loc.s (original)
+++ llvm/trunk/test/MC/AsmParser/directive_loc.s Thu Sep 26 18:37:11 2013
@@ -6,3 +6,4 @@
         .loc 1 2
         .loc 1 2 3
         .loc 1 2 discriminator 1
+        .loc 1 0





More information about the llvm-commits mailing list