Token: do not return non-const pointer from const methods - part 1#4761
Merged
danmar merged 8 commits intocppcheck-opensource:mainfrom Feb 8, 2023
Merged
Token: do not return non-const pointer from const methods - part 1#4761danmar merged 8 commits intocppcheck-opensource:mainfrom
const pointer from const methods - part 1#4761danmar merged 8 commits intocppcheck-opensource:mainfrom
Conversation
Token constness adjustmentsconst pointer from const methods - part 1
pfultz2
reviewed
Feb 4, 2023
| else if (tok->variable() && tok->variable()->isArray() && tok->variable()->isConst() && | ||
| tok->variable()->nameToken() == tok && Token::Match(tok, "%var% [ %num%| ] = {")) { | ||
| const Token* rhstok = tok->next()->link()->tokAt(2); | ||
| Token* rhstok = tok->next()->link()->tokAt(2); |
Contributor
There was a problem hiding this comment.
I think these can stay const.
Collaborator
Author
There was a problem hiding this comment.
These changes are all based straight on compiler errors when the signature has been fixed - so no, they cannot.
Also from looking at the code it is used to get a new value for tok two lines down and that is not const.
danmar
reviewed
Feb 7, 2023
danmar
reviewed
Feb 8, 2023
…ded actual non-`const` implementation
Collaborator
|
Nice work! |
Collaborator
Author
Not done yet . The messy part is still coming up... And it would be actually nice if the things you found in the review (well spotted BTW) could be found by tooling. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Split from #4760.