[PATCH] D104218: [ADT] Add StringRef consume_front_lower and consume_back_lower

Martin Storsjö via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue Jun 15 22:13:36 PDT 2021


mstorsjo added a comment.

In D104218#2820315 <https://reviews.llvm.org/D104218#2820315>, @lattner wrote:

> Oh, I completely missed that.  I would recommend using the word case_insensitive here.  I don't think stringref has any other case insensitive support, and I don't think this is the obvious place to start.  I would start with case insensitive equality comparison.  Your client can use that as a primitive that it builds higher level functionality on top of.

StringRef does already have a bunch of case insensitive comparisons, and those are already used as primitives that this new method builds on. If it didn't, then clearly this wouldn't be the place to start, but it already has almost complete coverage of case insensitive versions of methods. E.g. `equals_lower`, `compare_lower`, `startswith_lower`, `endswith_lower`, `find_lower`, `rfind_lower`, `contains_lower`. So therefore I'd prefer to add this method to the same naming scheme, even if it isn't entirely obvious (this isn't the place to start deviating from the established pattern).

As `consume_back` is a convenience wrapper over `endswith` and `drop_back`, I'm suggesting to add `consume_back_lower` which builds on `endswith_lower` (and `drop_back`).


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D104218



More information about the llvm-commits mailing list