Geoffrey White
302013a7fd
Swift: Add a test for Type.getABaseOrAliasedType.
2023-03-31 10:44:01 +01:00
Geoffrey White
33b041242d
Swift: Recognize Core Data + Realm sources via type aliases.
2023-03-31 10:44:01 +01:00
Geoffrey White
ddb27e5525
Merge pull request #12724 from geoffw0/modernstring2
...
Swift: Add missing import.
2023-03-31 09:48:46 +01:00
Paolo Tranquilli
bc698546e5
Swift: specify treatment for multi-line things
2023-03-31 10:32:40 +02:00
Paolo Tranquilli
33b4d2d653
Swift: add SuccessfullyExtractedLines query
...
This counts how many lines we have extracted some entity in. If we test
changes in this, we can have a more fine grained look into how much we
actually extract than looking at the extracted files.
2023-03-31 10:02:19 +02:00
Geoffrey White
01280aee67
Swift: Add missing import.
2023-03-31 08:48:57 +01:00
Paolo Tranquilli
3e703802b1
Merge pull request #12710 from github/redsun82/swift-imported-modules-as-set
...
Swift: make imported and exported modules a set
2023-03-31 09:46:44 +02:00
AlexDenisov
3cd0af6622
Merge pull request #12700 from github/redsun82/swift-fix-wmo
...
Swift: extract all source files in WMO mode
2023-03-30 18:01:48 +02:00
Geoffrey White
daa8141414
Swift: Add test case.
2023-03-30 16:16:40 +01:00
Geoffrey White
beb7d9d7a1
Swift: Test layout change.
2023-03-30 16:13:42 +01:00
Paolo Tranquilli
3d6916eb72
Swift: add upgrade/downgrade scripts
2023-03-30 16:44:28 +02:00
Paolo Tranquilli
6f6d3f1262
Merge branch 'main' into redsun82/swift-imported-modules-as-set
2023-03-30 16:42:35 +02:00
Paolo Tranquilli
06ad5b3949
Revert "Swift: add upgrade/downgrade scripts"
...
This reverts commit 48c2303391 .
This is done to merge main and readd the scripts in another commit.
2023-03-30 16:41:04 +02:00
Geoffrey White
7729a6bdbf
Merge pull request #12509 from geoffw0/typealiasimpl
...
Swift: Extract type aliases
2023-03-30 11:06:14 +01:00
Paolo Tranquilli
aeaeade75e
Merge pull request #12706 from github/alexdenisov/consider-non-swift-modules-as-lazy
...
Swift: consider declarations from non-swift modules as lazy
2023-03-30 08:40:53 +02:00
Geoffrey White
fcefd03b14
Swift: Fill out the upgrade/downgrade scripts.
2023-03-29 15:54:08 +01:00
Geoffrey White
d5928e150d
Swift: Prepare upgrade/downgrade scripts.
2023-03-29 15:51:42 +01:00
Geoffrey White
704e42cf22
Swift: Accept integration test changes (not sure what caused this exactly but it looks OK to me).
2023-03-29 15:49:44 +01:00
Geoffrey White
8e4c7a9d89
Swift: Test expectations.
2023-03-29 15:49:36 +01:00
Geoffrey White
4ba8de4802
Swift: Update codegen.
2023-03-29 15:49:26 +01:00
Geoffrey White
f042195e5c
Swift: Connect it up.
2023-03-29 15:49:17 +01:00
Geoffrey White
d8703210dd
Swift: Extract type aliases.
2023-03-29 15:49:12 +01:00
Jeroen Ketema
edfd8715c8
Merge pull request #12695 from jketema/swift-configsig
...
Swift: Refactor a number of queries to use `DataFlow::ConfigSig`
2023-03-29 16:07:47 +02:00
Mathias Vorreiter Pedersen
e3e68b7753
Merge pull request #12642 from geoffw0/modernstring
...
Swift: Modernize the swift/string-length-conflation query
2023-03-29 14:55:40 +01:00
Paolo Tranquilli
48c2303391
Swift: add upgrade/downgrade scripts
2023-03-29 15:44:07 +02:00
Paolo Tranquilli
20128adee4
Swift: make imported and exported modules a set
2023-03-29 15:44:07 +02:00
Alex Denisov
069598c9e1
Swift: consider declarations from non-swift modules as lazy
...
This change fixes all of the VALUE_NOT_IN_TYPE errors I'm seeing with
the integration tests on macOS.
2023-03-29 14:02:56 +02:00
Paolo Tranquilli
f938fde6eb
Merge branch 'main' into redsun82/swift-fix-wmo
2023-03-29 13:33:11 +02:00
Paolo Tranquilli
2cfecac545
Swift: remove debug prints
2023-03-29 13:14:44 +02:00
Jeroen Ketema
0acca2ba76
Merge pull request #12687 from jketema/unit-2
...
Make imports of `codeql.util.Unit` private
2023-03-29 13:07:12 +02:00
Nora Dimitrijević
70ed8c6e8f
Swift: add QLdoc to Pattern
2023-03-29 11:52:50 +02:00
Nora Dimitrijević
3fbf90cbd7
Swift: add ConstructorDecl.isFailable/0
2023-03-29 11:52:50 +02:00
Paolo Tranquilli
f3f17791c3
Swift: extract all source files in WMO mode
...
WMO stands for whole module optimization. It's a compilation mode where
all sources of a module are compiled together, e.g.
```
swift-frontend -emit-module A.swift B.swift -o Module.swiftmodule
```
This is opposed to incremental mode, where one would do something like
```
swift-frontend -emit-module -primary-file A.swift B.swift -module-name Module -o Module~A.swiftmodule
swift-frontend -emit-module A.swift -primary-file B.swift -module-name Module -o Module~B.swiftmodule
swift-frontend -merge-modules Module~A.swiftmodule Module~B.swiftmodule -o Module.swiftmodule
```
In WMO mode we were skipping extraction of all files after the first
one, because we were filtering in only files with an associated output,
and internally swift only assigns the output to the first input file in
WMO mode (which is just an implementation detail).
This patch refines that filter, by getting all input source files in
case there are no primary inputs.
2023-03-29 10:39:58 +02:00
Nora Dimitrijević
55ce9760e1
Merge branch 'main' into swift/case-let-dataflow
2023-03-28 18:20:33 +02:00
Nora Dimitrijević
2a5f29cd0f
Swift: remove getIdentityPreservingEnclosingPattern
...
The Pattern public interface doesn't really need it.
2023-03-28 18:18:32 +02:00
Jeroen Ketema
a381aa4d37
Swift: Use DataFlow::ConfigSig in InsufficientHashIterations.ql
2023-03-28 17:39:58 +02:00
Jeroen Ketema
60f033f10c
Swift: Use DataFlow::ConfigSig in ConstantSalt.ql
2023-03-28 17:39:18 +02:00
Jeroen Ketema
b97b3d9975
Swift: Use DtatFlow::ConfigSig in InsecureTLS.ql
2023-03-28 17:38:46 +02:00
Jeroen Ketema
42248220b4
Swift: Use DataFlow::ConfigSig in WeakSensitiveDataHashing.ql
2023-03-28 17:38:11 +02:00
Jeroen Ketema
a8599eb689
Swift: Use DataFlow::ConfigSig in ECBEncryption.ql
2023-03-28 17:37:37 +02:00
Jeroen Ketema
cc23ba3698
Swift: Use DataFlow::ConfigSig in HardcodedEncryptionKey.ql
2023-03-28 17:37:05 +02:00
Jeroen Ketema
1592b578d9
Swift: Use DataFlow::ConfigSig in ConstantPassword.ql
2023-03-28 17:36:37 +02:00
Jeroen Ketema
31512b8627
Swift: Use DataFlow::ConfigSig in StaticInitializationVector.ql
2023-03-28 17:36:00 +02:00
Nora Dimitrijević
94614320b5
Swift: refactor OptionalSomeDecl -> OptionalSomeContentSet
2023-03-28 15:15:16 +02:00
Anders Schack-Mulligen
7c74fd07e9
Merge pull request #12684 from aschackmull/dataflow/remove-footgun
...
Dataflow: Remove accidentally exposed predicates.
2023-03-28 15:14:58 +02:00
Nora Dimitrijević
ea9e8e7ddb
Swift: fix bad join order in Pattern.getImmediateMatchingExpr
...
On Signal-iOS, this snippet:
```codeql
class Pattern extends Generated::Pattern {
...
Expr getImmediateMatchingExpr() {
...
exists(PatternBindingDecl v, int i |
v.getPattern(i) = this and
result = v.getInit(i)
)
...
}
...
}
```
Had the following join order:
```
33926 ~0% {3} r8 = SCAN PatternBindingDecl#ab5153b9::Generated::PatternBindingDecl::getImmediateInit#1#dispred#fff OUTPUT In.1, In.0, In.2
2565045964 ~0% {4} r9 = JOIN r8 WITH pattern_binding_decl_patterns_102#join_rhs ON FIRST 1 OUTPUT Lhs.1, Rhs.1, Lhs.2, Rhs.2
33926 ~0% {2} r10 = JOIN r9 WITH Synth#5f134a93::Synth::convertPatternBindingDeclToRaw#1#ff ON FIRST 2 OUTPUT Lhs.3, Lhs.2
33926 ~2% {2} r11 = JOIN r10 WITH Synth#5f134a93::Synth::convertPatternFromRaw#1#ff ON FIRST 1 OUTPUT Rhs.1, Lhs.1
33926 ~1% {2} r12 = JOIN r11 WITH Element#e67432df::Generated::Element::resolve#ff ON FIRST 1 OUTPUT Lhs.1, Rhs.1
33926 ~4% {2} r13 = JOIN r12 WITH Element#e67432df::Generated::Element::resolve#ff ON FIRST 1 OUTPUT Lhs.1, Rhs.1
```
After applying `pragma[only_bind_out]` to `this`:
```
198815 ~1% {2} r4 = SCAN Synth#5f134a93::Synth::TPattern#f OUTPUT In.0, In.0
198815 ~0% {2} r5 = JOIN r4 WITH Element#e67432df::Generated::Element::resolve#ff_10#join_rhs ON FIRST 1 OUTPUT Rhs.1, Lhs.1
75626 ~0% {3} r6 = JOIN r5 WITH PatternBindingDecl#ab5153b9::Generated::PatternBindingDecl::getImmediatePattern#1#dispred#fff_201#join_rhs ON FIRST 1 OUTPUT Rhs.1, Rhs.2, Lhs.1
33926 ~1% {2} r7 = JOIN r6 WITH PatternBindingDecl#ab5153b9::Generated::PatternBindingDecl::getImmediateInit#1#dispred#fff ON FIRST 2 OUTPUT Rhs.2, Lhs.2
33926 ~4% {2} r8 = JOIN r7 WITH Element#e67432df::Generated::Element::resolve#ff ON FIRST 1 OUTPUT Lhs.1, Rhs.1
```
2023-03-28 14:57:05 +02:00
Jeroen Ketema
3b8ad087eb
Make imports of codeql.util.Unit private
2023-03-28 14:14:13 +02:00
Anders Schack-Mulligen
d406b051fc
Dataflow: Remove accidentally exposed predicates.
2023-03-28 10:04:21 +02:00
Nora Dimitrijević
239e14b71a
Swift: fix QLdoc check for EnumElementExpr.qll
2023-03-27 23:48:37 +02:00
Nora Dimitrijević
41b283c07c
Swift: add .some enum content to init? calls
...
Again, this is hacky; we don't distinguish rigorously between an
optional value and its content (similar to how it was before enum
content flow).
2023-03-27 23:01:25 +02:00