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

Reid Kleckner via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 24 17:34:34 PDT 2018


rnk accepted this revision.
rnk added a comment.
This revision is now accepted and ready to land.

lgtm



================
Comment at: lib/MC/MCParser/AsmParser.cpp:1845
   // Directives start with "."
-  if (IDVal[0] == '.' && IDVal != ".") {
+  if (IDVal.size() && IDVal[0] == '.' && IDVal != ".") {
     // There are several entities interested in parsing directives:
----------------
I'd probably spell it `IDVal.startswith(".")` for readability.


https://reviews.llvm.org/D50808





More information about the llvm-commits mailing list