[PATCH] D31537: [ARM, Asm] Use correct source location for register tokens

Oliver Stannard via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Oct 3 07:32:43 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL314799: [ARM, Asm] Use correct source location for register tokens (authored by olista01).

Changed prior to commit:
  https://reviews.llvm.org/D31537?vs=93649&id=117522#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D31537

Files:
  llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
  llvm/trunk/test/MC/ARM/register-token-source-loc.s


Index: llvm/trunk/test/MC/ARM/register-token-source-loc.s
===================================================================
--- llvm/trunk/test/MC/ARM/register-token-source-loc.s
+++ llvm/trunk/test/MC/ARM/register-token-source-loc.s
@@ -0,0 +1,12 @@
+// RUN: not llvm-mc -triple armv6m--none-eabi < %s 2>&1 | FileCheck %s
+
+// Some of these CHECK lines need to uses regexes to that the amount of
+// whitespace between the start of the line and the caret is significant.
+
+  add sp, r0, #4
+// CHECK: error: invalid instruction, any one of the following would fix this:
+// CHECK: note: instruction requires: thumb2
+// CHECK: note: invalid operand for instruction
+// CHECK-NEXT: {{^  add sp, r0, #4}}
+// CHECK-NEXT: {{^          \^}}
+// CHECK: note: too many operands for instruction
Index: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -3407,13 +3407,13 @@
 /// parse for a specific register type.
 bool ARMAsmParser::tryParseRegisterWithWriteBack(OperandVector &Operands) {
   MCAsmParser &Parser = getParser();
-  const AsmToken &RegTok = Parser.getTok();
+  SMLoc RegStartLoc = Parser.getTok().getLoc();
+  SMLoc RegEndLoc = Parser.getTok().getEndLoc();
   int RegNo = tryParseRegister();
   if (RegNo == -1)
     return true;
 
-  Operands.push_back(ARMOperand::CreateReg(RegNo, RegTok.getLoc(),
-                                           RegTok.getEndLoc()));
+  Operands.push_back(ARMOperand::CreateReg(RegNo, RegStartLoc, RegEndLoc));
 
   const AsmToken &ExclaimTok = Parser.getTok();
   if (ExclaimTok.is(AsmToken::Exclaim)) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D31537.117522.patch
Type: text/x-patch
Size: 1739 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20171003/3e5470d8/attachment.bin>


More information about the llvm-commits mailing list