-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Swift: use shared capture flow library #14078
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
Closed
Closed
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
e1d5bd2
Swift: change note
d10c 63d6e52
Swift: add failing inline expectation test based on closure AST tests.
d10c 6296a8b
Swift: add partial flow test starting from all sources in the test file.
d10c 4b841b0
Swift: s/getName/getShortName/ in InlineFlowTest.qll
d10c 88b54f8
Swift: initial version of a swift port of most of the java code
d10c 7f55d6f
Swift: getImmediateBasicBlockDominator/2 should use immediatelyDomina…
d10c f8faba6
Swift: Add closure content read-write steps
d10c 12165e8
Swift: port simpleAstFlowStep/hasAliasedAccess
d10c 422b92a
Merge branch 'main' into swift/shared-capture-flow
d10c 7c8414a
Swift: Add the capture flow step as part of the normal data flow rela…
d10c bb42d73
Swift: accept new results in old tests
d10c c49960a
Swift: add and accept a few new simple test cases
d10c 4e1472b
Swift: align definition of InputSig slightly closer to Java version
d10c fe7e18e
Swift: add CapturePostUpdateNode
d10c File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
--- | ||
category: majorAnalysis | ||
--- | ||
* Introduced support for flow through captured variables that properly adheres to inter-procedural control flow. |
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
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
Oops, something went wrong.
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.
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.
For a constructor call
new Foo(x)
, the corresponding expression node is the value after the constructor has returned. And in order for a constructor to work as a setter (say ifnew Foo(x)
assignsx
to some field ofFoo
), then the constructor expression needs to be a post-update node. That's why we generally (not just in this context) synthesise a node that we call "malloc" to be the pre-update for a constructor call. That way the constructor becomes just another instance method taking the "malloc" as the input to thethis
parameter and returning the value ofthis
after potentially updating some field on it.The variable capture library needs to refer to this "malloc" node, which is the pre-update for a constructor call, in case the closure expression has a constructor that's being called when the closure is created. This usually isn't the case for lambdas, as lambdas don't have constructors, but if Swift allows the definition of other capturing objects, say local class definitions or anonymous class objects, then this becomes relevant. See e.g. the Java test cases, which also includes some examples of local and anonymous classes where the constructor captures a variable.