diff options
author | Kevin Enderby <enderby@apple.com> | 2010-08-24 21:14:47 +0000 |
---|---|---|
committer | Kevin Enderby <enderby@apple.com> | 2010-08-24 21:14:47 +0000 |
commit | 6d8f1a9a18f07ec099d6f6e9e8e9376e6885c8ea (patch) | |
tree | 20d3f7b80f85db534136fd44deaff26eae853bf6 /lib | |
parent | 82c84fdd23669d23c02a07498c83b83702979829 (diff) | |
download | external_llvm-6d8f1a9a18f07ec099d6f6e9e8e9376e6885c8ea.zip external_llvm-6d8f1a9a18f07ec099d6f6e9e8e9376e6885c8ea.tar.gz external_llvm-6d8f1a9a18f07ec099d6f6e9e8e9376e6885c8ea.tar.bz2 |
Change the parsing of .loc back to allow the LineNumber field to be optional as
it is with other assemblers.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111967 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib')
-rw-r--r-- | lib/MC/MCParser/AsmParser.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/lib/MC/MCParser/AsmParser.cpp b/lib/MC/MCParser/AsmParser.cpp index c65becf..f83cd5e 100644 --- a/lib/MC/MCParser/AsmParser.cpp +++ b/lib/MC/MCParser/AsmParser.cpp @@ -1838,7 +1838,7 @@ bool GenericAsmParser::ParseDirectiveLine(StringRef, SMLoc DirectiveLoc) { /// ParseDirectiveLoc -/// ::= .loc FileNumber LineNumber [ColumnPos] [basic_block] [prologue_end] +/// ::= .loc FileNumber [LineNumber] [ColumnPos] [basic_block] [prologue_end] /// [epilogue_begin] [is_stmt VALUE] [isa VALUE] /// The first number is a file number, must have been previously assigned with /// a .file directive, the second number is the line number and optionally the @@ -1855,12 +1855,13 @@ bool GenericAsmParser::ParseDirectiveLoc(StringRef, SMLoc DirectiveLoc) { return TokError("unassigned file number in '.loc' directive"); Lex(); - if (getLexer().isNot(AsmToken::Integer)) - return TokError("unexpected token in '.loc' directive"); - int64_t LineNumber = getTok().getIntVal(); - if (LineNumber < 1) - return TokError("line number less than one in '.loc' directive"); - Lex(); + 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"); + Lex(); + } int64_t ColumnPos = 0; if (getLexer().is(AsmToken::Integer)) { |