[clang-tools-extra] [clang-tidy] Support find for string-like classes in readability-container-contains (PR #157243)
Nicolas van Kempen via cfe-commits
cfe-commits at lists.llvm.org
Fri Sep 19 21:36:18 PDT 2025
================
@@ -263,6 +263,11 @@ Changes in existing checks
<clang-tidy/checks/portability/template-virtual-member-function>` check to
avoid false positives on pure virtual member functions.
+- Improved :doc:`readability-container-contains
+ <clang-tidy/checks/readability/container-contains>` to support string
+ comparisons to ``npos``. Internal changes may cause new rare false positives
+ in non-standard containers.
----------------
nicovank wrote:
Technically, every static analysis is prone to false positives :) In this case, it would need to be particularly weird code. I can only see it happening on _maybe_ a weird pointer or string container but even then, it would probably be a code smell. Hopefully I'm not proven wrong. The benefit of added true positives IMO outweighs the potential false positives.
https://github.com/llvm/llvm-project/pull/157243
More information about the cfe-commits
mailing list