[PATCH] D140968: [clang-tidy] Add check for passing the result of `std::string::c_str` to `strlen`

2023-01-09 Thread Alex Coster via Phabricator via cfe-commits
acoster added a comment. In D140968#4029072 , @njames93 wrote: > I don't see the appear of this check as its a situation that I doubt ever > appears in code bases. If there are open source code bases where this is a > known problem can you please provid

[PATCH] D140968: [clang-tidy] Add check for passing the result of `std::string::c_str` to `strlen`

2023-01-05 Thread Alex Coster via Phabricator via cfe-commits
acoster updated this revision to Diff 486582. acoster added a comment. Fix length of comment at the top of StrlenStringCStrCheck.h Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D140968/new/ https://reviews.llvm.org/D140968 Files: clang-tools-extr

[PATCH] D140968: [clang-tidy] Add check for passing the result of `std::string::c_str` to `strlen`

2023-01-05 Thread Alex Coster via Phabricator via cfe-commits
acoster marked 12 inline comments as done. acoster added inline comments. Comment at: clang-tools-extra/docs/clang-tidy/checks/readability/strlen-string-cstr.rst:24 + +.. option:: EnableForDataMethod + carlosgalvezp wrote: > Is there a use case for wanting this

[PATCH] D140968: [clang-tidy] Add check for passing the result of `std::string::c_str` to `strlen`

2023-01-05 Thread Alex Coster via Phabricator via cfe-commits
acoster updated this revision to Diff 486504. acoster added a comment. Generlised the check to cover string_view and "string-like" classes Removed the option of ignoring `data()`, and generalised the check to suggest fixes if the result of `data()` or `c_str()` method of any class with a public `

[PATCH] D140968: [clang-tidy] Add check for passing the result of `std::string::c_str` to `strlen`

2023-01-04 Thread Alex Coster via Phabricator via cfe-commits
acoster created this revision. Herald added subscribers: carlosgalvezp, xazax.hun. Herald added a reviewer: njames93. Herald added a project: All. acoster requested review of this revision. Herald added a project: clang-tools-extra. Herald added a subscriber: cfe-commits. Suggests replacing the ca