[PATCH] D148353: [StringView] remove ctor incompatible with std::string_view

Nick Desaulniers via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Apr 14 11:11:05 PDT 2023


nickdesaulniers marked 2 inline comments as done.
nickdesaulniers added inline comments.


================
Comment at: llvm/include/llvm/Demangle/Utility.h:67
 
-    return operator+=(StringView(TempPtr, Temp.data() + Temp.size()));
   }
----------------
erichkeane wrote:
> nickdesaulniers wrote:
> > nickdesaulniers wrote:
> > > erichkeane wrote:
> > > > nickdesaulniers wrote:
> > > > > This is the change that's breaking the tests...
> > > > `TempPtr` is not necessarily the Temp.data location, it looks like it is modified a h andful of times on line 59 and 65.  
> > > > 
> > > > So this is meant to be a 'rest' kinda thing, but the code you changed it to is using the whole 'size'.  I think you need to make `Temp.size()` be `Temp.size() - std::distance(Temp.data(), TempPtr);` (check for off-by-1 please :D).
> > > probably should be `Temp.data() + Temp.size() - TempPtr`
> > > (check for off-by-1 please :D).
> > 
> > was there some additional check you wanted me to add here?
> Ah, no, just check for an off-by-1 error in my suggestion (don't just use it).  
LGTM


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D148353/new/

https://reviews.llvm.org/D148353



More information about the llvm-commits mailing list