[clang-tools-extra] [clang-tidy][readability-container-contains] Extend to any class with contains (PR #107521)
Nicolas van Kempen via cfe-commits
cfe-commits at lists.llvm.org
Wed Sep 11 22:01:17 PDT 2024
nicovank wrote:
> ... and is sufficiently visible.
I added `isPublic`, I think the false negatives where we are in another private method would be exceedingly rare so I don't think handling that case is necessary.
> check if the type of the parameter from the called method and that of the `contains function` are equal.
Checking types turns out is very tricky because of casting, conversions, references, pointers, amplified by template types which these classes typically have. Is there any other checks doing this? I wrote a version that works but adds some complexity. On llvm-project, there are 5 cases not matched by this version that previously were without checking types (546/551), still investigating what's going on with those.
FWIW in `modernize-use-starts-ends-with` I didn't add type-checking: [UseStartsEndsWithCheck.cpp#L26-L30](https://github.com/llvm/llvm-project/blob/b3f3c0c63358b412348022d10308b97332d02bcd/clang-tools-extra/clang-tidy/modernize/UseStartsEndsWithCheck.cpp#L26-L30).
https://github.com/llvm/llvm-project/pull/107521
More information about the cfe-commits
mailing list