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.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@200159
91177308-0d34-0410-b5e6-
96231b3b80d8
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 + "'");
}
}
--- /dev/null
+# 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: ^
--- /dev/null
+@ 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: ^
+