[PATCH] D83305: [ADT] Fix join_impl using the wrong size when calculating total length

Nathan James via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jul 7 07:11:48 PDT 2020


njames93 created this revision.
njames93 added reviewers: joerg, chandlerc.
Herald added subscribers: llvm-commits, dexonsmith.
Herald added a project: LLVM.

Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D83305

Files:
  llvm/include/llvm/ADT/StringExtras.h


Index: llvm/include/llvm/ADT/StringExtras.h
===================================================================
--- llvm/include/llvm/ADT/StringExtras.h
+++ llvm/include/llvm/ADT/StringExtras.h
@@ -338,7 +338,7 @@
 
   size_t Len = (std::distance(Begin, End) - 1) * Separator.size();
   for (IteratorT I = Begin; I != End; ++I)
-    Len += (*Begin).size();
+    Len += I->size();
   S.reserve(Len);
   S += (*Begin);
   while (++Begin != End) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D83305.276052.patch
Type: text/x-patch
Size: 445 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20200707/f2791901/attachment.bin>


More information about the llvm-commits mailing list