[PATCH] D47406: [ADT] Add `StringRef::rsplit(StringRef Separator)`.

Henry Wong via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 7 08:18:31 PDT 2018


MTC added a comment.

In https://reviews.llvm.org/D47406#1120355, @vsk wrote:

> Hi @MTC, thanks for the patch.
>
> With this patch, the logic for split would be duplicated 3 times now in StringRef.h. I think it'd be nice to reuse some code by moving the core logic into a private method of StringRef, say, `splitAtIndex(size_t)`. Then, each (r)split(char | StringRef) can use the common helper.
>
> Relatedly, an rsplit(char) overload seems to be missing here.


Thanks for the review, vsk! I do agree with you that there is need some work to remove the duplicates code. However I think zturner's approach is more neat, what do you think?


Repository:
  rL LLVM

https://reviews.llvm.org/D47406





More information about the llvm-commits mailing list