Skip to content

Commit 8ba330a

Browse files
committed
Swift: rename conversion predicates
1 parent ace92d0 commit 8ba330a

File tree

138 files changed

+1391
-1672
lines changed

Some content is hidden

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

138 files changed

+1391
-1672
lines changed

swift/codegen/templates/ql_class.mustache

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class {{name}}Base extends Synth::T{{name}}{{#bases}}, {{.}}{{/bases}} {
2929
{{#type_is_class}}
3030
{{type}} getImmediate{{singular}}({{#is_repeated}}int index{{/is_repeated}}) {
3131
{{^ipa}}
32-
result = Synth::convert{{type}}FromDb(Synth::convert{{name}}ToDb(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}}))
32+
result = Synth::fromRaw{{type}}(Synth::toRaw{{name}}(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}}))
3333
{{/ipa}}
3434
{{#ipa}}
3535
none()
@@ -44,7 +44,7 @@ class {{name}}Base extends Synth::T{{name}}{{#bases}}, {{.}}{{/bases}} {
4444
{{^type_is_class}}
4545
{{type}} {{getter}}({{#is_repeated}}int index{{/is_repeated}}) {
4646
{{^ipa}}
47-
{{^is_predicate}}result = {{/is_predicate}}Synth::convert{{name}}ToDb(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}})
47+
{{^is_predicate}}result = {{/is_predicate}}Synth::toRaw{{name}}(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}})
4848
{{/ipa}}
4949
{{#ipa}}
5050
none()

swift/codegen/templates/ql_ipa_types.mustache

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ cached module Synth {
2222
{{/non_final_classes}}
2323

2424
{{#final_classes}}
25-
cached T{{name}} convert{{name}}FromDb(Raw::Element e) {
25+
cached T{{name}} fromRaw{{name}}(Raw::Element e) {
2626
{{^is_fresh_ipa}}
2727
result = T{{name}}(e)
2828
{{/is_fresh_ipa}}
@@ -33,18 +33,18 @@ cached module Synth {
3333
{{/final_classes}}
3434

3535
{{#non_final_classes}}
36-
cached T{{name}} convert{{name}}FromDb(Raw::Element e) {
36+
cached T{{name}} fromRaw{{name}}(Raw::Element e) {
3737
{{#derived}}
3838
{{^first}}
3939
or
4040
{{/first}}
41-
result = convert{{name}}FromDb(e)
41+
result = fromRaw{{name}}(e)
4242
{{/derived}}
4343
}
4444
{{/non_final_classes}}
4545

4646
{{#final_classes}}
47-
cached Raw::Element convert{{name}}ToDb(T{{name}} e) {
47+
cached Raw::Element toRaw{{name}}(T{{name}} e) {
4848
{{^is_fresh_ipa}}
4949
e = T{{name}}(result)
5050
{{/is_fresh_ipa}}
@@ -55,12 +55,12 @@ cached module Synth {
5555
{{/final_classes}}
5656

5757
{{#non_final_classes}}
58-
cached Raw::Element convert{{name}}ToDb(T{{name}} e) {
58+
cached Raw::Element toRaw{{name}}(T{{name}} e) {
5959
{{#derived}}
6060
{{^first}}
6161
or
6262
{{/first}}
63-
result = convert{{name}}ToDb(e)
63+
result = toRaw{{name}}(e)
6464
{{/derived}}
6565
}
6666
{{/non_final_classes}}

swift/ql/lib/codeql/swift/controlflow/BasicBlocks.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ private module JoinBlockPredecessors {
202202
private predicate idOfDbAstNode(Raw::AstNode x, int y) = equivalenceRelation(id/2)(x, y)
203203

204204
// TODO does not work if fresh ipa entities (`ipa: on:`) turn out to be first of the block
205-
private predicate idOf(AstNode x, int y) { idOfDbAstNode(Synth::convertAstNodeToDb(x), y) }
205+
private predicate idOf(AstNode x, int y) { idOfDbAstNode(Synth::toRawAstNode(x), y) }
206206

207207
private AstNode projectToAst(ControlFlowElement n) {
208208
result = n.asAstNode()

swift/ql/lib/codeql/swift/generated/Callable.qll

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,7 @@ import codeql.swift.elements.decl.ParamDecl
77

88
class CallableBase extends Synth::TCallable, Element {
99
ParamDecl getImmediateParam(int index) {
10-
result =
11-
Synth::convertParamDeclFromDb(Synth::convertCallableToDb(this).(Raw::Callable).getParam(index))
10+
result = Synth::fromRawParamDecl(Synth::toRawCallable(this).(Raw::Callable).getParam(index))
1211
}
1312

1413
final ParamDecl getParam(int index) { result = getImmediateParam(index).resolve() }
@@ -18,8 +17,7 @@ class CallableBase extends Synth::TCallable, Element {
1817
final int getNumberOfParams() { result = count(getAParam()) }
1918

2019
BraceStmt getImmediateBody() {
21-
result =
22-
Synth::convertBraceStmtFromDb(Synth::convertCallableToDb(this).(Raw::Callable).getBody())
20+
result = Synth::fromRawBraceStmt(Synth::toRawCallable(this).(Raw::Callable).getBody())
2321
}
2422

2523
final BraceStmt getBody() { result = getImmediateBody().resolve() }

swift/ql/lib/codeql/swift/generated/Comment.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,5 +6,5 @@ import codeql.swift.elements.Locatable
66
class CommentBase extends Synth::TComment, Locatable {
77
override string getAPrimaryQlClass() { result = "Comment" }
88

9-
string getText() { result = Synth::convertCommentToDb(this).(Raw::Comment).getText() }
9+
string getText() { result = Synth::toRawComment(this).(Raw::Comment).getText() }
1010
}

swift/ql/lib/codeql/swift/generated/Element.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,5 +17,5 @@ class ElementBase extends Synth::TElement {
1717
result = getResolveStep().resolve()
1818
}
1919

20-
predicate isUnknown() { Synth::convertElementToDb(this).isUnknown() }
20+
predicate isUnknown() { Synth::toRawElement(this).isUnknown() }
2121
}

swift/ql/lib/codeql/swift/generated/File.qll

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@ private import codeql.swift.generated.Raw
44
import codeql.swift.elements.Element
55

66
class FileBase extends Synth::TFile, Element {
7-
string getName() { result = Synth::convertFileToDb(this).(Raw::File).getName() }
7+
string getName() { result = Synth::toRawFile(this).(Raw::File).getName() }
88
}

swift/ql/lib/codeql/swift/generated/Locatable.qll

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ import codeql.swift.elements.Location
66

77
class LocatableBase extends Synth::TLocatable, Element {
88
Location getImmediateLocation() {
9-
result =
10-
Synth::convertLocationFromDb(Synth::convertLocatableToDb(this).(Raw::Locatable).getLocation())
9+
result = Synth::fromRawLocation(Synth::toRawLocatable(this).(Raw::Locatable).getLocation())
1110
}
1211

1312
final Location getLocation() { result = getImmediateLocation().resolve() }

swift/ql/lib/codeql/swift/generated/Location.qll

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,18 +6,16 @@ import codeql.swift.elements.File
66

77
class LocationBase extends Synth::TLocation, Element {
88
File getImmediateFile() {
9-
result = Synth::convertFileFromDb(Synth::convertLocationToDb(this).(Raw::Location).getFile())
9+
result = Synth::fromRawFile(Synth::toRawLocation(this).(Raw::Location).getFile())
1010
}
1111

1212
final File getFile() { result = getImmediateFile().resolve() }
1313

14-
int getStartLine() { result = Synth::convertLocationToDb(this).(Raw::Location).getStartLine() }
14+
int getStartLine() { result = Synth::toRawLocation(this).(Raw::Location).getStartLine() }
1515

16-
int getStartColumn() {
17-
result = Synth::convertLocationToDb(this).(Raw::Location).getStartColumn()
18-
}
16+
int getStartColumn() { result = Synth::toRawLocation(this).(Raw::Location).getStartColumn() }
1917

20-
int getEndLine() { result = Synth::convertLocationToDb(this).(Raw::Location).getEndLine() }
18+
int getEndLine() { result = Synth::toRawLocation(this).(Raw::Location).getEndLine() }
2119

22-
int getEndColumn() { result = Synth::convertLocationToDb(this).(Raw::Location).getEndColumn() }
20+
int getEndColumn() { result = Synth::toRawLocation(this).(Raw::Location).getEndColumn() }
2321
}

0 commit comments

Comments
 (0)