Commit Graph

1630 Commits

Author SHA1 Message Date
Geoffrey White
dacb7f5f25 Swift: Add a SensitiveExprs lib (and test it). 2022-08-25 22:15:15 +01:00
Geoffrey White
2aa6dd20ff Swift: Make tests more accurate and don't use 'pwd' as a variable name (it has alternative meanings so is not a good test). 2022-08-25 22:15:14 +01:00
Geoffrey White
1c5283628b Swift: Additional test cases. 2022-08-25 22:15:13 +01:00
Paolo Tranquilli
df3dc9677f Swift: fix missing extractions from Builtin
There were missing extractions from the Builtin (and other) modules.

This was actually caused by two issues:
* we did not visit all required modules, as for example the `Builtin`
  module does not appear as being imported by anybody (together with
  another mysterious `__Objc` module)
* moreover the `Builtin` module works internally by only creating
  declarations on demand, and does not provide a list of its top level
  declarations.

The first problem was solved by moving module collection to the actual
visiting. This may mean we extract less modules, as we only extract the
modules we actually use something from (recursively). This change can
be reverted if we feel we need it.

The second one was solved by explicitly listing the builtin symbols
encountered during a normal extraction. This does mean this list needs
to be kept up to date.
2022-08-25 15:18:24 +02:00
Mathias Vorreiter Pedersen
f2d9393928 Swift: Only test local-flow step relations for nodes with proper location information. 2022-08-24 17:14:11 +01:00
Mathias Vorreiter Pedersen
80bf22cf6f Swift: Accept test changes in query tests. 2022-08-24 14:52:36 +01:00
Mathias Vorreiter Pedersen
2d90940111 Swift: Add field flow. 2022-08-24 14:52:36 +01:00
Paolo Tranquilli
610c788e34 Merge pull request #10156 from github/redsun82/swift-import-optional-module
Swift: make `ImportDecl:imported_module` optional
2022-08-24 15:18:04 +02:00
Paolo Tranquilli
2ee8d1a9d3 Swift: implement optional ImportDecl:imported_module 2022-08-24 14:31:55 +02:00
Mathias Vorreiter Pedersen
06a39d2b93 Swift: Accept test change. 2022-08-24 13:29:17 +01:00
Paolo Tranquilli
7873f07fac Swift: define ImportDecl:imported_module optional 2022-08-24 14:26:29 +02:00
Mathias Vorreiter Pedersen
edb29b498d Swift: Teach 'DataFlowDispatch' about property getters, observers and setters. 2022-08-24 13:08:26 +01:00
Mathias Vorreiter Pedersen
1d50dd54ce Merge branch 'main' into swift-extract-this-param-decl 2022-08-24 10:14:18 +01:00
Paolo Tranquilli
f570cc1916 Merge pull request #10143 from github/redsun82/swift-add-module-to-decl
Swift: add module to `Decl`
2022-08-24 11:05:06 +02:00
Mathias Vorreiter Pedersen
de03fbdc49 Swift: Accept test changes. 2022-08-24 10:03:21 +01:00
Mathias Vorreiter Pedersen
997d9e8559 Swift: Include 'self' parameter declaration in the CFG. 2022-08-24 10:01:25 +01:00
Mathias Vorreiter Pedersen
09427af2a2 Swift: Accept test changes. 2022-08-24 10:01:25 +01:00
Mathias Vorreiter Pedersen
ca31984040 Swift: Autogenerate files. 2022-08-24 10:01:25 +01:00
Mathias Vorreiter Pedersen
6e148a4c3f Swift: Use the inline testing framework for dataflow tests. 2022-08-23 16:31:05 +01:00
Paolo Tranquilli
2fc88d5f8e Swift: add module to Decl and remove forward traps
Add module context to all declarations. As keeping the `std::variant`s
required slightly more work for this, and we intended to remove them
any way, this is done in this change.

For background, we put those in as we were not extracting all modules at
the time, so we were missing some DB ids that we put back in by adding
the "defining" traps not only in the trap file related to the defining
module but also to the one where the declaration was used. Since then
we fixed module extraction, so this should not be needed any more.
2022-08-23 16:53:07 +02:00
Chris Smowton
f3ef8510d3 Merge pull request #10093 from smowton/smowton/feature/java-singular-locations
Java: pick an arbitrary representative location when an entity has many candidate locations.
2022-08-22 09:32:43 +01:00
Chris Smowton
8d20b9cf52 Use hasLocationInfo to match several Location fields at once 2022-08-19 19:03:17 +01:00
Chris Smowton
1ea7caf559 Fix join ordering in inline-expectations test 2022-08-19 18:17:22 +01:00
Paolo Tranquilli
631d234026 Swift: expand tests 2022-08-19 16:15:17 +02:00
Paolo Tranquilli
6706ba6ded Swift: accept toString changes in tests 2022-08-19 15:22:02 +02:00
Paolo Tranquilli
9b50336e47 Swift: synthesize MethodRefExpr
This introduces a `MethodRefExpr` node synthesized out of
`DotSyntaxCallExpr` under the `LookupExpr` hierarchy. This means that
much like
```free_function(1, 2)```
is a `CallExpr` with `getFunction` giving a `DeclRefExpr`,
```foo.method(1, 2)```
is now a `CallExpr` with `getFunction` giving a `MethodRefExpr`.

