Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion swift/ql/test/TestUtils.qll
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import codeql.swift.elements.expr.internal.DotSyntaxCallExpr

cached
predicate toBeTested(Element e) {
e instanceof File
e instanceof File and
(exists(e.(File).getRelativePath()) or e instanceof UnknownFile)
or
e instanceof ParameterizedProtocolType
or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ string describe(Decl d) {
}

from Decl d
where d.getLocation().getFile().getName() != ""
where exists(d.getLocation().getFile().getRelativePath())
select d, strictconcat(describe(d), ", ")
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,6 @@ string describe(Function f) {

from Function f
where
not f.getFile() instanceof UnknownFile and
exists(f.getFile().getRelativePath()) and
not f.getName().matches("%init%")
select f, concat(describe(f), ", ")
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ string describe(Type t) {

from VarDecl v, Type t
where
v.getLocation().getFile().getBaseName() != "" and
exists(v.getLocation().getFile().getRelativePath()) and
not v.getName() = "self" and
t = v.getType()
select v, t.toString(), concat(describe(t), ", ")
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ string describe(TypeDecl td) {

from VarDecl v, TypeDecl td
where
v.getLocation().getFile().getBaseName() != "" and
exists(v.getLocation().getFile().getRelativePath()) and
not v.getName() = "self" and
(
td = v.getType().(NominalType).getDeclaration() or
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,6 @@ string describe(Type t) {

from VarDecl v, Type t
where
v.getLocation().getFile().getBaseName() != "" and
exists(v.getLocation().getFile().getRelativePath()) and
t = v.getType()
select v, t.toString(), concat(describe(t), ", ")
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ string describe(Type t) {

from VarDecl v, Type t
where
v.getLocation().getFile().getBaseName() != "" and
exists(v.getLocation().getFile().getRelativePath()) and
t = v.getType()
select v, t.toString(), strictconcat(describe(t), ", ")
1 change: 1 addition & 0 deletions swift/ql/test/query-tests/Diagnostics/Info.ql
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,5 @@ import swift
string describe(File f) { (f.isSuccessfullyExtracted() and result = "isSuccessfullyExtracted") }

from File f
where exists(f.getRelativePath()) or f instanceof UnknownFile
select f, concat(f.getRelativePath(), ", "), concat(describe(f), ", ")
Loading