Commit Graph

4519 Commits

Author SHA1 Message Date
Alex Denisov
1c9a684ac6 Swift: Introduce SwiftExtractionMode 2022-06-15 09:25:01 +02:00
Paolo Tranquilli
5a2d4faf11 Swift: remove unneeded import list sorting 2022-06-15 09:19:58 +02:00
Mathias Vorreiter Pedersen
2fdb3d638b Merge branch 'main' into closure-expr-as-cfg-callable 2022-06-15 08:16:56 +01:00
Paolo Tranquilli
86ebb0bb68 Swift: fix qltest skipping and skip isUnknown
Also remove obsolete accessor and function hand-written tests.
2022-06-15 09:16:55 +02:00
Mathias Vorreiter Pedersen
b0c66dda3a Merge pull request #9556 from MathiasVP/swift-extract-closure-params
Swift: Extract closure parameters
2022-06-15 08:07:08 +01:00
Alex Denisov
6d67ea267c Swift: add cross-referencing test 2022-06-15 08:44:38 +02:00
Mathias Vorreiter Pedersen
ef224b9c1d Swift: Mark non-auto closures as callables in the CFG library. 2022-06-14 21:05:48 +01:00
Mathias Vorreiter Pedersen
6c96f71d0c Swift: Autogenerate and accept test changes. 2022-06-14 20:39:18 +01:00
Mathias Vorreiter Pedersen
4595a9cf0b Swift: Extract parameters to closure expressions. 2022-06-14 20:38:57 +01:00
Paolo Tranquilli
de52f9be7b Swift: generated extractor tests 2022-06-14 18:01:29 +02:00
Paolo Tranquilli
b6342ba2a0 Swift: limit Cfg.ql to test source locations 2022-06-14 14:15:48 +02:00
Alex Denisov
26d3c4a7fc Swift: extract system and builtin modules separately 2022-06-14 14:15:48 +02:00
Alex Denisov
311dcfa230 Swift: remove toString from UnknownElement
Another attempt to remove flakiness
2022-06-14 13:37:17 +02:00
Alex Denisov
9681358a6d Swift: extract OtherConstructorDeclRefExpr 2022-06-14 12:53:25 +02:00
Alex Denisov
e677b78ab9 Swift: attach NominalTypeDecl to the ExtensionDecl 2022-06-14 12:09:26 +02:00
Alex Denisov
cf0fc5829f Swift: extract extension declarations 2022-06-14 08:22:43 +02:00
Mathias Vorreiter Pedersen
6c8982b46e Merge pull request #9469 from rdmarsh2/rdmarsh2/swift/dataflow-inout
Swift: Dataflow through inout parameters
2022-06-13 18:11:11 +01:00
Mathias Vorreiter Pedersen
20d9aaf055 Merge pull request #9516 from MathiasVP/revert-9419-revert-9373-cfg-for-key-paths
Swift: Reintroduce control-flow for key paths
2022-06-13 17:34:12 +01:00
Robert Marsh
d7f839a147 Swift: use ExitNode as CFG for InoutReturnNode 2022-06-13 15:50:30 +00:00
Robert Marsh
9f2abf3d47 Swift: more inout dataflow tests 2022-06-13 15:39:17 +00:00
Robert Marsh
84518c8d54 Merge pull request #9404 from MathiasVP/swift-get-enclosing-function
Swift: Add `getEnclosingFunction` to `AstNode`
2022-06-13 09:37:51 -04:00
Mathias Vorreiter Pedersen
89bda047ff Swift: Accept test changes. 2022-06-13 10:14:08 +01:00
Mathias Vorreiter Pedersen
7e5235b4d5 Revert "Merge pull request #9419 from github/revert-9373-cfg-for-key-paths"
This reverts commit 2187bf5dde, reversing
changes made to 8b1605a617.
2022-06-13 10:12:22 +01:00
Mathias Vorreiter Pedersen
ae288332cc Merge pull request #9511 from MathiasVP/fix-completion-for-patterns
Swift: Fix completion for "naked" patterns
2022-06-13 10:56:07 +02:00
Mathias Vorreiter Pedersen
32ef535ad7 Merge pull request #9430 from github/redsun82/swift-unknown-location
Swift: add `UnknownLocation`
2022-06-13 10:55:53 +02:00
Paolo Tranquilli
28d2fd7a22 Merge pull request #9416 from github/redsun82/swift-codegen-docs
Swift: document and partially simplify codegen
2022-06-13 10:50:16 +02:00
Mathias Vorreiter Pedersen
9d7afab185 Swift: Fix completion for patterns that occur outside 'CaseLabelItems'. Previously we'd add an unnecessary 'no-match' completion to these patterns even though they were always matching. This caused some confusing output in the graph tests in particular. 2022-06-13 09:24:18 +01:00
Robert Marsh
97815bfa61 Swift: fix implicit this usage 2022-06-09 18:50:40 +00:00
Robert Marsh
755c56dafe Swift: autoformat 2022-06-09 18:50:39 +00:00
Robert Marsh
fca1afa493 Swift: fix inout parameter conflation at return 2022-06-09 17:09:49 +00:00
Robert Marsh
8d4830cd23 Swift: make dataflow test a path-problem 2022-06-09 17:09:49 +00:00
Robert Marsh
a7663adf90 Swift: add flow through inout parameters 2022-06-09 17:09:49 +00:00
Robert Marsh
21ba73138d Swift: add CallExprCfgNode 2022-06-09 17:09:49 +00:00
Robert Marsh
cb3da0eedd Swift: add some ParamDecl methods 2022-06-09 17:09:48 +00:00
Robert Marsh
776a2965ca Swift: extract isInOut for parameters 2022-06-09 17:09:48 +00:00
Paolo Tranquilli
8b52bb0c31 Swift: build x86_64 on arm64 macOS
This is a temporary workaround. At a later stage we will add
* a Swift/LLVM prebuilt package for arm64
* universal binary for the extractor
2022-06-08 10:25:38 +02:00
Paolo Tranquilli
a0acb19b68 Swift: remove redundant import 2022-06-03 15:28:48 +02:00
Paolo Tranquilli
01e1c13c29 Swift: add UnknownLocation
`getLocation()` will now exists for all entities. When there is no
valid location, the location will still not be emitted in the DB, but
on the QL side we will then assign a special `UnknownLocation` with
empty filename and 0 for line/column start/end.

