[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:20:32 PDT 2018


apazos updated this revision to Diff 162526.

https://reviews.llvm.org/D50808

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


Index: test/Assembler/empty-string.s
===================================================================
--- /dev/null
+++ 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: lib/MC/MCParser/AsmParser.cpp
===================================================================
--- lib/MC/MCParser/AsmParser.cpp
+++ 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.162526.patch
Type: text/x-patch
Size: 872 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180825/71d61c57/attachment.bin>


More information about the llvm-commits mailing list