Skip to content

Replaced 'tok->next()->link()' by 'tok->linkAt(1)'#6476

Merged
chrchr-github merged 1 commit intomainfrom
fix_TokenLink_warnings
Jun 1, 2024
Merged

Replaced 'tok->next()->link()' by 'tok->linkAt(1)'#6476
chrchr-github merged 1 commit intomainfrom
fix_TokenLink_warnings

Conversation

@orbitcowboy
Copy link
Copy Markdown
Collaborator

@orbitcowboy orbitcowboy commented Jun 1, 2024

Fixes from #6472

@chrchr-github
Copy link
Copy Markdown
Collaborator

chrchr-github commented Jun 1, 2024

https://github.com/danmar/cppcheck/blob/eeef6b8a38a26e1d2fae1d4e9e092183f27653bf/lib/checkinternal.cpp#L299 should be changed to

if (Token::Match(tok, "previous ( ) . next|tokAt|strAt|link|linkAt (") || Token::Match(tok, "next ( ) . previous|tokAt|strAt|link|linkAt (") ||

@chrchr-github
Copy link
Copy Markdown
Collaborator

[...]
should be changed to
[...]

Done with other stuff in #6478

@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Jun 1, 2024

I gave it a small spin.

Clang 17 1,230,369,784 -> 1,231,921,651
Clang 17 (with #6479) 1,231,921,669 -> 1,196,502,795

So when the compiler can inline it, these changes actually make the code faster. 👍

@chrchr-github chrchr-github merged commit 7b22594 into main Jun 1, 2024
@chrchr-github chrchr-github deleted the fix_TokenLink_warnings branch June 1, 2024 21:33
@firewave
Copy link
Copy Markdown
Collaborator

firewave commented Jun 1, 2024

callgrind in CI 64,212,820,811 -> 64,288,204,094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants