[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}
authorKazu Hirata <kazu@google.com>
Sat, 15 Oct 2022 22:06:37 +0000 (15:06 -0700)
committerKazu Hirata <kazu@google.com>
Sat, 15 Oct 2022 22:06:37 +0000 (15:06 -0700)
commit1b97645e56bf321b06d1353024339958b64fd242
tree8847061a98e56a2e254a3efac5c0d27a82dbfa5d
parente323a904dce5bf248affef811791f4f8d4d45f02
[ADT] Introduce StringRef::{starts,ends}_width{,_insensitive}

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.

Differential Revision: https://reviews.llvm.org/D136030
llvm/include/llvm/ADT/StringRef.h
llvm/lib/Support/StringRef.cpp
llvm/unittests/ADT/StringRefTest.cpp