cppcheck icon indicating copy to clipboard operation
cppcheck copied to clipboard

fix #13452: iterator for library container not always detected

Open ludviggunne opened this issue 11 months ago • 3 comments

In reference to https://github.com/danmar/cppcheck/pull/6595.

ludviggunne avatar Jan 22 '25 17:01 ludviggunne

@firewave does this look OK?

ludviggunne avatar Jan 22 '25 17:01 ludviggunne

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.

firewave avatar Jan 22 '25 18:01 firewave

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!

ludviggunne avatar Jan 23 '25 09:01 ludviggunne