New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Swift: add SetContent for data flow #13838
base: main
Are you sure you want to change the base?
Conversation
|
Also small nitpick: How about just calling this |
I like this idea. |
| cs.isSingleton(c) and | ||
| result = "EnumElement[" + c.getSignature() + "]" | ||
| ) | ||
| or |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for adding this, I missed it in #13795 .
|
|
||
| let set2 = Set([source()]) | ||
| sink(arg: set2.randomElement()!) // $ MISSING: flow=703 | ||
| sink(arg: set2.randomElement()!) // $ flow=706 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎉
|
Do you mind rebasing this on the latest main so that we get a smaller diff @rdmarsh2? |
| @@ -255,7 +255,8 @@ private module Cached { | |||
| TFieldContent(FieldDecl f) or | |||
| TTupleContent(int index) { exists(any(TupleExpr te).getElement(index)) } or | |||
| TEnumContent(ParamDecl f) { exists(EnumElementDecl d | d.getAParam() = f) } or | |||
| TArrayContent() | |||
| TArrayContent() or | |||
| TSetContent() | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still think we should call this CollectionContent (see #13838 (comment))
3bcf28e
to
024c5cf
Compare
|
|
||
| /** An element of a set */ | ||
| class CollectionContent extends Content, TCollectionContent { | ||
| override string toString() { result = "Set element" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| override string toString() { result = "Set element" } | |
| override string toString() { result = "Collection element" } |
| @@ -492,6 +492,9 @@ predicate parseContent(AccessPathToken component, Content content) { | |||
| or | |||
| component.getName() = "ArrayElement" and | |||
| content instanceof Content::ArrayContent | |||
| or | |||
| component.getName() = "SetElement" and | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this be CollectionElement as well?
| component.getName() = "SetElement" and | |
| component.getName() = "CollectionElement" and |
| @@ -224,6 +224,11 @@ module Content { | |||
| class ArrayContent extends Content, TArrayContent { | |||
| override string toString() { result = "Array element" } | |||
| } | |||
|
|
|||
| /** An element of a set */ | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| /** An element of a set */ | |
| /** An element of a collection. */ |
| or | ||
| exists(Content::CollectionContent c | | ||
| cs.isSingleton(c) and | ||
| result = "SetElement" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| result = "SetElement" | |
| result = "CollectionElement" |
| @@ -26,6 +26,8 @@ private class CollectionSummaries extends SummaryModelCsv { | |||
| ";Collection;true;split(separator:maxSplits:omittingEmptySubsequences:);;;Argument[-1];ReturnValue;taint", | |||
| ";Collection;true;removeFirst();;;Argument[-1];ReturnValue;taint", | |||
| ";Collection;true;popFirst();;;Argument[-1];ReturnValue;taint", | |||
| ";Collection;true;randomElement();;;Argument[-1].SetElement;ReturnValue.OptionalSome;value", | |||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ";Collection;true;randomElement();;;Argument[-1].SetElement;ReturnValue.OptionalSome;value", | |
| ";Collection;true;randomElement();;;Argument[-1].CollectionElement;ReturnValue.OptionalSome;value", |
| ";Set;true;insert(_:);;;Argument[-1].SetElement;ReturnValue.TupleElement[1];value", | ||
| ";Set;true;insert(_:);;;Argument[0];Argument[-1].SetElement;value", | ||
| ";Set;true;insert(_:);;;Argument[0];ReturnValue.TupleElement[1];value", | ||
| ";Set;true;init(_:);;;Argument[0].ArrayElement;ReturnValue.SetElement;value" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| ";Set;true;insert(_:);;;Argument[-1].SetElement;ReturnValue.TupleElement[1];value", | |
| ";Set;true;insert(_:);;;Argument[0];Argument[-1].SetElement;value", | |
| ";Set;true;insert(_:);;;Argument[0];ReturnValue.TupleElement[1];value", | |
| ";Set;true;init(_:);;;Argument[0].ArrayElement;ReturnValue.SetElement;value" | |
| ";Set;true;insert(_:);;;Argument[-1].CollectionElement;ReturnValue.TupleElement[1];value", | |
| ";Set;true;insert(_:);;;Argument[0];Argument[-1].CollectionElement;value", | |
| ";Set;true;insert(_:);;;Argument[0];ReturnValue.TupleElement[1];value", | |
| ";Set;true;init(_:);;;Argument[0].ArrayElement;ReturnValue.CollectionElement;value" |
No description provided.