mirror of
https://github.com/github/codeql.git
synced 2026-02-12 13:11:20 +01:00
As `ASTMangler` crashes when called on `ModuleDecl`, we simply use its name. This might probably not work reliably in a scenario where multiple modules are compiled with the same name (like `main`), but this is left for future work. At the moment this cannot create DB inconsistencies.
29 lines
682 B
Plaintext
29 lines
682 B
Plaintext
private import codeql.swift.elements
|
|
|
|
cached
|
|
predicate toBeTested(Element e) {
|
|
e instanceof File
|
|
or
|
|
exists(ModuleDecl m | m = e and not m.isBuiltinModule() and not m.isSystemModule())
|
|
or
|
|
exists(Locatable loc |
|
|
loc.getLocation().getFile().getName().matches("%swift/ql/test%") and
|
|
(
|
|
e = loc
|
|
or
|
|
exists(Type t |
|
|
(e = t or e = t.(ExistentialType).getConstraint() or e = t.getCanonicalType()) and
|
|
(
|
|
t = loc.(ValueDecl).getInterfaceType()
|
|
or
|
|
t = loc.(NominalTypeDecl).getType()
|
|
or
|
|
t = loc.(VarDecl).getType()
|
|
or
|
|
t = loc.(Expr).getType()
|
|
)
|
|
)
|
|
)
|
|
)
|
|
}
|