[PATCH] D50808: [MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"'

Ana Pazos via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 18:36:12 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL340678: [MC, RISCV] Fixed StringRef Assertion `Index < Length && "Invalid index!"' (authored by apazos, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D50808?vs=162526&id=162532#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D50808

Files:
  llvm/trunk/lib/MC/MCParser/AsmParser.cpp
  llvm/trunk/test/Assembler/empty-string.s


Index: llvm/trunk/test/Assembler/empty-string.s
===================================================================
--- llvm/trunk/test/Assembler/empty-string.s
+++ llvm/trunk/test/Assembler/empty-string.s
@@ -0,0 +1,3 @@
+// REQUIRES: riscv-registered-target
+// RUN: not llvm-mc -triple riscv32-unknown-linux-gnu < %s 2>&1 | FileCheck %s
+"" # CHECK: error: unrecognized instruction mnemonic
Index: llvm/trunk/lib/MC/MCParser/AsmParser.cpp
===================================================================
--- llvm/trunk/lib/MC/MCParser/AsmParser.cpp
+++ llvm/trunk/lib/MC/MCParser/AsmParser.cpp
@@ -1842,7 +1842,7 @@
   // Otherwise, we have a normal instruction or directive.
 
   // Directives start with "."
-  if (IDVal[0] == '.' && IDVal != ".") {
+  if (IDVal.startswith(".") && IDVal != ".") {
     // There are several entities interested in parsing directives:
     //
     // 1. The target-specific assembly parser. Some directives are target


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D50808.162532.patch
Type: text/x-patch
Size: 958 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180825/df2b491f/attachment.bin>


More information about the llvm-commits mailing list