This is an archive of the discontinued LLVM Phabricator instance.

[NFC][ADT] Tweaked some functions in StringRef
ClosedPublic

Authored by sunshaoce on Feb 25 2023, 8:33 AM.

Details

Summary

Reduced the usage of variables in the rfind and count functions.

Replaced calls to drop_front with direct use of substr in consume_front,
since starts_with already performs length check on the string. Did the same
for other functions.

Using the std::clamp in slice makes the code more straightforward.

Diff Detail

Event Timeline

sunshaoce created this revision.Feb 25 2023, 8:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2023, 8:33 AM
sunshaoce requested review of this revision.Feb 25 2023, 8:33 AM
Herald added a project: Restricted Project. · View Herald TranscriptFeb 25 2023, 8:33 AM
bkramer accepted this revision.Mar 16 2023, 10:11 AM

looks good

This revision is now accepted and ready to land.Mar 16 2023, 10:11 AM
This revision was landed with ongoing or failed builds.Mar 16 2023, 10:45 AM
This revision was automatically updated to reflect the committed changes.