forked from OSchip/llvm-project
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
077fd251fd
commit
a25e1e4ebe
|
@ -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 + "'");
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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: ^
|
|
@ -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…
Reference in New Issue