mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2025-03-05 10:57:32 +00:00
AsmParser: improve diagnostics for invalid variants
An emitted diagnostic for an invalid relocation variant would place the caret on the token following the relocation variant indicator or at the end of the line if there was no following token. This change corrects the placement of the caret to point to the token. llvm-svn: 200159
This commit is contained in:
parent
31387685d9
commit
254ffbe584
@ -836,7 +836,8 @@ bool AsmParser::parsePrimaryExpr(const MCExpr *&Res, SMLoc &EndLoc) {
|
||||
Variant = MCSymbolRefExpr::VK_None;
|
||||
} else {
|
||||
Variant = MCSymbolRefExpr::VK_None;
|
||||
return TokError("invalid variant '" + Split.second + "'");
|
||||
return Error(SMLoc::getFromPointer(Split.second.begin()),
|
||||
"invalid variant '" + Split.second + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
11
test/MC/AsmParser/variant-diagnostics-2.s
Normal file
11
test/MC/AsmParser/variant-diagnostics-2.s
Normal file
@ -0,0 +1,11 @@
|
||||
# RUN: not llvm-mc -triple i386-linux-gnu -filetype asm -o /dev/null 2>&1 %s \
|
||||
# RUN: | FileCheck %s
|
||||
|
||||
.text
|
||||
|
||||
function:
|
||||
call external@invalid
|
||||
|
||||
# CHECK: error: invalid variant 'invalid'
|
||||
# CHECK: call external@invalid
|
||||
# CHECK: ^
|
13
test/MC/AsmParser/variant-diagnostics.s
Normal file
13
test/MC/AsmParser/variant-diagnostics.s
Normal file
@ -0,0 +1,13 @@
|
||||
@ RUN: not llvm-mc -triple armv7-linux-eabi -filetype asm -o /dev/null 2>&1 %s \
|
||||
@ RUN: | FileCheck %s
|
||||
|
||||
.arch armv7
|
||||
|
||||
.type invalid_variant,%function
|
||||
invalid_variant:
|
||||
bx target(invalid)
|
||||
|
||||
@ CHECK: error: invalid variant 'invalid'
|
||||
@ CHECK: bx target(invalid)
|
||||
@ CHECK: ^
|
||||
|
Loading…
x
Reference in New Issue
Block a user