Skip to content

Commit 60bdcac

Browse files
committed
unified: Add consistency exclusion, but record the miss in a test case
1 parent 99220ea commit 60bdcac

3 files changed

Lines changed: 13 additions & 3 deletions

File tree

‎unified/ql/consistency-queries/DataFlowConsistency.ql‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ module ConsistencyInput implements InputSig<Location, DataFlowInput> {
66
predicate argHasPostUpdateExclude(DataFlowInput::ArgumentNode n) {
77
not exists(n.getBasicBlock()) // ignore unreachable data flow nodes
88
}
9+
10+
predicate reverseReadExclude(DataFlow::Node n) {
11+
// When read steps are contributed by a language plugin we currently don't expect them to
12+
// have post-update nodes for reverse-reads.
13+
any(DataFlowPlugin p).step(n, any(Step s | s.read(_)), _)
14+
}
915
}
1016

1117
module ConsistencyOutput =
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
reverseRead
2-
| cfg.swift:130:13:130:15 | opt | Origin of readStep is missing a PostUpdateNode. |
3-
| cfg.swift:131:13:131:15 | opt | Origin of readStep is missing a PostUpdateNode. |

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -221,3 +221,10 @@ func t25() {
221221
}
222222

223223
}
224+
225+
func t26() {
226+
// TODO: This flow requires reverse-read through the "!" operator
227+
var opt = Optional.some(("x", "y"))
228+
opt!.0 = source("t26.1")
229+
sink(opt!.0) // $ MISSING: hasValueFlow=t26.1
230+
}

0 commit comments

Comments
 (0)