mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Merge pull request #10869 from github/redsun82/swift-no-base-suffix
Swift: replace `Base` suffix with `Generated::` module
This commit is contained in:
@@ -157,10 +157,10 @@ def get_types_used_by(cls: ql.Class) -> typing.Iterable[str]:
|
||||
|
||||
|
||||
def get_classes_used_by(cls: ql.Class) -> typing.List[str]:
|
||||
return sorted(set(t for t in get_types_used_by(cls) if t[0].isupper()))
|
||||
return sorted(set(t for t in get_types_used_by(cls) if t[0].isupper() and t != cls.name))
|
||||
|
||||
|
||||
_generated_stub_re = re.compile(r"\n*private import .*\n+class \w+ extends \w+ \{[ \n]?\}", re.MULTILINE)
|
||||
_generated_stub_re = re.compile(r"\n*private import .*\n+class \w+ extends Generated::\w+ \{[ \n]?\}", re.MULTILINE)
|
||||
|
||||
|
||||
def _is_generated_stub(file: pathlib.Path) -> bool:
|
||||
|
||||
@@ -5,69 +5,71 @@ private import codeql.swift.generated.Raw
|
||||
import {{.}}
|
||||
{{/imports}}
|
||||
|
||||
class {{name}}Base extends Synth::T{{name}}{{#bases}}, {{.}}{{/bases}} {
|
||||
{{#root}}
|
||||
string toString() { none() } // overridden by subclasses
|
||||
module Generated {
|
||||
class {{name}} extends Synth::T{{name}}{{#bases}}, {{.}}{{/bases}} {
|
||||
{{#root}}
|
||||
string toString() { none() } // overridden by subclasses
|
||||
|
||||
string getAPrimaryQlClass() { none() } // overridden by subclasses
|
||||
string getAPrimaryQlClass() { none() } // overridden by subclasses
|
||||
|
||||
final string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") }
|
||||
final string getPrimaryQlClasses() { result = concat(this.getAPrimaryQlClass(), ",") }
|
||||
|
||||
{{name}}Base getResolveStep() { none() } // overridden by subclasses
|
||||
{{name}} getResolveStep() { none() } // overridden by subclasses
|
||||
|
||||
final {{name}}Base resolve() {
|
||||
not exists(getResolveStep()) and result = this
|
||||
or
|
||||
result = getResolveStep().resolve()
|
||||
final {{name}} resolve() {
|
||||
not exists(getResolveStep()) and result = this
|
||||
or
|
||||
result = getResolveStep().resolve()
|
||||
}
|
||||
{{/root}}
|
||||
{{#final}}
|
||||
override string getAPrimaryQlClass() { result = "{{name}}" }
|
||||
{{/final}}
|
||||
{{#properties}}
|
||||
|
||||
{{#type_is_class}}
|
||||
{{type}} getImmediate{{singular}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
{{^ipa}}
|
||||
result = Synth::convert{{type}}FromRaw(Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}}))
|
||||
{{/ipa}}
|
||||
{{#ipa}}
|
||||
none()
|
||||
{{/ipa}}
|
||||
}
|
||||
|
||||
final {{type}} {{getter}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
result = getImmediate{{singular}}({{#is_repeated}}index{{/is_repeated}}).resolve()
|
||||
}
|
||||
|
||||
{{/type_is_class}}
|
||||
{{^type_is_class}}
|
||||
{{type}} {{getter}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
{{^ipa}}
|
||||
{{^is_predicate}}result = {{/is_predicate}}Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}})
|
||||
{{/ipa}}
|
||||
{{#ipa}}
|
||||
none()
|
||||
{{/ipa}}
|
||||
}
|
||||
|
||||
{{/type_is_class}}
|
||||
{{#is_optional}}
|
||||
final predicate has{{singular}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
exists({{getter}}({{#is_repeated}}index{{/is_repeated}}))
|
||||
}
|
||||
{{/is_optional}}
|
||||
{{#is_repeated}}
|
||||
|
||||
final {{type}} {{indefinite_getter}}() {
|
||||
result = {{getter}}(_)
|
||||
}
|
||||
{{^is_optional}}
|
||||
|
||||
final int getNumberOf{{plural}}() {
|
||||
result = count({{indefinite_getter}}())
|
||||
}
|
||||
{{/is_optional}}
|
||||
{{/is_repeated}}
|
||||
{{/properties}}
|
||||
}
|
||||
{{/root}}
|
||||
{{#final}}
|
||||
override string getAPrimaryQlClass() { result = "{{name}}" }
|
||||
{{/final}}
|
||||
{{#properties}}
|
||||
|
||||
{{#type_is_class}}
|
||||
{{type}} getImmediate{{singular}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
{{^ipa}}
|
||||
result = Synth::convert{{type}}FromRaw(Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}}))
|
||||
{{/ipa}}
|
||||
{{#ipa}}
|
||||
none()
|
||||
{{/ipa}}
|
||||
}
|
||||
|
||||
final {{type}} {{getter}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
result = getImmediate{{singular}}({{#is_repeated}}index{{/is_repeated}}).resolve()
|
||||
}
|
||||
|
||||
{{/type_is_class}}
|
||||
{{^type_is_class}}
|
||||
{{type}} {{getter}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
{{^ipa}}
|
||||
{{^is_predicate}}result = {{/is_predicate}}Synth::convert{{name}}ToRaw(this){{^root}}.(Raw::{{name}}){{/root}}.{{getter}}({{#is_repeated}}index{{/is_repeated}})
|
||||
{{/ipa}}
|
||||
{{#ipa}}
|
||||
none()
|
||||
{{/ipa}}
|
||||
}
|
||||
|
||||
{{/type_is_class}}
|
||||
{{#is_optional}}
|
||||
final predicate has{{singular}}({{#is_repeated}}int index{{/is_repeated}}) {
|
||||
exists({{getter}}({{#is_repeated}}index{{/is_repeated}}))
|
||||
}
|
||||
{{/is_optional}}
|
||||
{{#is_repeated}}
|
||||
|
||||
final {{type}} {{indefinite_getter}}() {
|
||||
result = {{getter}}(_)
|
||||
}
|
||||
{{^is_optional}}
|
||||
|
||||
final int getNumberOf{{plural}}() {
|
||||
result = count({{indefinite_getter}}())
|
||||
}
|
||||
{{/is_optional}}
|
||||
{{/is_repeated}}
|
||||
{{/properties}}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by {{generator}}, remove this comment if you wish to edit this file
|
||||
private import {{base_import}}
|
||||
|
||||
class {{name}} extends {{name}}Base {}
|
||||
class {{name}} extends Generated::{{name}} {}
|
||||
|
||||
@@ -425,7 +425,7 @@ def test_non_empty_cleanup(opts, generate, renderer):
|
||||
test_c = opts.ql_test_output / "B.txt"
|
||||
write(ql_a)
|
||||
write(ql_b)
|
||||
write(stub_a, "// generated\nprivate import bla\n\nclass foo extends bar {\n}\n")
|
||||
write(stub_a, "// generated\nprivate import bla\n\nclass foo extends Generated::bar {\n}\n")
|
||||
write(stub_b, "bar\n")
|
||||
write(test_a)
|
||||
write(test_b)
|
||||
@@ -437,7 +437,7 @@ def test_non_empty_cleanup(opts, generate, renderer):
|
||||
|
||||
def test_modified_stub_still_generated(qlgen_opts, renderer):
|
||||
stub = qlgen_opts.ql_stub_output / "A.qll"
|
||||
write(stub, "// generated\nprivate import bla\n\nclass foo extends bar, baz {\n}\n")
|
||||
write(stub, "// generated\nprivate import bla\n\nclass foo extends Generated::bar, baz {\n}\n")
|
||||
with pytest.raises(qlgen.ModifiedStubMarkedAsGeneratedError):
|
||||
run_generation(qlgen.generate, qlgen_opts, renderer)
|
||||
|
||||
@@ -445,7 +445,8 @@ def test_modified_stub_still_generated(qlgen_opts, renderer):
|
||||
def test_extended_stub_still_generated(qlgen_opts, renderer):
|
||||
stub = qlgen_opts.ql_stub_output / "A.qll"
|
||||
write(stub,
|
||||
"// generated\nprivate import bla\n\nclass foo extends bar {\n}\n\nclass other {\n other() { none() }\n}")
|
||||
"// generated\nprivate import bla\n\nclass foo extends Generated::bar {\n}\n\n"
|
||||
"class other {\n other() { none() }\n}")
|
||||
with pytest.raises(qlgen.ModifiedStubMarkedAsGeneratedError):
|
||||
run_generation(qlgen.generate, qlgen_opts, renderer)
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@ private module Cached {
|
||||
}
|
||||
}
|
||||
|
||||
class AstNode extends AstNodeBase {
|
||||
class AstNode extends Generated::AstNode {
|
||||
final AbstractFunctionDecl getEnclosingFunction() { result = Cached::getEnclosingFunction(this) }
|
||||
|
||||
final Decl getEnclosingDecl() { result = Cached::getEnclosingDecl(this) }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private import codeql.swift.generated.Callable
|
||||
private import codeql.swift.elements.AstNode
|
||||
|
||||
class Callable extends CallableBase, AstNode { }
|
||||
class Callable extends Generated::Callable, AstNode { }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
private import codeql.swift.generated.Comment
|
||||
|
||||
class Comment extends CommentBase {
|
||||
class Comment extends Generated::Comment {
|
||||
/** toString */
|
||||
override string toString() { result = this.getText() }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.DbFile
|
||||
|
||||
class DbFile extends DbFileBase { }
|
||||
class DbFile extends Generated::DbFile { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.DbLocation
|
||||
|
||||
class DbLocation extends DbLocationBase { }
|
||||
class DbLocation extends Generated::DbLocation { }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
private import codeql.swift.generated.Element
|
||||
|
||||
class Element extends ElementBase {
|
||||
class Element extends Generated::Element {
|
||||
private predicate resolvesFrom(Element e) { e.getResolveStep() = this }
|
||||
|
||||
override string toString() { result = this.getPrimaryQlClasses() }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
private import codeql.swift.generated.File
|
||||
|
||||
class File extends FileBase {
|
||||
class File extends Generated::File {
|
||||
/** toString */
|
||||
override string toString() { result = this.getAbsolutePath() }
|
||||
|
||||
|
||||
@@ -2,12 +2,13 @@ private import codeql.swift.generated.Locatable
|
||||
private import codeql.swift.elements.File
|
||||
private import codeql.swift.elements.UnknownLocation
|
||||
|
||||
class Locatable extends LocatableBase {
|
||||
class Locatable extends Generated::Locatable {
|
||||
pragma[nomagic]
|
||||
override Location getImmediateLocation() {
|
||||
result = LocatableBase.super.getImmediateLocation()
|
||||
result = Generated::Locatable.super.getImmediateLocation()
|
||||
or
|
||||
not exists(LocatableBase.super.getImmediateLocation()) and result instanceof UnknownLocation
|
||||
not exists(Generated::Locatable.super.getImmediateLocation()) and
|
||||
result instanceof UnknownLocation
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,7 +3,7 @@ private import codeql.swift.generated.Location
|
||||
/**
|
||||
* A location of a program element.
|
||||
*/
|
||||
class Location extends LocationBase {
|
||||
class Location extends Generated::Location {
|
||||
/**
|
||||
* Holds if this location is described by `path`, `startLine`, `startColumn`, `endLine` and `endColumn`.
|
||||
*/
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.UnknownFile
|
||||
|
||||
class UnknownFile extends UnknownFileBase {
|
||||
class UnknownFile extends Generated::UnknownFile {
|
||||
override string getName() { result = "" }
|
||||
}
|
||||
|
||||
@@ -5,7 +5,7 @@ private import codeql.swift.elements.File
|
||||
/**
|
||||
* A `Location` that is given to something that is not associated with any position in the source code.
|
||||
*/
|
||||
class UnknownLocation extends UnknownLocationBase {
|
||||
class UnknownLocation extends Generated::UnknownLocation {
|
||||
override File getImmediateFile() { result instanceof UnknownFile }
|
||||
|
||||
override int getStartLine() { result = 0 }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.UnresolvedElement
|
||||
|
||||
class UnresolvedElement extends UnresolvedElementBase { }
|
||||
class UnresolvedElement extends Generated::UnresolvedElement { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.AbstractFunctionDecl
|
||||
|
||||
class AbstractFunctionDecl extends AbstractFunctionDeclBase {
|
||||
class AbstractFunctionDecl extends Generated::AbstractFunctionDecl {
|
||||
override string toString() { result = this.getName() }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.AbstractStorageDecl
|
||||
|
||||
class AbstractStorageDecl extends AbstractStorageDeclBase { }
|
||||
class AbstractStorageDecl extends Generated::AbstractStorageDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.AbstractTypeParamDecl
|
||||
|
||||
class AbstractTypeParamDecl extends AbstractTypeParamDeclBase { }
|
||||
class AbstractTypeParamDecl extends Generated::AbstractTypeParamDecl { }
|
||||
|
||||
@@ -10,7 +10,7 @@ private predicate isKnownAccessorKind(AccessorDecl decl, string kind) {
|
||||
decl.isDidSet() and kind = "didSet"
|
||||
}
|
||||
|
||||
class AccessorDecl extends AccessorDeclBase {
|
||||
class AccessorDecl extends Generated::AccessorDecl {
|
||||
predicate isPropertyObserver() {
|
||||
this instanceof WillSetObserver or this instanceof DidSetObserver
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.AssociatedTypeDecl
|
||||
|
||||
class AssociatedTypeDecl extends AssociatedTypeDeclBase { }
|
||||
class AssociatedTypeDecl extends Generated::AssociatedTypeDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.ClassDecl
|
||||
|
||||
class ClassDecl extends ClassDeclBase { }
|
||||
class ClassDecl extends Generated::ClassDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.ConcreteFuncDecl
|
||||
|
||||
class ConcreteFuncDecl extends ConcreteFuncDeclBase { }
|
||||
class ConcreteFuncDecl extends Generated::ConcreteFuncDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.ConcreteVarDecl
|
||||
|
||||
class ConcreteVarDecl extends ConcreteVarDeclBase { }
|
||||
class ConcreteVarDecl extends Generated::ConcreteVarDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.ConstructorDecl
|
||||
|
||||
class ConstructorDecl extends ConstructorDeclBase { }
|
||||
class ConstructorDecl extends Generated::ConstructorDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.Decl
|
||||
|
||||
class Decl extends DeclBase { }
|
||||
class Decl extends Generated::Decl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.DestructorDecl
|
||||
|
||||
class DestructorDecl extends DestructorDeclBase { }
|
||||
class DestructorDecl extends Generated::DestructorDecl { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.EnumCaseDecl
|
||||
|
||||
class EnumCaseDecl extends EnumCaseDeclBase {
|
||||
class EnumCaseDecl extends Generated::EnumCaseDecl {
|
||||
override string toString() { result = "case ..." }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.EnumDecl
|
||||
|
||||
class EnumDecl extends EnumDeclBase { }
|
||||
class EnumDecl extends Generated::EnumDecl { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.EnumElementDecl
|
||||
|
||||
class EnumElementDecl extends EnumElementDeclBase {
|
||||
class EnumElementDecl extends Generated::EnumElementDecl {
|
||||
override string toString() { result = this.getName() }
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
private import codeql.swift.generated.decl.ExtensionDecl
|
||||
|
||||
class ExtensionDecl extends ExtensionDeclBase {
|
||||
class ExtensionDecl extends Generated::ExtensionDecl {
|
||||
override string toString() {
|
||||
result = "extension" // TODO: Once we extract the name of this one we can provide a better `toString`.
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.FuncDecl
|
||||
|
||||
class FuncDecl extends FuncDeclBase { }
|
||||
class FuncDecl extends Generated::FuncDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.GenericContext
|
||||
|
||||
class GenericContext extends GenericContextBase { }
|
||||
class GenericContext extends Generated::GenericContext { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.GenericTypeDecl
|
||||
|
||||
class GenericTypeDecl extends GenericTypeDeclBase { }
|
||||
class GenericTypeDecl extends Generated::GenericTypeDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.GenericTypeParamDecl
|
||||
|
||||
class GenericTypeParamDecl extends GenericTypeParamDeclBase { }
|
||||
class GenericTypeParamDecl extends Generated::GenericTypeParamDecl { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.IfConfigDecl
|
||||
|
||||
class IfConfigDecl extends IfConfigDeclBase {
|
||||
class IfConfigDecl extends Generated::IfConfigDecl {
|
||||
override string toString() { result = "#if ..." }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.ImportDecl
|
||||
|
||||
class ImportDecl extends ImportDeclBase {
|
||||
class ImportDecl extends Generated::ImportDecl {
|
||||
override string toString() { result = "import ..." }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.InfixOperatorDecl
|
||||
|
||||
class InfixOperatorDecl extends InfixOperatorDeclBase { }
|
||||
class InfixOperatorDecl extends Generated::InfixOperatorDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.IterableDeclContext
|
||||
|
||||
class IterableDeclContext extends IterableDeclContextBase { }
|
||||
class IterableDeclContext extends Generated::IterableDeclContext { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.MissingMemberDecl
|
||||
|
||||
class MissingMemberDecl extends MissingMemberDeclBase { }
|
||||
class MissingMemberDecl extends Generated::MissingMemberDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.ModuleDecl
|
||||
|
||||
class ModuleDecl extends ModuleDeclBase { }
|
||||
class ModuleDecl extends Generated::ModuleDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.NominalTypeDecl
|
||||
|
||||
class NominalTypeDecl extends NominalTypeDeclBase { }
|
||||
class NominalTypeDecl extends Generated::NominalTypeDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.OpaqueTypeDecl
|
||||
|
||||
class OpaqueTypeDecl extends OpaqueTypeDeclBase { }
|
||||
class OpaqueTypeDecl extends Generated::OpaqueTypeDecl { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.OperatorDecl
|
||||
|
||||
class OperatorDecl extends OperatorDeclBase {
|
||||
class OperatorDecl extends Generated::OperatorDecl {
|
||||
override string toString() { result = this.getName() }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
private import codeql.swift.generated.decl.ParamDecl
|
||||
private import codeql.swift.elements.Callable
|
||||
|
||||
class ParamDecl extends ParamDeclBase {
|
||||
class ParamDecl extends Generated::ParamDecl {
|
||||
/** Gets the function which declares this parameter. */
|
||||
Callable getDeclaringFunction() { result.getAParam() = this }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.PatternBindingDecl
|
||||
|
||||
class PatternBindingDecl extends PatternBindingDeclBase {
|
||||
class PatternBindingDecl extends Generated::PatternBindingDecl {
|
||||
override string toString() { result = "var ... = ..." }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.PostfixOperatorDecl
|
||||
|
||||
class PostfixOperatorDecl extends PostfixOperatorDeclBase { }
|
||||
class PostfixOperatorDecl extends Generated::PostfixOperatorDecl { }
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
private import codeql.swift.generated.decl.PoundDiagnosticDecl
|
||||
|
||||
class PoundDiagnosticDecl extends PoundDiagnosticDeclBase {
|
||||
class PoundDiagnosticDecl extends Generated::PoundDiagnosticDecl {
|
||||
override string toString() {
|
||||
result = "#..." // TODO: Once we extract whether this is an error or a warning we can improve this.
|
||||
}
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
private import codeql.swift.generated.decl.PrecedenceGroupDecl
|
||||
|
||||
class PrecedenceGroupDecl extends PrecedenceGroupDeclBase {
|
||||
class PrecedenceGroupDecl extends Generated::PrecedenceGroupDecl {
|
||||
override string toString() {
|
||||
result = "precedencegroup ..." // TODO: Once we extract the name we can improve this.
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.PrefixOperatorDecl
|
||||
|
||||
class PrefixOperatorDecl extends PrefixOperatorDeclBase { }
|
||||
class PrefixOperatorDecl extends Generated::PrefixOperatorDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.ProtocolDecl
|
||||
|
||||
class ProtocolDecl extends ProtocolDeclBase { }
|
||||
class ProtocolDecl extends Generated::ProtocolDecl { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.StructDecl
|
||||
|
||||
class StructDecl extends StructDeclBase { }
|
||||
class StructDecl extends Generated::StructDecl { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.SubscriptDecl
|
||||
|
||||
class SubscriptDecl extends SubscriptDeclBase {
|
||||
class SubscriptDecl extends Generated::SubscriptDecl {
|
||||
override string toString() { result = "subscript ..." }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.decl.TopLevelCodeDecl
|
||||
|
||||
class TopLevelCodeDecl extends TopLevelCodeDeclBase {
|
||||
class TopLevelCodeDecl extends Generated::TopLevelCodeDecl {
|
||||
override string toString() { result = this.getBody().toString() }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.TypeAliasDecl
|
||||
|
||||
class TypeAliasDecl extends TypeAliasDeclBase { }
|
||||
class TypeAliasDecl extends Generated::TypeAliasDecl { }
|
||||
|
||||
@@ -1,9 +1,8 @@
|
||||
private import codeql.swift.generated.decl.TypeDecl
|
||||
private import codeql.swift.generated.type.Type
|
||||
private import codeql.swift.elements.type.AnyGenericType
|
||||
private import swift
|
||||
|
||||
class TypeDecl extends TypeDeclBase {
|
||||
class TypeDecl extends Generated::TypeDecl {
|
||||
override string toString() { result = this.getName() }
|
||||
|
||||
TypeDecl getBaseTypeDecl(int i) { result = this.getBaseType(i).(AnyGenericType).getDeclaration() }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.decl.ValueDecl
|
||||
|
||||
class ValueDecl extends ValueDeclBase { }
|
||||
class ValueDecl extends Generated::ValueDecl { }
|
||||
|
||||
@@ -2,7 +2,7 @@ private import codeql.swift.generated.decl.VarDecl
|
||||
private import codeql.swift.elements.expr.DeclRefExpr
|
||||
private import codeql.swift.elements.decl.IterableDeclContext
|
||||
|
||||
class VarDecl extends VarDeclBase {
|
||||
class VarDecl extends Generated::VarDecl {
|
||||
override string toString() { result = this.getName() }
|
||||
|
||||
DeclRefExpr getAnAccess() { result.getDecl() = this }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.AbstractClosureExpr
|
||||
|
||||
class AbstractClosureExpr extends AbstractClosureExprBase { }
|
||||
class AbstractClosureExpr extends Generated::AbstractClosureExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.AnyHashableErasureExpr
|
||||
|
||||
class AnyHashableErasureExpr extends AnyHashableErasureExprBase { }
|
||||
class AnyHashableErasureExpr extends Generated::AnyHashableErasureExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.AnyTryExpr
|
||||
|
||||
class AnyTryExpr extends AnyTryExprBase { }
|
||||
class AnyTryExpr extends Generated::AnyTryExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.AppliedPropertyWrapperExpr
|
||||
|
||||
class AppliedPropertyWrapperExpr extends AppliedPropertyWrapperExprBase { }
|
||||
class AppliedPropertyWrapperExpr extends Generated::AppliedPropertyWrapperExpr { }
|
||||
|
||||
@@ -4,7 +4,7 @@ private import codeql.swift.elements.expr.DeclRefExpr
|
||||
private import codeql.swift.elements.expr.MethodRefExpr
|
||||
private import codeql.swift.elements.expr.ConstructorRefCallExpr
|
||||
|
||||
class ApplyExpr extends ApplyExprBase {
|
||||
class ApplyExpr extends Generated::ApplyExpr {
|
||||
AbstractFunctionDecl getStaticTarget() {
|
||||
exists(Expr f |
|
||||
f = this.getFunction() and
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.ArchetypeToSuperExpr
|
||||
|
||||
class ArchetypeToSuperExpr extends ArchetypeToSuperExprBase { }
|
||||
class ArchetypeToSuperExpr extends Generated::ArchetypeToSuperExpr { }
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
private import codeql.swift.generated.expr.Argument
|
||||
private import codeql.swift.elements.expr.ApplyExpr
|
||||
|
||||
class Argument extends ArgumentBase {
|
||||
class Argument extends Generated::Argument {
|
||||
override string toString() { result = this.getLabel() + ": " + this.getExpr().toString() }
|
||||
|
||||
int getIndex() { any(ApplyExpr apply).getArgument(result) = this }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.ArrayExpr
|
||||
|
||||
class ArrayExpr extends ArrayExprBase {
|
||||
class ArrayExpr extends Generated::ArrayExpr {
|
||||
override string toString() { result = "[...]" }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.ArrayToPointerExpr
|
||||
|
||||
class ArrayToPointerExpr extends ArrayToPointerExprBase { }
|
||||
class ArrayToPointerExpr extends Generated::ArrayToPointerExpr { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.ArrowExpr
|
||||
|
||||
class ArrowExpr extends ArrowExprBase {
|
||||
class ArrowExpr extends Generated::ArrowExpr {
|
||||
override string toString() { result = "... -> ..." }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.AssignExpr
|
||||
|
||||
class AssignExpr extends AssignExprBase {
|
||||
class AssignExpr extends Generated::AssignExpr {
|
||||
override string toString() { result = " ... = ..." }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
private import codeql.swift.generated.expr.AutoClosureExpr
|
||||
private import codeql.swift.elements.stmt.ReturnStmt
|
||||
|
||||
class AutoClosureExpr extends AutoClosureExprBase {
|
||||
class AutoClosureExpr extends Generated::AutoClosureExpr {
|
||||
/** Gets the implicit return statement generated by this autoclosure expression. */
|
||||
ReturnStmt getReturn() { result = unique( | | this.getBody().getAnElement()) }
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.AwaitExpr
|
||||
|
||||
class AwaitExpr extends AwaitExprBase {
|
||||
class AwaitExpr extends Generated::AwaitExpr {
|
||||
override string toString() { result = "await ..." }
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
private import codeql.swift.generated.expr.BinaryExpr
|
||||
private import codeql.swift.elements.expr.Expr
|
||||
|
||||
class BinaryExpr extends BinaryExprBase {
|
||||
class BinaryExpr extends Generated::BinaryExpr {
|
||||
Expr getLeftOperand() { result = this.getArgument(0).getExpr() }
|
||||
|
||||
Expr getRightOperand() { result = this.getArgument(1).getExpr() }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.BindOptionalExpr
|
||||
|
||||
class BindOptionalExpr extends BindOptionalExprBase {
|
||||
class BindOptionalExpr extends Generated::BindOptionalExpr {
|
||||
override string toString() { result = "...?" }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.BooleanLiteralExpr
|
||||
|
||||
class BooleanLiteralExpr extends BooleanLiteralExprBase {
|
||||
class BooleanLiteralExpr extends Generated::BooleanLiteralExpr {
|
||||
override string toString() { result = this.getValue().toString() }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.BridgeFromObjCExpr
|
||||
|
||||
class BridgeFromObjCExpr extends BridgeFromObjCExprBase { }
|
||||
class BridgeFromObjCExpr extends Generated::BridgeFromObjCExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.BridgeToObjCExpr
|
||||
|
||||
class BridgeToObjCExpr extends BridgeToObjCExprBase { }
|
||||
class BridgeToObjCExpr extends Generated::BridgeToObjCExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.BuiltinLiteralExpr
|
||||
|
||||
class BuiltinLiteralExpr extends BuiltinLiteralExprBase { }
|
||||
class BuiltinLiteralExpr extends Generated::BuiltinLiteralExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CallExpr
|
||||
|
||||
class CallExpr extends CallExprBase { }
|
||||
class CallExpr extends Generated::CallExpr { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.CaptureListExpr
|
||||
|
||||
class CaptureListExpr extends CaptureListExprBase {
|
||||
class CaptureListExpr extends Generated::CaptureListExpr {
|
||||
override string toString() { result = this.getClosureBody().toString() }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CheckedCastExpr
|
||||
|
||||
class CheckedCastExpr extends CheckedCastExprBase { }
|
||||
class CheckedCastExpr extends Generated::CheckedCastExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.ClassMetatypeToObjectExpr
|
||||
|
||||
class ClassMetatypeToObjectExpr extends ClassMetatypeToObjectExprBase { }
|
||||
class ClassMetatypeToObjectExpr extends Generated::ClassMetatypeToObjectExpr { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.ClosureExpr
|
||||
|
||||
class ClosureExpr extends ClosureExprBase {
|
||||
class ClosureExpr extends Generated::ClosureExpr {
|
||||
override string toString() { result = "{ ... }" }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CodeCompletionExpr
|
||||
|
||||
class CodeCompletionExpr extends CodeCompletionExprBase { }
|
||||
class CodeCompletionExpr extends Generated::CodeCompletionExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CoerceExpr
|
||||
|
||||
class CoerceExpr extends CoerceExprBase { }
|
||||
class CoerceExpr extends Generated::CoerceExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CollectionExpr
|
||||
|
||||
class CollectionExpr extends CollectionExprBase { }
|
||||
class CollectionExpr extends Generated::CollectionExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CollectionUpcastConversionExpr
|
||||
|
||||
class CollectionUpcastConversionExpr extends CollectionUpcastConversionExprBase { }
|
||||
class CollectionUpcastConversionExpr extends Generated::CollectionUpcastConversionExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.ConditionalBridgeFromObjCExpr
|
||||
|
||||
class ConditionalBridgeFromObjCExpr extends ConditionalBridgeFromObjCExprBase { }
|
||||
class ConditionalBridgeFromObjCExpr extends Generated::ConditionalBridgeFromObjCExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.ConditionalCheckedCastExpr
|
||||
|
||||
class ConditionalCheckedCastExpr extends ConditionalCheckedCastExprBase { }
|
||||
class ConditionalCheckedCastExpr extends Generated::ConditionalCheckedCastExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.ConstructorRefCallExpr
|
||||
|
||||
class ConstructorRefCallExpr extends ConstructorRefCallExprBase { }
|
||||
class ConstructorRefCallExpr extends Generated::ConstructorRefCallExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CovariantFunctionConversionExpr
|
||||
|
||||
class CovariantFunctionConversionExpr extends CovariantFunctionConversionExprBase { }
|
||||
class CovariantFunctionConversionExpr extends Generated::CovariantFunctionConversionExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.CovariantReturnConversionExpr
|
||||
|
||||
class CovariantReturnConversionExpr extends CovariantReturnConversionExprBase { }
|
||||
class CovariantReturnConversionExpr extends Generated::CovariantReturnConversionExpr { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.DeclRefExpr
|
||||
|
||||
class DeclRefExpr extends DeclRefExprBase {
|
||||
class DeclRefExpr extends Generated::DeclRefExpr {
|
||||
override string toString() { result = this.getDecl().toString() }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.DefaultArgumentExpr
|
||||
|
||||
class DefaultArgumentExpr extends DefaultArgumentExprBase {
|
||||
class DefaultArgumentExpr extends Generated::DefaultArgumentExpr {
|
||||
override string toString() { result = "default " + this.getParamDecl().getName() }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.DerivedToBaseExpr
|
||||
|
||||
class DerivedToBaseExpr extends DerivedToBaseExprBase { }
|
||||
class DerivedToBaseExpr extends Generated::DerivedToBaseExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.DestructureTupleExpr
|
||||
|
||||
class DestructureTupleExpr extends DestructureTupleExprBase { }
|
||||
class DestructureTupleExpr extends Generated::DestructureTupleExpr { }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.DictionaryExpr
|
||||
|
||||
class DictionaryExpr extends DictionaryExprBase {
|
||||
class DictionaryExpr extends Generated::DictionaryExpr {
|
||||
override string toString() { result = "[...]" }
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// generated by codegen/codegen.py, remove this comment if you wish to edit this file
|
||||
private import codeql.swift.generated.expr.DifferentiableFunctionExpr
|
||||
|
||||
class DifferentiableFunctionExpr extends DifferentiableFunctionExprBase { }
|
||||
class DifferentiableFunctionExpr extends Generated::DifferentiableFunctionExpr { }
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
private import codeql.swift.generated.expr.DifferentiableFunctionExtractOriginalExpr
|
||||
|
||||
class DifferentiableFunctionExtractOriginalExpr extends DifferentiableFunctionExtractOriginalExprBase {
|
||||
class DifferentiableFunctionExtractOriginalExpr extends Generated::DifferentiableFunctionExtractOriginalExpr {
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.DiscardAssignmentExpr
|
||||
|
||||
class DiscardAssignmentExpr extends DiscardAssignmentExprBase {
|
||||
class DiscardAssignmentExpr extends Generated::DiscardAssignmentExpr {
|
||||
override string toString() { result = "_" }
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
private import codeql.swift.generated.expr.DotSelfExpr
|
||||
|
||||
class DotSelfExpr extends DotSelfExprBase {
|
||||
class DotSelfExpr extends Generated::DotSelfExpr {
|
||||
override string toString() { result = ".self" }
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user