Skip to content

Commit 0b35be2

Browse files
committed
Swift: additional dataflow tests for arrays
1 parent ef9376d commit 0b35be2

File tree

3 files changed

+56
-14
lines changed

3 files changed

+56
-14
lines changed

swift/ql/test/library-tests/dataflow/dataflow/DataFlow.expected

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -277,9 +277,15 @@ edges
277277
| test.swift:638:5:638:5 | [post] &... [Array element] | test.swift:639:15:639:15 | &... [Array element] |
278278
| test.swift:638:15:638:22 | call to source() | test.swift:638:5:638:5 | [post] &... [Array element] |
279279
| test.swift:639:15:639:15 | &... [Array element] | test.swift:639:15:639:21 | ...[...] |
280-
| test.swift:641:16:641:25 | [...] [Array element] | test.swift:642:15:642:15 | &... [Array element] |
281-
| test.swift:641:17:641:24 | call to source() | test.swift:641:16:641:25 | [...] [Array element] |
282-
| test.swift:642:15:642:15 | &... [Array element] | test.swift:642:15:642:21 | ...[...] |
280+
| test.swift:642:16:642:25 | [...] [Array element] | test.swift:643:15:643:15 | &... [Array element] |
281+
| test.swift:642:17:642:24 | call to source() | test.swift:642:16:642:25 | [...] [Array element] |
282+
| test.swift:643:15:643:15 | &... [Array element] | test.swift:643:15:643:21 | ...[...] |
283+
| test.swift:645:18:645:29 | [...] [Array element, Array element] | test.swift:647:15:647:15 | &... [Array element, Array element] |
284+
| test.swift:645:19:645:28 | [...] [Array element] | test.swift:645:18:645:29 | [...] [Array element, Array element] |
285+
| test.swift:645:20:645:27 | call to source() | test.swift:645:19:645:28 | [...] [Array element] |
286+
| test.swift:647:15:647:15 | &... [Array element, Array element] | test.swift:647:15:647:23 | ...[...] [Array element] |
287+
| test.swift:647:15:647:23 | &... [Array element] | test.swift:647:15:647:26 | ...[...] |
288+
| test.swift:647:15:647:23 | ...[...] [Array element] | test.swift:647:15:647:23 | &... [Array element] |
283289
nodes
284290
| file://:0:0:0:0 | .a [x] | semmle.label | .a [x] |
285291
| file://:0:0:0:0 | .str | semmle.label | .str |
@@ -584,10 +590,17 @@ nodes
584590
| test.swift:638:15:638:22 | call to source() | semmle.label | call to source() |
585591
| test.swift:639:15:639:15 | &... [Array element] | semmle.label | &... [Array element] |
586592
| test.swift:639:15:639:21 | ...[...] | semmle.label | ...[...] |
587-
| test.swift:641:16:641:25 | [...] [Array element] | semmle.label | [...] [Array element] |
588-
| test.swift:641:17:641:24 | call to source() | semmle.label | call to source() |
589-
| test.swift:642:15:642:15 | &... [Array element] | semmle.label | &... [Array element] |
590-
| test.swift:642:15:642:21 | ...[...] | semmle.label | ...[...] |
593+
| test.swift:642:16:642:25 | [...] [Array element] | semmle.label | [...] [Array element] |
594+
| test.swift:642:17:642:24 | call to source() | semmle.label | call to source() |
595+
| test.swift:643:15:643:15 | &... [Array element] | semmle.label | &... [Array element] |
596+
| test.swift:643:15:643:21 | ...[...] | semmle.label | ...[...] |
597+
| test.swift:645:18:645:29 | [...] [Array element, Array element] | semmle.label | [...] [Array element, Array element] |
598+
| test.swift:645:19:645:28 | [...] [Array element] | semmle.label | [...] [Array element] |
599+
| test.swift:645:20:645:27 | call to source() | semmle.label | call to source() |
600+
| test.swift:647:15:647:15 | &... [Array element, Array element] | semmle.label | &... [Array element, Array element] |
601+
| test.swift:647:15:647:23 | &... [Array element] | semmle.label | &... [Array element] |
602+
| test.swift:647:15:647:23 | ...[...] [Array element] | semmle.label | ...[...] [Array element] |
603+
| test.swift:647:15:647:26 | ...[...] | semmle.label | ...[...] |
591604
subpaths
592605
| test.swift:75:21:75:22 | &... | test.swift:65:16:65:28 | arg1 | test.swift:65:1:70:1 | arg2[return] | test.swift:75:31:75:32 | [post] &... |
593606
| test.swift:114:19:114:19 | arg | test.swift:109:9:109:14 | arg | test.swift:110:12:110:12 | arg | test.swift:114:12:114:22 | call to ... |
@@ -703,4 +716,5 @@ subpaths
703716
| test.swift:631:15:631:15 | x | test.swift:628:9:628:16 | call to source() | test.swift:631:15:631:15 | x | result |
704717
| test.swift:632:15:632:15 | y | test.swift:628:9:628:16 | call to source() | test.swift:632:15:632:15 | y | result |
705718
| test.swift:639:15:639:21 | ...[...] | test.swift:638:15:638:22 | call to source() | test.swift:639:15:639:21 | ...[...] | result |
706-
| test.swift:642:15:642:21 | ...[...] | test.swift:641:17:641:24 | call to source() | test.swift:642:15:642:21 | ...[...] | result |
719+
| test.swift:643:15:643:21 | ...[...] | test.swift:642:17:642:24 | call to source() | test.swift:643:15:643:21 | ...[...] | result |
720+
| test.swift:647:15:647:26 | ...[...] | test.swift:645:20:645:27 | call to source() | test.swift:647:15:647:26 | ...[...] | result |

