[all-commits] [llvm/llvm-project] 56686e: [NFC][ADT] Tweaked some functions in StringRef

Shao-Ce SUN via All-commits all-commits at lists.llvm.org
Thu Mar 16 10:45:42 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: 56686ec47ee0cc9baf45c0149f63b3ec8ecdb940
      https://github.com/llvm/llvm-project/commit/56686ec47ee0cc9baf45c0149f63b3ec8ecdb940
  Author: Shao-Ce SUN <sunshaoce at iscas.ac.cn>
  Date:   2023-03-17 (Fri, 17 Mar 2023)

  Changed paths:
    M llvm/include/llvm/ADT/StringRef.h

  Log Message:
  -----------
  [NFC][ADT] Tweaked some functions in StringRef

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.

Reviewed By: bkramer

Differential Revision: https://reviews.llvm.org/D144787




More information about the All-commits mailing list