Revision tags: llvmorg-21-init, llvmorg-19.1.7, llvmorg-19.1.6, llvmorg-19.1.5 |
|
#
2f02b5af |
| 27-Nov-2024 |
Nicolas van Kempen <nvankemp@gmail.com> |
[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative (#117837)
In C++20, `operator!=` can be rewritten by negating `operator==`. This is the case for `std::string`, whe
[clang-tidy][modernize-use-starts-ends-with] Fix operator rewriting false negative (#117837)
In C++20, `operator!=` can be rewritten by negating `operator==`. This is the case for `std::string`, where `operator!=` is not provided hence relying on this rewriting.
Cover this case by matching `binaryOperation` and adding one case to `isNegativeComparison`.
show more ...
|
#
50844828 |
| 27-Nov-2024 |
Helmut Januschka <helmut@januschka.com> |
[clang-tidy] Enhance modernize-use-starts-ends-with to handle substr patterns (#116033)
Enhances the modernize-use-starts-ends-with check to detect additional patterns using substr that can be repla
[clang-tidy] Enhance modernize-use-starts-ends-with to handle substr patterns (#116033)
Enhances the modernize-use-starts-ends-with check to detect additional patterns using substr that can be replaced with starts_with() (C++20). This enhancement improves code readability and can be more efficient by avoiding temporary string creation.
show more ...
|
Revision tags: llvmorg-19.1.4, llvmorg-19.1.3 |
|
#
18b50189 |
| 18-Oct-2024 |
Julian Schmidt <git.julian.schmidt@gmail.com> |
[clang-tidy] rewrite matchers in modernize-use-starts-ends-with (#112101)
Rewrite the AST matchers for slightly more composability.
Furthermore, check that the `starts_with` and `ends_with`
funct
[clang-tidy] rewrite matchers in modernize-use-starts-ends-with (#112101)
Rewrite the AST matchers for slightly more composability.
Furthermore, check that the `starts_with` and `ends_with`
functions return a `bool`.
There is one behavioral change, in that the methods of a class (and
transitive classes) are searched once for a matching
`starts_with`/`ends_with` function, picking the first it can find.
Previously, the matchers would try to find `starts_with`, then
`startsWith`, and finally, `startswith`. Now, the first of the three
that
is encountered will be the matched method.
---------
Co-authored-by: Nicolas van Kempen <nvankemp@gmail.com>
show more ...
|
Revision tags: llvmorg-19.1.2 |
|
#
f1367a47 |
| 12-Oct-2024 |
Nicolas van Kempen <nvankemp@gmail.com> |
[clang-tidy][modernize-use-starts-ends-with] Add support for two ends_with patterns (#110448)
Add support for the following two patterns:
```
haystack.compare(haystack.length() - needle.length(),
[clang-tidy][modernize-use-starts-ends-with] Add support for two ends_with patterns (#110448)
Add support for the following two patterns:
```
haystack.compare(haystack.length() - needle.length(), needle.length(), needle) == 0;
haystack.rfind(needle) == (haystack.size() - needle.size());
```
show more ...
|
Revision tags: llvmorg-19.1.1, llvmorg-19.1.0, llvmorg-19.1.0-rc4, llvmorg-19.1.0-rc3, llvmorg-19.1.0-rc2, llvmorg-19.1.0-rc1, llvmorg-20-init, llvmorg-18.1.8, llvmorg-18.1.7, llvmorg-18.1.6, llvmorg-18.1.5 |
|
#
ef590698 |
| 23-Apr-2024 |
Nicolas van Kempen <nvankemp@gmail.com> |
[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.
[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;
```
show more ...
|
Revision tags: llvmorg-18.1.4, llvmorg-18.1.3, llvmorg-18.1.2, llvmorg-18.1.1, llvmorg-18.1.0, llvmorg-18.1.0-rc4, llvmorg-18.1.0-rc3, llvmorg-18.1.0-rc2, llvmorg-18.1.0-rc1, llvmorg-19-init |
|
#
bc8cff1d |
| 04-Dec-2023 |
Nicolas van Kempen <nvankempen@meta.com> |
[clang-tidy] Add new modernize-use-starts-ends-with check (#72385)
Make a modernize version of abseil-string-find-startswith using the
available C++20 `std::string::starts_with` and
`std::string_v
[clang-tidy] Add new modernize-use-starts-ends-with check (#72385)
Make a modernize version of abseil-string-find-startswith using the
available C++20 `std::string::starts_with` and
`std::string_view::starts_with`. Following up from
https://github.com/llvm/llvm-project/pull/72283.
show more ...
|