C++: Improve Iterator models#5157
Merged
Merged
Conversation
criemen
previously approved these changes
Feb 15, 2021
Collaborator
criemen
left a comment
There was a problem hiding this comment.
LGTM, but somebody else should double-check the new taint flow.
Contributor
@rdmarsh2, can you check it? |
rdmarsh2
reviewed
Feb 16, 2021
criemen
approved these changes
Feb 17, 2021
Collaborator
criemen
left a comment
There was a problem hiding this comment.
As Robert didn't complain about the new taint flow, and his comment has been addressed, LGTM.
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.
Improve Iterator.qll models:
Iterator.qllalready models its classes, and uses a special predicategetIteratorArgumentInputto connect classes to non-member function models. But there were a few opportunities to clean things up for member function models usinggetClassAndName.operator+=models, particularly with the non-member version and consistency between the member and non-member versions; I've added some more test cases and attempted to improve matters. But please do say if you think I may have made a mistake!Regarding BSL:
bslclasses appear to have iterators,beginmethods etc with the normal behaviour.bsl::iterator,bsl::front_inserter,bsl::inserter, andbsl::back_inserterfunctions don't appear to be documented but are implemented as references (viausingdeclarations) to thestdversions.bsl:iterator_traitscorresponding tostd::iterator_traits, or ausing. I couldn't find documentation for it but it's clearly intended to be the same thing.bsl::List_Iterator. This example should be caught byIteratorByTypedefsand modelled correctly.TL;DR:
bsliterators work the same asstditerators, so I've changed the model to include them, and also fixed a few things.