[clang-tools-extra] [clang-tidy] Speed up `readability-container-contains` (PR #175121)
Baranov Victor via cfe-commits
cfe-commits at lists.llvm.org
Sat Jan 10 21:24:50 PST 2026
vbvictor wrote:
> This PR breaks that case, true. But I hope we can agree that the current behaviour is still not ideal, right? We would like the check to work whether you instantiate the template or not. That would require another PR implementing heuristic name resolution (and I would be happy to write it!).
I think it's not perfectly ideal, but good enough for 99.9..% cases. I think we have dozens of other checks that operate with same logic involving templates. (To find exact number need grep `instantiate()` in test dir).
So if in this case we get a lot of perf benefit - worth doing `IgnoreUnless..`, otherwise I personally wouldn't bother much about it.
> I think it would be less work in the end to leave this PR as-is, go implement the heuristic.
This sounds good to me.
-----------------------------
I don't like merging with just `IgnoreUnless` because it may brong regression to library template code that is usually instantiated to concrete types in the end e.g. in tests.
https://github.com/llvm/llvm-project/pull/175121
More information about the cfe-commits
mailing list