Commit Graph

2144 Commits

Author SHA1 Message Date
Mathias Vorreiter Pedersen
7d962ac62b Merge pull request #9397 from MathiasVP/use-autogenerated-parent-in-cfg-library
Swift: Use the autogenerated `getParent`
2022-06-01 14:45:43 +01:00
Mathias Vorreiter Pedersen
eabb5c7137 Swift: Respond to PR comments. 2022-06-01 14:34:22 +01:00
Paolo Tranquilli
3414028b1b Swift: simplify GetImmediateParent.qll 2022-06-01 15:01:49 +02:00
Mathias Vorreiter Pedersen
db0498e38c Swift: Use the autogenerated 'getParent' predicate in the CFG library. 2022-06-01 13:49:12 +01:00
Paolo Tranquilli
6b90b2b05f Swift: add children to IsPattern 2022-06-01 14:35:58 +02:00
Paolo Tranquilli
a4f97dd67a Swift: add comment about unique in getImmediateParent 2022-06-01 14:32:59 +02:00
Paolo Tranquilli
bc0a32c26e Swift: sort import list
Also fix parent tests with updated `statements.swift` file.
2022-06-01 14:32:59 +02:00
Paolo Tranquilli
3597efb728 Swift: rename to getImmediateParent and use hidden AST 2022-06-01 14:32:58 +02:00
Paolo Tranquilli
a86d0fc8a7 Swift: move getAChild to a separate module 2022-06-01 14:32:58 +02:00
Paolo Tranquilli
946e1f498a Swift: generate getParent implementation
By explicitly marking children in the `schema.yml` file, an internal
`getAChild` predicate is implemented, that is in turn used in `AstNode`
to implement `getParent`.

This is yet to be used in the control flow library to replace the
hand-rolled implementation.

A further, more complex step is to use the same information to fully
generate the core implementation of `PrintAst` (including the
accessor string). This will be done later.