swift/ql/test/library-tests/dataflow/dataflow/LocalFlow.expected

Lines changed: 32 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -694,8 +694,36 @@
694694
| test.swift:638:5:638:5 | &... | test.swift:639:15:639:15 | arr1 |
695695
| test.swift:638:5:638:5 | [post] &... | test.swift:639:15:639:15 | arr1 |
696696
| test.swift:638:5:638:5 | arr1 | test.swift:638:5:638:5 | &... |
697+
| test.swift:639:15:639:15 | &... | test.swift:640:15:640:15 | arr1 |
698+
| test.swift:639:15:639:15 | [post] &... | test.swift:640:15:640:15 | arr1 |
697699
| test.swift:639:15:639:15 | arr1 | test.swift:639:15:639:15 | &... |
698-
| test.swift:641:9:641:9 | SSA def(arr2) | test.swift:642:15:642:15 | arr2 |
699-
| test.swift:641:9:641:9 | arr2 | test.swift:641:9:641:9 | SSA def(arr2) |
700-
| test.swift:641:16:641:25 | [...] | test.swift:641:9:641:9 | arr2 |
701-
| test.swift:642:15:642:15 | arr2 | test.swift:642:15:642:15 | &... |
700+
| test.swift:642:9:642:9 | SSA def(arr2) | test.swift:643:15:643:15 | arr2 |
701+
| test.swift:642:9:642:9 | arr2 | test.swift:642:9:642:9 | SSA def(arr2) |
702+
| test.swift:642:16:642:25 | [...] | test.swift:642:9:642:9 | arr2 |
703+
| test.swift:643:15:643:15 | &... | test.swift:650:16:650:16 | arr2 |
704+
| test.swift:643:15:643:15 | [post] &... | test.swift:650:16:650:16 | arr2 |
705+
| test.swift:643:15:643:15 | arr2 | test.swift:643:15:643:15 | &... |
706+
| test.swift:645:9:645:9 | SSA def(matrix) | test.swift:646:15:646:15 | matrix |
707+
| test.swift:645:9:645:9 | matrix | test.swift:645:9:645:9 | SSA def(matrix) |
708+
| test.swift:645:18:645:29 | [...] | test.swift:645:9:645:9 | matrix |
709+
| test.swift:646:15:646:15 | &... | test.swift:647:15:647:15 | matrix |
710+
| test.swift:646:15:646:15 | [post] &... | test.swift:647:15:647:15 | matrix |
711+
| test.swift:646:15:646:15 | matrix | test.swift:646:15:646:15 | &... |
712+
| test.swift:647:15:647:15 | matrix | test.swift:647:15:647:15 | &... |
713+
| test.swift:647:15:647:23 | ...[...] | test.swift:647:15:647:23 | &... |
714+
| test.swift:649:9:649:9 | SSA def(arr3) | test.swift:650:23:650:23 | arr3 |
715+
| test.swift:649:9:649:9 | arr3 | test.swift:649:9:649:9 | SSA def(arr3) |
716+
| test.swift:649:16:649:18 | [...] | test.swift:649:9:649:9 | arr3 |
717+
| test.swift:650:9:650:9 | SSA def(arr4) | test.swift:652:15:652:15 | arr4 |
718+
| test.swift:650:9:650:9 | arr4 | test.swift:650:9:650:9 | SSA def(arr4) |
719+
| test.swift:650:16:650:23 | ... .+(_:_:) ... | test.swift:650:9:650:9 | arr4 |
720+
| test.swift:650:23:650:23 | arr3 | test.swift:651:15:651:15 | arr3 |
721+
| test.swift:654:9:654:9 | SSA def(arr5) | test.swift:655:15:655:15 | arr5 |
722+
| test.swift:654:9:654:9 | arr5 | test.swift:654:9:654:9 | SSA def(arr5) |
723+
| test.swift:654:16:654:51 | call to Array<Element>.init(repeating:count:) | test.swift:654:9:654:9 | arr5 |
724+
| test.swift:657:9:657:9 | SSA def(arr6) | test.swift:658:5:658:5 | arr6 |
725+
| test.swift:657:9:657:9 | arr6 | test.swift:657:9:657:9 | SSA def(arr6) |
726+
| test.swift:657:16:657:22 | [...] | test.swift:657:9:657:9 | arr6 |
727+
| test.swift:658:5:658:5 | &... | test.swift:659:15:659:15 | arr6 |
728+
| test.swift:658:5:658:5 | [post] &... | test.swift:659:15:659:15 | arr6 |
729+
| test.swift:658:5:658:5 | arr6 | test.swift:658:5:658:5 | &... |

swift/ql/test/library-tests/dataflow/dataflow/test.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -649,10 +649,10 @@ func testArray() {
649649
var arr3 = [1]
650650
var arr4 = arr2 + arr3
651651
sink(arg: arr3)
652-
sink(arg: arr4) // $ flow=642
652+
sink(arg: arr4) // $ MISSING: flow=642
653653

654654
var arr5 = Array(repeating: source(), count: 2)
655-
sink(arg: arr5) // $ flow=654
655+
sink(arg: arr5) // $ MISSING: flow=654
656656

657657
var arr6 = [1,2,3]
658658
arr6.insert(source(), at: 2)

0 commit comments

Comments
 (0)