Skip to content

Commit dcd01be

Browse files
committed
Swift: Cache Element.toString
1 parent d1ad65a commit dcd01be

File tree

127 files changed

+163
-145
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

127 files changed

+163
-145
lines changed

swift/ql/.generated.list

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

swift/ql/lib/codeql/swift/elements/decl/internal/AccessorImpl.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ module Impl {
2525
this instanceof WillSetObserver or this instanceof DidSetObserver
2626
}
2727

28-
override string toString() {
28+
override string toStringImpl() {
2929
isKnownAccessorKind(this, result)
3030
or
3131
not isKnownAccessorKind(this, _) and
32-
result = super.toString()
32+
result = super.toStringImpl()
3333
}
3434
}
3535
}

swift/ql/lib/codeql/swift/elements/decl/internal/CapturedDeclImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ module Impl {
77
* A captured variable or function parameter in the scope of a closure.
88
*/
99
class CapturedDecl extends Generated::CapturedDecl {
10-
override string toString() { result = this.getDecl().toString() }
10+
override string toStringImpl() { result = this.getDecl().toStringImpl() }
1111

1212
/**
1313
* Gets the closure or function that captures this variable.

swift/ql/lib/codeql/swift/elements/decl/internal/DeclImpl.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ private import codeql.swift.elements.decl.ExtensionDecl
44

55
module Impl {
66
class Decl extends Generated::Decl {
7-
override string toString() { result = super.toString() }
7+
// needed to avoid spurious non-monotonicity error
8+
override string toStringImpl() { result = super.toStringImpl() }
89

910
/**
1011
* Gets the `NominalTypeDecl` corresponding to this `Decl`, if any. This

swift/ql/lib/codeql/swift/elements/decl/internal/DeinitializerImpl.qll

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@ module Impl {
66
* A deinitializer of a class.
77
*/
88
class Deinitializer extends Generated::Deinitializer {
9-
override string toString() { result = this.getSelfParam().getType() + "." + super.toString() }
9+
override string toStringImpl() {
10+
result = this.getSelfParam().getType().toStringImpl() + "." + super.toStringImpl()
11+
}
1012
}
1113
}

swift/ql/lib/codeql/swift/elements/decl/internal/EnumCaseDeclImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ private import codeql.swift.generated.decl.EnumCaseDecl
22

33
module Impl {
44
class EnumCaseDecl extends Generated::EnumCaseDecl {
5-
override string toString() { result = "case ..." }
5+
override string toStringImpl() { result = "case ..." }
66
}
77
}

swift/ql/lib/codeql/swift/elements/decl/internal/EnumElementDeclImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ module Impl {
1212
* ```
1313
*/
1414
class EnumElementDecl extends Generated::EnumElementDecl {
15-
override string toString() { result = this.getName() }
15+
override string toStringImpl() { result = this.getName() }
1616

1717
/**
1818
* Holds if this enum element declaration is called `enumElementName` and is a member of an

swift/ql/lib/codeql/swift/elements/decl/internal/ExtensionDeclImpl.qll

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,10 @@ private import codeql.swift.generated.decl.ExtensionDecl
22

33
module Impl {
44
class ExtensionDecl extends Generated::ExtensionDecl {
5-
override string toString() {
5+
override string toStringImpl() {
66
result =
7-
"extension of " + unique(NominalTypeDecl td | td = this.getExtendedTypeDecl()).toString()
7+
"extension of " +
8+
unique(NominalTypeDecl td | td = this.getExtendedTypeDecl()).toStringImpl()
89
or
910
count(this.getExtendedTypeDecl()) != 1 and
1011
result = "extension"

swift/ql/lib/codeql/swift/elements/decl/internal/FunctionImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module Impl {
66
* A function.
77
*/
88
class Function extends Generated::Function {
9-
override string toString() { result = this.getName() }
9+
override string toStringImpl() { result = this.getName() }
1010

1111
/**
1212
* Gets the name of this function, without the argument list. For example

swift/ql/lib/codeql/swift/elements/decl/internal/IfConfigDeclImpl.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ private import codeql.swift.generated.decl.IfConfigDecl
22

33
module Impl {
44
class IfConfigDecl extends Generated::IfConfigDecl {
5-
override string toString() { result = "#if ..." }
5+
override string toStringImpl() { result = "#if ..." }
66
}
77
}

0 commit comments

Comments
 (0)