This unknown location is currently emitted (with a unique `@` key) at
the start of every extraction, but we can move it elsewhere (and
possibly in a unique global trap file) at a later stage, possibly after
or when we rework the trap file strategy.

This should solve flakiness that was observed on the control flow tests,
which is probably caused by the `nodes` predicate in the `TestOutput`
class in `ControlFlowGraphImplShared.qll` not able to assign a proper
rank when the node does not have a location.
2022-06-03 14:59:22 +02:00
AlexDenisov
0a861ff616 Merge pull request #9410 from github/alexdenisov/swift-extract-only-primary-files
Swift: extract only primary files
2022-06-03 10:44:18 +02:00
Alex Denisov
14384b7696 Swift: switch back to references 2022-06-03 10:22:25 +02:00
Paolo Tranquilli
87234938ef Swift: correct typo 2022-06-03 08:45:59 +02:00
Robert Marsh
43907b6a30 Merge pull request #9409 from github/alexdenisov/swift-fix-ctor-dtor-tostring
Swift: fix ctor/dtor names in toString
2022-06-02 10:34:03 -04:00
Paolo Tranquilli
ede6bd8ffe Swift: document and partially simplify codegen
This adds:
* a base `README.md` file to `codegen`
* module docstrings for the modules in `generators`
* help strings on all command line flags

Moreover some unneeded command line flags (`--namespace`,
`--include-dir` and `--trap-affix`) have been dropped.
2022-06-02 15:28:57 +02:00
Paolo Tranquilli
c9d109ddd3 Revert "Swift: Control-flow for key paths" 2022-06-02 14:55:52 +02:00
Mathias Vorreiter Pedersen
927aceb420 Merge pull request #9373 from MathiasVP/cfg-for-key-paths 2022-06-02 08:32:29 +01:00
Alex Denisov
6419af39f3 Swift: extract only primary files
While the (removed) comment is correct and the frontend can be called in
different modes, both `swift build` and `xcodebuild` always use
`-primary-files` when compiling Swift projects.
The other mode was present only within our test runner (`qltest.sh`), so
removing it and doing what the official build systems do simplifies our
code base.

Additionally, file archival is now a separate function/operation.
2022-06-02 08:57:03 +02:00
Alex Denisov
1dab01a31c Swift: fix ctor/dtor names in toString 2022-06-02 08:28:46 +02:00
Mathias Vorreiter Pedersen
cde2880392 Swift: Add getEnclosingFunction to AstNode. 2022-06-01 16:40:08 +01:00
Paolo Tranquilli
77f7fe8dbc Swift: merge codegen and cppcodegen
Python code was simplified, and now a `--generate` option can be used
to drive what can be generated.

The extractor pack creation now will use an internally generated
dbscheme. This should be the same as the checked in one, but doing so
allows `bazel run create-extractor-pack` and `bazel run codegen` to be
run independently from one another, while previously the former had to
follow the latter in case of a schema change. This is the change that
triggered the above simplification, as in order for the two dbscheme
files to be identical, the first `// generated` line had to state the
same generator script.
2022-06-01 17:07:52 +02:00
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