From 9492802a378b616240bc506dad8b736a759c2e2c Mon Sep 17 00:00:00 2001 From: Saleem Abdulrasool Date: Fri, 30 Jan 2015 18:42:10 +0000 Subject: [PATCH] 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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@227595 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/ARM/AsmParser/ARMAsmParser.cpp | 3 ++- test/MC/ARM/directive-fpu-diagnostics.s | 10 ++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) create mode 100644 test/MC/ARM/directive-fpu-diagnostics.s diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp index 96f3b4e6432..2de0ffa5ec6 100644 --- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp +++ b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp @@ -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(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; } diff --git a/test/MC/ARM/directive-fpu-diagnostics.s b/test/MC/ARM/directive-fpu-diagnostics.s new file mode 100644 index 00000000000..67c61298221 --- /dev/null +++ b/test/MC/ARM/directive-fpu-diagnostics.s @@ -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: ^ -- 2.34.1