[clang-tools-extra] [clang-tidy] Add performance-redundant-lookup check (PR #125420)

Balazs Benics via cfe-commits cfe-commits at lists.llvm.org
Sat Feb 15 05:23:17 PST 2025


steakhal wrote:

> Thanks for the insight. Take your time.

So, I spent a few hours experimenting and it's really difficult to do, only using `ExprSequence`.
Just to recap, my idea was to match the assignments and inc/dec unary operator calls to detect if the container or the key object is mutated.
Then partition the lookup events if any of the lookups were "separated" by such a mutation.
Then check if the remaining group has at least 2 lookups, if so, report them.

It got fairly complicated and still buggy. I definitely think it's achievable, it's just too much that I could invest into.

So, let's say, I'd stick with the current version of [this branch](https://github.com/steakhal/llvm-project/tree/bb/tidy-add-redundant-lookup-check), what would be left to continue the review? @firewave 

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


More information about the cfe-commits mailing list