fix #13452: iterator for library container not always detected
In reference to https://github.com/danmar/cppcheck/pull/6595.
@firewave does this look OK?
Given the results of the unit tests it is.
The code duplication and additional Token::Match() are not. This is the most expensive call in the "core" (i.e. no ValueFlow, no checking, ...) so that is probably the reason we get timeouts in the CI. There is also a ticket about it. Also see the "callgrind" step in https://github.com/danmar/cppcheck/actions/runs/12913957401/job/36012395159. It now takes more than twice the Ir.
I wrecked my brain multiple times already in making this function just slightly faster in the past so figuring this out might take a bit. Please give me a few days since I am not feeling well at the moment.
I wrecked my brain multiple times already in making this function just slightly faster in the past so figuring this out might take a bit.
Just off the top of my head I'm thinking we could store the result of this function in Token, I did a quick run through and it was called six times for the same token.
Get well soon!