Files
codeql/swift/ql/test/library-tests/elements/expr/methodlookup/getStaticTarget.ql
Nora Dimitrijević ea6c69dd34 Swift: fix test with different linux/macos results
`methodlookup.swift` has one more call to `Builtin.zeroInitializer()`
in macOS than it does in Linux.
2022-12-15 11:48:43 -05:00

17 lines
522 B
Plaintext

import swift
query predicate noStaticTarget(CallExpr c, Expr func, string funcClass) {
not exists(c.getStaticTarget()) and
func = c.getFunction() and
funcClass = func.getPrimaryQlClasses()
}
from CallExpr c, boolean hasStaticTarget
where
if exists(c.getStaticTarget().toString())
then
hasStaticTarget = true and
not c.getStaticTarget().toString() = "zeroInitializer()" // Omit because a different number of these calls appear in linux and macos
else hasStaticTarget = false
select c, hasStaticTarget