MCParser/Debug info: Accept line number 0 as a legitimate value, since
authorAdrian Prantl <aprantl@apple.com>
Thu, 26 Sep 2013 23:37:11 +0000 (23:37 +0000)
committerAdrian Prantl <aprantl@apple.com>
Thu, 26 Sep 2013 23:37:11 +0000 (23:37 +0000)
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.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@191471 91177308-0d34-0410-b5e6-96231b3b80d8

lib/MC/MCParser/AsmParser.cpp
test/MC/AsmParser/directive_loc.s

index e36850beb8274f311fcf3c93c7e4324e41616e87..9854b07a6c43b058422aaec94d2afcc960c7ce5a 100644 (file)
@@ -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();
   }
 
index 164d42a3fa7c080ca3ff9bab9b3e29124c524149..700a32ca389fa07579dd320d52111c4e38f687bd 100644 (file)
@@ -6,3 +6,4 @@
         .loc 1 2
         .loc 1 2 3
         .loc 1 2 discriminator 1
+        .loc 1 0