[clang-tools-extra] [clang-tidy] Speed up `readability-container-contains` (PR #175121)

Baranov Victor via cfe-commits cfe-commits at lists.llvm.org
Fri Jan 23 05:15:00 PST 2026


vbvictor wrote:

> See lambda `AddSimpleMatcher` deleted by this PR, which uses `TK_IgnoreUnlessSpelledInSource`. Traversal mode of each matcher doesn't change.

Oh, actually I missed that we already had `IgnoreUnless` in `AddSimpleMatcher`. So this could be an NFC change.

> I don't get it. How the case is broken? Changing traversal mode? Did I miss anything?

As I understand, we didn't break anything with current patch. However, the check had FN before: e.g. https://godbolt.org/z/459M3EaTe: even if `returnContains` is instantiated inside `main` function, it doesn't give warning there. If the matcher used `AsIs` mode, then we ~would~ should get the warning.


https://github.com/llvm/llvm-project/pull/175121


More information about the cfe-commits mailing list