`ApplyExpr::getStaticTarget` has been made work with it (as well as
`ConstructorRefCallExpr` which for the moment has been left where it
is), a new `MethodApplyExpr` has been introduced deriving from it,
and control and data flow libraries have adapted.

A small but was fixed in `qlgen` where the default constructor for DB
types was not correctly subtracting derived IPA types depending on the
order of definitions in `schema.yml`.

There are still some occurrences of `DotSyntaxCallExpr`, and as already
mentioned the other `SelfApply` class (`ConstructorRefCallExpr`) was
left alone. Their treatment is left for a future PR.
2022-08-19 14:48:36 +02:00
erik-krogh
2e44fba67d add explicit this 2022-08-17 13:33:31 +02:00
Paolo Tranquilli
979706903a Merge pull request #10070 from github/redsun82/swift-self-apply-tests
Swift: add more `SelfApplyExpr` testing
2022-08-17 09:34:20 +02:00
Paolo Tranquilli
f17fed7c9a Swift: add more SelfApplyExpr testing 2022-08-16 17:46:22 +02:00
Geoffrey White
dd51b7f356 Swift: Add many tests. 2022-08-16 10:04:00 +01:00
Paolo Tranquilli
6dc90bc46c Swift: accept test change 2022-08-15 11:53:18 +02:00
Paolo Tranquilli
176009ca88 Merge branch 'main' into redsun82/swift-first-prototype-of-generated-ipa-layer 2022-08-15 10:18:41 +02:00
Geoffrey White
c1be060ef8 Swift: Create query + test stubs. 2022-08-11 16:10:18 +01:00
Geoffrey White
1dcc44ff2f Swift: taintedFromLine -> tainted. 2022-08-11 11:01:05 +01:00
Geoffrey White
d16a7754e1 Swift: Take out common code. 2022-08-10 19:04:01 +01:00
Geoffrey White
d7f50eafae Swift: Minor fixes. 2022-08-10 19:03:52 +01:00
Geoffrey White
11f45cf20c Swift: Add expectation annotations. 2022-08-10 18:53:45 +01:00
Geoffrey White
c2ee5fe258 Swift: Add inlineExpectations test. 2022-08-10 18:47:46 +01:00
Geoffrey White
f3499e98a4 Swift: Move try, ! to dataflow. 2022-08-10 15:13:04 +01:00
Geoffrey White
6f696ccc3c Swift: Effect of merging with main to get the AnyTryExpr fix. 2022-08-09 19:02:59 +01:00
Geoffrey White
efcc696e6e Merge branch 'main' into defaulttaint 2022-08-09 18:59:36 +01:00
Geoffrey White
36f410b9f7 Swift: Move taint logic from isAdditionalTaintStep to defaultAdditionalTaintStep. 2022-08-09 17:42:28 +01:00
Geoffrey White
242dc80907 Swift: Add taint test of try. 2022-08-09 17:42:25 +01:00
Geoffrey White
3bda9af97a Swift: Add taint test of Data. 2022-08-09 17:42:24 +01:00
Geoffrey White
42c3e29a29 Swift: Add taint test of URL. 2022-08-09 17:42:23 +01:00
Geoffrey White
068ec8ea20 Swift: More tests of taint flow through Strings. 2022-08-09 16:43:07 +01:00
Geoffrey White
0141609703 Swift: Rename test. 2022-08-09 16:41:26 +01:00
Mathias Vorreiter Pedersen
5ee11c3d7b Swift: Accept test changes. 2022-08-09 15:12:42 +01:00
Mathias Vorreiter Pedersen
f2767eb03a Merge pull request #9972 from MathiasVP/swift-taint-through-interpolated-strings
Swift: Taint through interpolated strings
2022-08-05 15:55:35 +01:00
Mathias Vorreiter Pedersen
46ec7a9b82 Swift: Add the InlineExpectationsTest framework. 2022-08-05 11:49:15 +01:00