[all-commits] [llvm/llvm-project] ef5906: [clang-tidy][modernize-use-starts-ends-with] Add s...
Nicolas van Kempen via All-commits
all-commits at lists.llvm.org
Tue Apr 23 14:35:28 PDT 2024
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: ef5906989ae2004100ff56dc5ab59be2be9d5c99
https://github.com/llvm/llvm-project/commit/ef5906989ae2004100ff56dc5ab59be2be9d5c99
Author: Nicolas van Kempen <nvankemp at gmail.com>
Date: 2024-04-23 (Tue, 23 Apr 2024)
Changed paths:
M clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp
M clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.h
M clang-tools-extra/docs/ReleaseNotes.rst
M clang-tools-extra/docs/clang-tidy/checks/modernize/use-starts-ends-with.rst
M clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string
M clang-tools-extra/test/clang-tidy/checkers/Inputs/Headers/string.h
M clang-tools-extra/test/clang-tidy/checkers/abseil/redundant-strcat-calls.cpp
M clang-tools-extra/test/clang-tidy/checkers/modernize/use-starts-ends-with.cpp
Log Message:
-----------
[clang-tidy][modernize-use-starts-ends-with] Add support for compare() (#89530)
Using `compare` is the next most common roundabout way to express
`starts_with` before it was added to the standard. In this case, using
`starts_with` is a readability improvement. Extend existing
`modernize-use-starts-ends-with` to cover this case.
```
// The following will now be replaced by starts_with().
string.compare(0, strlen("prefix"), "prefix") == 0;
string.compare(0, 6, "prefix") == 0;
string.compare(0, prefix.length(), prefix) == 0;
string.compare(0, prefix.size(), prefix) == 0;
```
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