Commit Graph

4519 Commits

Author SHA1 Message Date
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
a894ba64c4 Swift: make test run in Python 3.8 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
Paolo Tranquilli
4d6c8da74b Swift: no perfect forwarding for label fetchers
While we need universal references to catch different value categories,
we don't need perfect forwarding as `fetchLabel` does not behave
differently on lvalue and rvalues.
2022-06-01 11:26:21 +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
6e44a12a67 Swift: make enable_if_t a non-type parameter
This disallows completely calling the disabled function (which could
be done by explicitly providing `void` otherwise).
2022-06-01 08:47:53 +02:00
Paolo Tranquilli
905cc23719 Swift: update comment 2022-06-01 08:41:43 +02:00
Paolo Tranquilli
19f16678ac Swift: change translation signature and detection
Translation now takes const references to swift entities and return
trap entries (instead of taking apointer as an out parameter).
2022-06-01 08:41:43 +02:00
Paolo Tranquilli
c3cb0d6ad7 Swift: fix name extraction in VarDecl 2022-06-01 08:41:43 +02:00
Paolo Tranquilli
86b4f16b3a Swift: remove Binding<> class
That class was meant to allow aggregate initialization of generated
C++ entries having the label `id` as first argument.

As aggregate initialization turned out to be undesirable (names of
fields are not explicit, and `{}` must be inserted for empty
superclasses), this commit removes it and disallows aggregate
initialization altogether by defining empty constructors for generated
classes.
2022-06-01 08:41:43 +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
Mathias Vorreiter Pedersen
e2ddfcd437 Merge pull request #9387 from github/geoffw0-patch-2
Swift: Update readme
2022-05-31 16:34:17 +01: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
a175f49759 Merge pull request #3 from geoffw0/swiftsrc
Swift: Add swift-security-and-quality, swift-security-extended packs.
2022-05-31 15:02:33 +01:00
Mathias Vorreiter Pedersen
b5d229d4d8 Apply suggestions from code review
Co-authored-by: Geoffrey White <40627776+geoffw0@users.noreply.github.com>
2022-05-31 15:01:36 +01:00
Geoffrey White
01091ae1b9 Swift: Add codeql-suites. 2022-05-31 14:52:53 +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
Geoffrey White
ce3488b1b5 Update Swift readme 2022-05-31 10:56:28 +01:00
Geoffrey White
27968b60a5 Added Bazel install step. 2022-05-31 10:25:42 +01:00
Henry Mercer
b1faba9880 Merge pull request #9359 from github/henrymercer/migrate-to-codeql-workspace
Migrate `.codeqlmanifest.json` to `codeql-workspace.yml`
2022-05-30 18:20:11 +01:00
Mathias Vorreiter Pedersen
b88fe1b2b4 Swift: Add test case and accept changes. 2022-05-30 17:05:06 +01:00
Mathias Vorreiter Pedersen
eed42a4e14 Swift: Make a new scope for each KeyPath expression. 2022-05-30 17:05:06 +01:00
Henry Mercer
ca764576be Swift: Update mention of manifest file in docs 2022-05-30 15:54:52 +01:00
Mathias Vorreiter Pedersen
9175354bbd Swift: Add test and accept changes. 2022-05-30 15:51:49 +01:00
Mathias Vorreiter Pedersen
52f0b0d8d8 Swift: Fix extraction of roots in 'KeyPathExpr'. 2022-05-30 15:46:54 +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
c734646099 Swift: Accept test changes. 2022-05-27 17:42:51 +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