ARM: improve caret diagnostics for invalid FPU name

In the case of an invalid FPU name, place the caret at the name rather than FPU
directive.

llvm-svn: 227595
This commit is contained in:
Saleem Abdulrasool 2015-01-30 18:42:10 +00:00
parent f290870a28
commit 1c30aa1d0c
2 changed files with 12 additions and 1 deletions

View File

@ -9229,6 +9229,7 @@ static const struct {
/// parseDirectiveFPU
/// ::= .fpu str
bool ARMAsmParser::parseDirectiveFPU(SMLoc L) {
SMLoc FPUNameLoc = getTok().getLoc();
StringRef FPU = getParser().parseStringToEndOfStatement().trim();
unsigned ID = StringSwitch<unsigned>(FPU)
@ -9237,7 +9238,7 @@ bool ARMAsmParser::parseDirectiveFPU(SMLoc L) {
.Default(ARM::INVALID_FPU);
if (ID == ARM::INVALID_FPU) {
Error(L, "Unknown FPU name");
Error(FPUNameLoc, "Unknown FPU name");
return false;
}

View File

@ -0,0 +1,10 @@
@ RUN: not llvm-mc -triple armv7 -filetype asm -o /dev/null %s 2>&1 \
@ RUN: | FileCheck %s -strict-whitespace
.text
.thumb
.fpu invalid
@ CHECK: error: Unknown FPU name
@ CHECK: .fpu invalid
@ CHECK: ^