[all-commits] [llvm/llvm-project] febd89: [clang-tidy] check `std::string_view` and custom s...

Vadim D. via All-commits all-commits at lists.llvm.org
Thu May 9 01:25:47 PDT 2024


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: febd89cafea11e6603f593e41be1a21ca9d009ac
      https://github.com/llvm/llvm-project/commit/febd89cafea11e6603f593e41be1a21ca9d009ac
  Author: Vadim D <36827317+vvd170501 at users.noreply.github.com>
  Date:   2024-05-09 (Thu, 09 May 2024)

  Changed paths:
    M clang-tools-extra/clang-tidy/readability/StringCompareCheck.cpp
    M clang-tools-extra/clang-tidy/readability/StringCompareCheck.h
    M clang-tools-extra/docs/ReleaseNotes.rst
    M clang-tools-extra/docs/clang-tidy/checks/readability/string-compare.rst
    M clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
    A clang-tools-extra/test/clang-tidy/checkers/readability/string-compare-custom-string-classes.cpp
    M clang-tools-extra/test/clang-tidy/checkers/readability/string-compare.cpp

  Log Message:
  -----------
  [clang-tidy] check `std::string_view` and custom string-like classes in `readability-string-compare` (#88636)

This PR aims to expand the list of classes that are considered to be
"strings" by `readability-string-compare` check.

1. Currently only `std::string;:compare` is checked, but
`std::string_view` has a similar `compare` method. This PR enables
checking of `std::string_view::compare` by default.
2. Some codebases use custom string-like classes that have public
interfaces similar to `std::string` or `std::string_view`. Example:
[TStringBase](https://github.com/yandex/yatool/blob/main/util/generic/strbase.h#L38),
A new option, `readability-string-compare.StringClassNames`, is added to
allow specifying a custom list of string-like classes.

Related to, but does not solve #28396 (only adds support for custom
string-like classes, not custom functions)



To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications


More information about the All-commits mailing list