Skip to content

Commit 5f3a039

Browse files
committed
Swift: Sync changes to DataFlowImplCommon from PR github#9024.
1 parent 8cc509e commit 5f3a039

File tree

1 file changed

+22
-15
lines changed

1 file changed

+22
-15
lines changed

swift/ql/lib/codeql/swift/dataflow/internal/DataFlowImplCommon.qll

Lines changed: 22 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -788,24 +788,31 @@ private module Cached {
788788
cached
789789
predicate readSet(Node node1, ContentSet c, Node node2) { readStep(node1, c, node2) }
790790

791+
cached
792+
predicate storeSet(
793+
Node node1, ContentSet c, Node node2, DataFlowType contentType, DataFlowType containerType
794+
) {
795+
storeStep(node1, c, node2) and
796+
contentType = getNodeDataFlowType(node1) and
797+
containerType = getNodeDataFlowType(node2)
798+
or
799+
exists(Node n1, Node n2 |
800+
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
801+
n2 = node2.(PostUpdateNode).getPreUpdateNode()
802+
|
803+
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, c, contentType), n1)
804+
or
805+
readSet(n2, c, n1) and
806+
contentType = getNodeDataFlowType(n1) and
807+
containerType = getNodeDataFlowType(n2)
808+
)
809+
}
810+
791811
private predicate store(
792812
Node node1, Content c, Node node2, DataFlowType contentType, DataFlowType containerType
793813
) {
794-
exists(ContentSet cs | c = cs.getAStoreContent() |
795-
storeStep(node1, cs, node2) and
796-
contentType = getNodeDataFlowType(node1) and
797-
containerType = getNodeDataFlowType(node2)
798-
or
799-
exists(Node n1, Node n2 |
800-
n1 = node1.(PostUpdateNode).getPreUpdateNode() and
801-
n2 = node2.(PostUpdateNode).getPreUpdateNode()
802-
|
803-
argumentValueFlowsThrough(n2, TReadStepTypesSome(containerType, cs, contentType), n1)
804-
or
805-
readSet(n2, cs, n1) and
806-
contentType = getNodeDataFlowType(n1) and
807-
containerType = getNodeDataFlowType(n2)
808-
)
814+
exists(ContentSet cs |
815+
c = cs.getAStoreContent() and storeSet(node1, cs, node2, contentType, containerType)
809816
)
810817
}
811818

0 commit comments

Comments
 (0)