Skip to content

Commit fa86e75

Browse files
geoffw0MathiasVP
andauthored
Update swift/ql/lib/codeql/swift/dataflow/internal/DataFlowPrivate.qll
Co-authored-by: Mathias Vorreiter Pedersen <[email protected]>
1 parent 1b6317d commit fa86e75

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

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

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -155,16 +155,14 @@ private module Cached {
155155
or
156156
// flow through nil-coalescing operator `??`
157157
exists(BinaryExpr nco |
158-
nco.getFunction().(DeclRefExpr).getDecl().(FreeFunctionDecl).getName() = "??(_:_:)" and
159-
(
160-
// value argument
161-
nodeFrom.asExpr() = nco.getAnOperand()
162-
or
163-
// unpack closure (the second argument is typically an `AutoClosureExpr` argument)
164-
nodeFrom.asExpr() =
165-
nco.getAnOperand().(AbstractClosureExpr).getBody().getAnElement().(ReturnStmt).getResult()
166-
) and
158+
nco.getStaticTarget().(FreeFunctionDecl).getName() = "??(_:_:)" and
167159
nodeTo.asExpr() = nco
160+
|
161+
// value argument
162+
nodeFrom.asExpr() = nco.getAnOperand()
163+
or
164+
// unpack closure (the second argument is typically an `AutoClosureExpr` argument)
165+
nodeFrom.asExpr() = nco.getAnOperand().(AutoClosureExpr).getReturn().getResult()
168166
)
169167
or
170168
// flow through ternary operator `? :`

0 commit comments

Comments
 (0)