[PATCH] D101032: [SimplifyLibCalls][NFC] Use StringRef::back instead explicit indexing.

Dawid Jurczak via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Apr 22 02:04:56 PDT 2021


yurai007 created this revision.
yurai007 added reviewers: xbolva00, spatel, fhahn, lebedev.ri.
Herald added subscribers: arphaman, hiraditya.
yurai007 requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

Split off from D100724 <https://reviews.llvm.org/D100724>.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D101032

Files:
  llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp


Index: llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
===================================================================
--- llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
+++ llvm/lib/Transforms/Utils/SimplifyLibCalls.cpp
@@ -2386,7 +2386,7 @@
   }
 
   // printf("foo\n") --> puts("foo")
-  if (FormatStr[FormatStr.size() - 1] == '\n' &&
+  if (FormatStr.back() == '\n' &&
       FormatStr.find('%') == StringRef::npos) { // No format characters.
     // Create a string literal with no \n on it.  We expect the constant merge
     // pass to be run after this pass, to merge duplicate strings.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D101032.339519.patch
Type: text/x-patch
Size: 598 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210422/e2d753f4/attachment.bin>


More information about the llvm-commits mailing list