diff options
author | Nicolas van Kempen <nvankemp@gmail.com> | 2024-04-23 17:35:05 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-04-23 23:35:05 +0200 |
commit | ef5906989ae2004100ff56dc5ab59be2be9d5c99 (patch) | |
tree | 29b90b8cfc5806cb67321b6c534665bfbee8e727 /clang/lib/CodeGen/CodeGenModule.cpp | |
parent | 5ac744d72ad2a8d04e0ae869c4e30558dd8058e3 (diff) | |
download | llvm-ef5906989ae2004100ff56dc5ab59be2be9d5c99.zip llvm-ef5906989ae2004100ff56dc5ab59be2be9d5c99.tar.gz llvm-ef5906989ae2004100ff56dc5ab59be2be9d5c99.tar.bz2 |
[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;
```
Diffstat (limited to 'clang/lib/CodeGen/CodeGenModule.cpp')
0 files changed, 0 insertions, 0 deletions