Skip to content

Commit b26b0a6

Browse files
committed
Swift: remove property wrapper CFG inconsistencies
1 parent 7878bc3 commit b26b0a6

File tree

3 files changed

+9
-18
lines changed

3 files changed

+9
-18
lines changed

swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -969,6 +969,15 @@ module Decls {
969969
result.asAstNode() = ast.getPattern(j).getFullyUnresolved()
970970
)
971971
or
972+
// synthesized pattern bindings for property wrappers may be sharing the init with the backed
973+
// variable declaration, so we need to skip those
974+
not exists(VarDecl decl |
975+
ast =
976+
[
977+
decl.getPropertyWrapperBackingVarBinding(),
978+
decl.getPropertyWrapperProjectionVarBinding()
979+
]
980+
) and
972981
exists(int j |
973982
i = 2 * j + 1 and
974983
result.asAstNode() = ast.getInit(j).getFullyConverted()

swift/ql/test/extractor-tests/generated/decl/ConcreteVarDecl/CONSISTENCY/CfgConsistency.expected

Lines changed: 0 additions & 14 deletions
This file was deleted.
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,3 @@
11
multipleSuccessors
2-
| test.swift:252:6:252:27 | call to DidSetSource.init(wrappedValue:) | successor | file://:0:0:0:0 | var ... = ... |
3-
| test.swift:252:6:252:27 | call to DidSetSource.init(wrappedValue:) | successor | test.swift:252:19:252:27 | var ... = ... |
42
| test.swift:488:8:488:12 | let ...? | no-match | test.swift:488:27:488:27 | y |
53
| test.swift:488:8:488:12 | let ...? | no-match | test.swift:493:9:493:9 | tuple1 |
6-
deadEnd
7-
| file://:0:0:0:0 | var ... = ... |

0 commit comments

Comments
 (0)