This is an archive of the discontinued LLVM Phabricator instance.

[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}
ClosedPublic

Authored by kazu on Oct 15 2022, 2:24 PM.

Details

Summary

This patch introduces:

StringRef::starts_with
StringRef::starts_with_insensitive
StringRef::ends_with
StringRef::ends_with_insensitive

to be more compatible with std::string and std::string_view.

I'm planning to deprecate the existing functions in favor of the new
ones.

Diff Detail

Event Timeline

kazu created this revision.Oct 15 2022, 2:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2022, 2:24 PM
Herald added a subscriber: hiraditya. · View Herald Transcript
kazu requested review of this revision.Oct 15 2022, 2:24 PM
Herald added a project: Restricted Project. · View Herald TranscriptOct 15 2022, 2:24 PM
MaskRay accepted this revision.Oct 15 2022, 2:42 PM

LGTM.

This revision is now accepted and ready to land.Oct 15 2022, 2:42 PM
This revision was landed with ongoing or failed builds.Oct 15 2022, 3:06 PM
This revision was automatically updated to reflect the committed changes.

I'm planning to deprecate the existing functions in favor of the new ones.

This landed 7 months ago and no deprecations have materialized. There are 58 uses of endswith_insensitive, there are uses 9 of ends_with_insensitive (all of which were introduced in this patch). 71 and 9 for startswith_insensitive vs starts_with_insensitive. What is the plan for cleaning this up? Alternatively, can we revert this patch as it doesn't seem particularly motivated?

kazu added a comment.May 11 2023, 10:46 PM

I'm planning to deprecate the existing functions in favor of the new ones.

This landed 7 months ago and no deprecations have materialized. There are 58 uses of endswith_insensitive, there are uses 9 of ends_with_insensitive (all of which were introduced in this patch). 71 and 9 for startswith_insensitive vs starts_with_insensitive. What is the plan for cleaning this up? Alternatively, can we revert this patch as it doesn't seem particularly motivated?

Oops. Apparently I dropped the ball. Let me migrate startswith_insensitive and endswith_insensitive.

I'm planning to deprecate the existing functions in favor of the new ones.

This landed 7 months ago and no deprecations have materialized. There are 58 uses of endswith_insensitive, there are uses 9 of ends_with_insensitive (all of which were introduced in this patch). 71 and 9 for startswith_insensitive vs starts_with_insensitive. What is the plan for cleaning this up? Alternatively, can we revert this patch as it doesn't seem particularly motivated?

Oops. Apparently I dropped the ball. Let me migrate startswith_insensitive and endswith_insensitive.

Thank you!