[PATCH] D57379: X86AsmParser: Do not process a non-existent token

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Mar 25 20:11:26 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL356972: X86AsmParser: Do not process a non-existent token (authored by ctopper, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D57379?vs=191279&id=192240#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D57379/new/

https://reviews.llvm.org/D57379

Files:
  llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
  llvm/trunk/test/MC/AsmParser/unfinished-op.s
  llvm/trunk/test/MC/X86/x86_operands.s


Index: llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ llvm/trunk/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -2992,6 +2992,11 @@
   case Match_MnemonicFail:
     break;
   }
+  if (Op.getToken().empty()) {
+    Error(IDLoc, "instruction must have size higher than 0", EmptyRange,
+          MatchingInlineAsm);
+    return true;
+  }
 
   // FIXME: Ideally, we would only attempt suffix matches for things which are
   // valid prefixes, and we could just infer the right unambiguous
Index: llvm/trunk/test/MC/AsmParser/unfinished-op.s
===================================================================
--- llvm/trunk/test/MC/AsmParser/unfinished-op.s
+++ llvm/trunk/test/MC/AsmParser/unfinished-op.s
@@ -0,0 +1,4 @@
+# RUN: not llvm-mc -triple i386-unknown-unknown %s 2>&1 > /dev/null| FileCheck %s --check-prefix=CHECK-ERROR
+
+#CHECK-ERROR: error: instruction must have size higher than 0
+    .byte 64;""
Index: llvm/trunk/test/MC/X86/x86_operands.s
===================================================================
--- llvm/trunk/test/MC/X86/x86_operands.s
+++ llvm/trunk/test/MC/X86/x86_operands.s
@@ -9,7 +9,7 @@
         addl $a, %eax
 # CHECK: addl $3, %eax
         addl $1 + 2, %eax
-        
+
 # Disambiguation
 
 # CHECK: addl $1, 8
@@ -26,7 +26,7 @@
         addl $1, (%eax)
 # CHECK: addl $1, 8(,%eax)
         addl $1, (4+4)(,%eax)
-        
+
 # Indirect Memory Operands
 # CHECK: addl $1, 1(%eax)
         addl $1, 1(%eax)


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57379.192240.patch
Type: text/x-patch
Size: 1581 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190326/3af76965/attachment.bin>


More information about the llvm-commits mailing list