mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-02-17 02:38:16 +00:00
ARM: improve diagnostics for .word directive
If a complex expression was passed to the .word directive and the first part of the directive failed to parse, a secondary diagnostic would be produced that would clutter the error diagnostics. Improve the diagnostics by consuming the remainder of the statement. llvm-svn: 200160
This commit is contained in:
parent
254ffbe584
commit
bad8eceeeb
@ -8093,8 +8093,10 @@ bool ARMAsmParser::parseDirectiveWord(unsigned Size, SMLoc L) {
|
||||
if (getLexer().isNot(AsmToken::EndOfStatement)) {
|
||||
for (;;) {
|
||||
const MCExpr *Value;
|
||||
if (getParser().parseExpression(Value))
|
||||
if (getParser().parseExpression(Value)) {
|
||||
Parser.eatToEndOfStatement();
|
||||
return false;
|
||||
}
|
||||
|
||||
getParser().getStreamer().EmitValue(Value, Size);
|
||||
|
||||
|
12
test/MC/ARM/directive-word-diagnostics.s
Normal file
12
test/MC/ARM/directive-word-diagnostics.s
Normal file
@ -0,0 +1,12 @@
|
||||
@ RUN: not llvm-mc -triple armv7-eabi -filetype asm -o /dev/null 2>&1 %s \
|
||||
@ RUN: | FileCheck %s
|
||||
|
||||
.cpu armv7
|
||||
|
||||
.type double_diagnostics,%function
|
||||
double_diagnostics:
|
||||
.word invalid(invalid) + 32
|
||||
|
||||
@ CHECK: error: invalid variant 'invalid'
|
||||
@ CHECK-NOT: error: unexpected token at start of statement
|
||||
|
Loading…
x
Reference in New Issue
Block a user