The `parent` tests use the same swift code as the extractor tests, and
this is currently enforced by `sync-files.py`. Notice that `qltest.sh`
had to be modified to deal with multiple files, which was not working
yet.
2022-06-01 14:32:58 +02:00
Anders Schack-Mulligen
4f3751dfea Merge pull request #9316 from hvitved/dataflow/edges-get-a-successor-consistency
Data flow: Make `PathGraph::edges/2` and `PathNode::getASuccessor/1` consistent
2022-06-01 10:38:25 +02:00
Paolo Tranquilli
9231013401 Swift: use C++ entry style visitor in DeclVisitor 2022-06-01 08:41:43 +02:00
Robert Marsh
42ec6350eb Merge pull request #9349 from MathiasVP/fix-inconsistent-cfg
Swift: Fix three CFG inconsistencies
2022-05-31 14:38:08 -04:00
Robert Marsh
bd095abea4 Merge pull request #9388 from MathiasVP/cfg-for-yield
Swift: CFG for `yield`
2022-05-31 11:22:21 -04:00
Mathias Vorreiter Pedersen
6386daf44c Merge branch 'main' into fix-inconsistent-cfg 2022-05-31 15:59:53 +01:00
Robert Marsh
78fd0385fc Merge pull request #9355 from MathiasVP/not-all-functions-throw
Swift: Only construct exceptional edges for calls that may throw
2022-05-31 10:56:31 -04:00
Mathias Vorreiter Pedersen
5f9d03f7c6 Swift: CFG for 'yield'. 2022-05-31 15:45:43 +01:00
Geoffrey White
f598b26b03 Merge pull request #9384 from MathiasVP/qlpacks-for-swift
Swift: Add qlpacks
2022-05-31 15:39:20 +01:00
Mathias Vorreiter Pedersen
1d120486b4 Swift: Extract 'yield' statements. 2022-05-31 14:43:09 +01:00
Mathias Vorreiter Pedersen
9af31bab2a Swift: Add qlpacks. 2022-05-31 13:59:44 +01:00
Mathias Vorreiter Pedersen
21527f66e1 Swift: Extract KeyPath applications and KeyPathDot expressions. 2022-05-30 15:46:18 +01:00
Mathias Vorreiter Pedersen
d8916568b6 Merge branch 'main' into fix-inconsistent-cfg 2022-05-30 14:07:10 +01:00
Mathias Vorreiter Pedersen
9b17493b3b Merge branch 'main' into not-all-functions-throw 2022-05-30 14:03:29 +01:00
Mathias Vorreiter Pedersen
ef31aec29e Swift: Autoformat. 2022-05-30 12:58:12 +01:00
Mathias Vorreiter Pedersen
425d66e454 Update swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll 2022-05-30 12:52:48 +01:00
Mathias Vorreiter Pedersen
2106d48785 Swift: Add 'Argument.getIndex()' and use it in 'DataFlowDispatch'. 2022-05-30 12:51:29 +01:00
Mathias Vorreiter Pedersen
0d8a9458c6 Merge branch 'main' into rdmarsh2/swift/dataflow-global-flow 2022-05-30 12:46:06 +01:00
Mathias Vorreiter Pedersen
7c25063f7f Merge branch 'main' into swift-decls-in-cfg 2022-05-27 17:56:58 +01:00
Mathias Vorreiter Pedersen
6d5504412a Swift: Only create a 'ThrowCompletion' for functions that actually can throw. 2022-05-27 17:42:51 +01:00
Mathias Vorreiter Pedersen
b9809b4219 Swift: CFG for opening existentials. 2022-05-27 17:29:22 +01:00
Mathias Vorreiter Pedersen
02c73d3c1c Swift: Fix implicit-this alert. 2022-05-27 17:25:56 +01:00
Mathias Vorreiter Pedersen
45bbd24355 Swift: Extract whether a function type is throwing or async. 2022-05-27 11:48:01 +01:00
Mathias Vorreiter Pedersen
7d36bc1c73 Swift: Fix CFG for 'foreach' statements. 2022-05-27 10:01:12 +01:00
Mathias Vorreiter Pedersen
73c189957d Swift: Fix CFG inconsistencies with StmtConditions. 2022-05-27 09:58:36 +01:00
Mathias Vorreiter Pedersen
52a10c826a Merge branch 'main' into swift-to-string 2022-05-27 09:06:36 +01:00
Robert Marsh
32e4c496f6 Swift: Dataflow through Phi nodes 2022-05-26 17:55:25 +00:00
Robert Marsh
81ac648065 Swift: flow out of calls via return statements 2022-05-26 16:58:53 +00:00
Robert Marsh
ae6d16a40f Swift: flow into callees via params 2022-05-26 16:53:42 +00:00
Robert Marsh
25c8b8141c Swift: add params to CFG 2022-05-26 16:48:24 +00:00
Robert Marsh
3213549a73 Merge pull request #9329 from MathiasVP/fixes-for-9291
Swift: Fixups for #9291
2022-05-26 07:25:24 -04:00
Mathias Vorreiter Pedersen
df2c1972e9 Swift: Add CFG trees for local declarations and accept test changes. 2022-05-26 09:09:17 +01:00
Mathias Vorreiter Pedersen
c7cc8d2592 Swift: Fix copy-paste error. 2022-05-25 21:36:24 +01:00
Robert Marsh
9f64622f31 Swift: data flow configurations working 2022-05-25 19:23:43 +00:00
Robert Marsh
d326b3a91c Swift: global dataflow WIP 2022-05-25 18:54:47 +00:00
Robert Marsh
bba3564187 Swift: adjust for changes in main 2022-05-25 18:52:47 +00:00
Robert Marsh
91b34d5e8f Swift: make LambdaCallKind a TODO 2022-05-25 18:26:38 +00:00
Robert Marsh
cf22ade9f3 Swift: initial local data flow implementation 2022-05-25 18:26:37 +00:00
Robert Marsh
117a1ad2f4 Swift: DataFlow expr and parameter nodes 2022-05-25 18:26:37 +00:00
Mathias Vorreiter Pedersen
fafdb016fa Swift: Fixup based on review comments in #9291. 2022-05-25 16:10:44 +01:00
Mathias Vorreiter Pedersen
dc2ba5b410 Swift: Implement better 'toString' overrides for all AST nodes. 2022-05-25 15:59:45 +01:00