[MC] Add parseEOL() overload and migrate some parseToken(AsmToken::EndOfStatement...
authorFangrui Song <i@maskray.me>
Sun, 7 Mar 2021 01:45:23 +0000 (17:45 -0800)
committerFangrui Song <i@maskray.me>
Sun, 7 Mar 2021 01:45:23 +0000 (17:45 -0800)
commitbb6732cf622522f17dad948279ba4f68e3bd55e1
tree4b3a6a4a7ebeba09412e5e3a48b296b0e03849f2
parente5eb3e3836a7d5ad86cb6e3ee991600622eb0f82
[MC] Add parseEOL() overload and migrate some parseToken(AsmToken::EndOfStatement) to parseEOL()

For many directives, the following diagnostics

* `error: unexpected token`
* `error: unexpected token in '.abort' directive"`

are replaced with `error: expected newline`.

`unexpected token` may make the user think a different token is needed.
`expected newline` is clearer about the expected token.

For `in '...' directive`, the directive name is not useful because the next line
replicates the error line which includes the directive.
llvm/include/llvm/MC/MCParser/MCAsmParser.h
llvm/lib/MC/MCParser/AsmParser.cpp
llvm/lib/MC/MCParser/MCAsmParser.cpp
llvm/test/MC/ARM/directive_parsing.s
llvm/test/MC/ARM/thumb_set-diagnostics.s
llvm/test/MC/AsmParser/AArch64/directive-parse-err.s
llvm/test/MC/AsmParser/directive_incbin.s
llvm/test/MC/AsmParser/if-diagnostics.s
llvm/test/MC/ELF/cfi.s