Merge branch 'main' into swift-extract-this-param-decl

This commit is contained in:
Mathias Vorreiter Pedersen
2022-08-24 10:14:18 +01:00
27 changed files with 246 additions and 209 deletions

View File

@@ -194,6 +194,7 @@ StructDecl:
Decl:
_extends: AstNode
module: ModuleDecl
Expr:
_extends: AstNode
@@ -311,7 +312,7 @@ IfConfigClause:
ImportDecl:
_extends: Decl
is_exported: predicate
module: ModuleDecl
imported_module: ModuleDecl
declarations: ValueDecl*
MissingMemberDecl:

View File

@@ -24,54 +24,48 @@ std::string constructName(const swift::DeclName& declName) {
std::variant<codeql::ConcreteFuncDecl, codeql::ConcreteFuncDeclsTrap>
DeclVisitor::translateFuncDecl(const swift::FuncDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return ConcreteFuncDeclsTrap{id};
auto ret = createNamedEntryOr<ConcreteFuncDeclsTrap>(decl);
if (auto entry = get_if<ConcreteFuncDecl>(&ret)) {
fillAbstractFunctionDecl(decl, *entry);
}
ConcreteFuncDecl entry{id};
fillAbstractFunctionDecl(decl, entry);
return entry;
return ret;
}
std::variant<codeql::ConstructorDecl, codeql::ConstructorDeclsTrap>
DeclVisitor::translateConstructorDecl(const swift::ConstructorDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return ConstructorDeclsTrap{id};
auto ret = createNamedEntryOr<ConstructorDeclsTrap>(decl);
if (auto entry = get_if<ConstructorDecl>(&ret)) {
fillAbstractFunctionDecl(decl, *entry);
}
ConstructorDecl entry{id};
fillAbstractFunctionDecl(decl, entry);
return entry;
return ret;
}
std::variant<codeql::DestructorDecl, codeql::DestructorDeclsTrap>
DeclVisitor::translateDestructorDecl(const swift::DestructorDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return DestructorDeclsTrap{id};
auto ret = createNamedEntryOr<DestructorDeclsTrap>(decl);
if (auto entry = get_if<DestructorDecl>(&ret)) {
fillAbstractFunctionDecl(decl, *entry);
}
DestructorDecl entry{id};
fillAbstractFunctionDecl(decl, entry);
return entry;
return ret;
}
codeql::PrefixOperatorDecl DeclVisitor::translatePrefixOperatorDecl(
const swift::PrefixOperatorDecl& decl) {
PrefixOperatorDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
fillOperatorDecl(decl, entry);
return entry;
}
codeql::PostfixOperatorDecl DeclVisitor::translatePostfixOperatorDecl(
const swift::PostfixOperatorDecl& decl) {
PostfixOperatorDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
fillOperatorDecl(decl, entry);
return entry;
}
codeql::InfixOperatorDecl DeclVisitor::translateInfixOperatorDecl(
const swift::InfixOperatorDecl& decl) {
InfixOperatorDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
entry.precedence_group = dispatcher_.fetchOptionalLabel(decl.getPrecedenceGroup());
fillOperatorDecl(decl, entry);
return entry;
@@ -79,7 +73,7 @@ codeql::InfixOperatorDecl DeclVisitor::translateInfixOperatorDecl(
codeql::PrecedenceGroupDecl DeclVisitor::translatePrecedenceGroupDecl(
const swift::PrecedenceGroupDecl& decl) {
PrecedenceGroupDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
return entry;
}
@@ -95,7 +89,7 @@ std::optional<codeql::ParamDecl> DeclVisitor::translateParamDecl(const swift::Pa
codeql::TopLevelCodeDecl DeclVisitor::translateTopLevelCodeDecl(
const swift::TopLevelCodeDecl& decl) {
TopLevelCodeDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
assert(decl.getBody() && "Expect top level code to have body");
entry.body = dispatcher_.fetchLabel(decl.getBody());
return entry;
@@ -103,7 +97,7 @@ codeql::TopLevelCodeDecl DeclVisitor::translateTopLevelCodeDecl(
codeql::PatternBindingDecl DeclVisitor::translatePatternBindingDecl(
const swift::PatternBindingDecl& decl) {
PatternBindingDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
for (unsigned i = 0; i < decl.getNumPatternEntries(); ++i) {
auto pattern = decl.getPattern(i);
assert(pattern && "Expect pattern binding decl to have all patterns");
@@ -118,7 +112,7 @@ std::optional<codeql::ConcreteVarDecl> DeclVisitor::translateVarDecl(const swift
// We do not deduplicate variables from non-swift (PCM, clang modules) modules as the mangler
// crashes sometimes
if (decl.getDeclContext()->isLocalContext() || decl.getModuleContext()->isNonSwiftModule()) {
entry.emplace(dispatcher_.assignNewLabel(decl));
entry = createEntry(decl);
} else {
entry = createNamedEntry(decl);
if (!entry) {
@@ -132,122 +126,106 @@ std::optional<codeql::ConcreteVarDecl> DeclVisitor::translateVarDecl(const swift
std::variant<codeql::StructDecl, codeql::StructDeclsTrap> DeclVisitor::translateStructDecl(
const swift::StructDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return StructDeclsTrap{id};
auto ret = createNamedEntryOr<StructDeclsTrap>(decl);
if (auto entry = get_if<StructDecl>(&ret)) {
fillNominalTypeDecl(decl, *entry);
}
StructDecl entry{id};
fillNominalTypeDecl(decl, entry);
return entry;
return ret;
}
std::variant<codeql::ClassDecl, codeql::ClassDeclsTrap> DeclVisitor::translateClassDecl(
const swift::ClassDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return ClassDeclsTrap{id};
auto ret = createNamedEntryOr<ClassDeclsTrap>(decl);
if (auto entry = get_if<ClassDecl>(&ret)) {
fillNominalTypeDecl(decl, *entry);
}
ClassDecl entry{id};
fillNominalTypeDecl(decl, entry);
return entry;
return ret;
}
std::variant<codeql::EnumDecl, codeql::EnumDeclsTrap> DeclVisitor::translateEnumDecl(
const swift::EnumDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return EnumDeclsTrap{id};
auto ret = createNamedEntryOr<EnumDeclsTrap>(decl);
if (auto entry = get_if<EnumDecl>(&ret)) {
fillNominalTypeDecl(decl, *entry);
}
EnumDecl entry{id};
fillNominalTypeDecl(decl, entry);
return entry;
return ret;
}
std::variant<codeql::ProtocolDecl, codeql::ProtocolDeclsTrap> DeclVisitor::translateProtocolDecl(
const swift::ProtocolDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return ProtocolDeclsTrap{id};
auto ret = createNamedEntryOr<ProtocolDeclsTrap>(decl);
if (auto entry = get_if<ProtocolDecl>(&ret)) {
fillNominalTypeDecl(decl, *entry);
}
ProtocolDecl entry{id};
fillNominalTypeDecl(decl, entry);
return entry;
return ret;
}
codeql::EnumCaseDecl DeclVisitor::translateEnumCaseDecl(const swift::EnumCaseDecl& decl) {
EnumCaseDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
entry.elements = dispatcher_.fetchRepeatedLabels(decl.getElements());
return entry;
}
std::variant<codeql::EnumElementDecl, codeql::EnumElementDeclsTrap>
DeclVisitor::translateEnumElementDecl(const swift::EnumElementDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return EnumElementDeclsTrap{id, decl.getNameStr().str()};
auto ret = createNamedEntryOr<EnumElementDeclsTrap>(decl);
std::visit([&](auto& entry) { entry.name = decl.getNameStr().str(); }, ret);
if (auto entry = get_if<EnumElementDecl>(&ret)) {
if (decl.hasParameterList()) {
entry->params = dispatcher_.fetchRepeatedLabels(*decl.getParameterList());
}
fillValueDecl(decl, *entry);
}
EnumElementDecl entry{id};
entry.name = decl.getNameStr().str();
if (decl.hasParameterList()) {
entry.params = dispatcher_.fetchRepeatedLabels(*decl.getParameterList());
}
fillValueDecl(decl, entry);
return entry;
return ret;
}
codeql::GenericTypeParamDecl DeclVisitor::translateGenericTypeParamDecl(
const swift::GenericTypeParamDecl& decl) {
// TODO: deduplicate
GenericTypeParamDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
fillTypeDecl(decl, entry);
return entry;
}
std::variant<codeql::AssociatedTypeDecl, codeql::AssociatedTypeDeclsTrap>
DeclVisitor::translateAssociatedTypeDecl(const swift::AssociatedTypeDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return AssociatedTypeDeclsTrap{id};
auto ret = createNamedEntryOr<AssociatedTypeDeclsTrap>(decl);
if (auto entry = get_if<AssociatedTypeDecl>(&ret)) {
fillTypeDecl(decl, *entry);
}
AssociatedTypeDecl entry{id};
fillTypeDecl(decl, entry);
return entry;
return ret;
}
std::variant<codeql::TypeAliasDecl, codeql::TypeAliasDeclsTrap> DeclVisitor::translateTypeAliasDecl(
const swift::TypeAliasDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return TypeAliasDeclsTrap{id};
auto ret = createNamedEntryOr<TypeAliasDeclsTrap>(decl);
if (auto entry = get_if<TypeAliasDecl>(&ret)) {
fillTypeDecl(decl, *entry);
}
TypeAliasDecl entry{id};
fillTypeDecl(decl, entry);
return entry;
return ret;
}
std::variant<codeql::AccessorDecl, codeql::AccessorDeclsTrap> DeclVisitor::translateAccessorDecl(
const swift::AccessorDecl& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (!dispatcher_.shouldEmitDeclBody(decl)) {
return AccessorDeclsTrap{id};
auto ret = createNamedEntryOr<AccessorDeclsTrap>(decl);
if (auto entry = get_if<AccessorDecl>(&ret)) {
switch (decl.getAccessorKind()) {
case swift::AccessorKind::Get:
entry->is_getter = true;
break;
case swift::AccessorKind::Set:
entry->is_setter = true;
break;
case swift::AccessorKind::WillSet:
entry->is_will_set = true;
break;
case swift::AccessorKind::DidSet:
entry->is_did_set = true;
break;
}
fillAbstractFunctionDecl(decl, *entry);
}
AccessorDecl entry{id};
switch (decl.getAccessorKind()) {
case swift::AccessorKind::Get:
entry.is_getter = true;
break;
case swift::AccessorKind::Set:
entry.is_setter = true;
break;
case swift::AccessorKind::WillSet:
entry.is_will_set = true;
break;
case swift::AccessorKind::DidSet:
entry.is_did_set = true;
break;
}
fillAbstractFunctionDecl(decl, entry);
return entry;
return ret;
}
std::optional<codeql::SubscriptDecl> DeclVisitor::translateSubscriptDecl(
@@ -265,7 +243,7 @@ std::optional<codeql::SubscriptDecl> DeclVisitor::translateSubscriptDecl(
}
codeql::ExtensionDecl DeclVisitor::translateExtensionDecl(const swift::ExtensionDecl& decl) {
ExtensionDecl entry{dispatcher_.assignNewLabel(decl)};
auto entry = createEntry(decl);
entry.extended_type_decl = dispatcher_.fetchLabel(decl.getExtendedNominal());
fillGenericContext(decl, entry);
fillIterableDeclContext(decl, entry);
@@ -273,9 +251,9 @@ codeql::ExtensionDecl DeclVisitor::translateExtensionDecl(const swift::Extension
}
codeql::ImportDecl DeclVisitor::translateImportDecl(const swift::ImportDecl& decl) {
auto entry = dispatcher_.createEntry(decl);
auto entry = createEntry(decl);
entry.is_exported = decl.isExported();
entry.module = dispatcher_.fetchLabel(decl.getModule());
entry.imported_module = dispatcher_.fetchLabel(decl.getModule());
entry.declarations = dispatcher_.fetchRepeatedLabels(decl.getDecls());
return entry;
}
@@ -391,7 +369,7 @@ void DeclVisitor::fillAbstractStorageDecl(const swift::AbstractStorageDecl& decl
}
codeql::IfConfigDecl DeclVisitor::translateIfConfigDecl(const swift::IfConfigDecl& decl) {
auto entry = dispatcher_.createEntry(decl);
auto entry = createEntry(decl);
entry.clauses = dispatcher_.fetchRepeatedLabels(decl.getClauses());
return entry;
}

View File

@@ -78,13 +78,36 @@ class DeclVisitor : public AstVisitorBase<DeclVisitor> {
template <typename D>
std::optional<TrapClassOf<D>> createNamedEntry(const D& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
std::optional<TrapClassOf<D>> entry;
if (dispatcher_.shouldEmitDeclBody(decl)) {
return TrapClassOf<D>{id};
entry.emplace(id);
fillDecl(decl, *entry);
}
return std::nullopt;
return entry;
}
template <typename T, typename D, typename... Args>
std::variant<TrapClassOf<D>, T> createNamedEntryOr(const D& decl) {
auto id = dispatcher_.assignNewLabel(decl, mangledName(decl));
if (dispatcher_.shouldEmitDeclBody(decl)) {
TrapClassOf<D> entry{id};
fillDecl(decl, entry);
return entry;
}
return T{id};
}
template <typename D>
TrapClassOf<D> createEntry(const D& decl) {
TrapClassOf<D> entry{dispatcher_.template assignNewLabel(decl)};
fillDecl(decl, entry);
return entry;
}
void fillDecl(const swift::Decl& decl, codeql::Decl& entry) {
entry.module = dispatcher_.fetchLabel(decl.getModuleContext());
}
private:
swift::Mangle::ASTMangler mangler;
};

View File

@@ -265,7 +265,9 @@ module Raw {
Expr getGuard() { case_label_item_guards(this, result) }
}
class Decl extends @decl, AstNode { }
class Decl extends @decl, AstNode {
ModuleDecl getModule() { decls(this, result) }
}
class ExistentialMetatypeType extends @existential_metatype_type, AnyMetatypeType {
override string toString() { result = "ExistentialMetatypeType" }
@@ -607,7 +609,7 @@ module Raw {
predicate isExported() { import_decl_is_exported(this) }
ModuleDecl getModule() { import_decls(this, result) }
ModuleDecl getImportedModule() { import_decls(this, result) }
ValueDecl getDeclaration(int index) { import_decl_declarations(this, index, result) }
}

View File

@@ -2,5 +2,12 @@
private import codeql.swift.generated.Synth
private import codeql.swift.generated.Raw
import codeql.swift.elements.AstNode
import codeql.swift.elements.decl.ModuleDecl
class DeclBase extends Synth::TDecl, AstNode { }
class DeclBase extends Synth::TDecl, AstNode {
ModuleDecl getImmediateModule() {
result = Synth::convertModuleDeclFromRaw(Synth::convertDeclToRaw(this).(Raw::Decl).getModule())
}
final ModuleDecl getModule() { result = getImmediateModule().resolve() }
}

View File

@@ -10,14 +10,14 @@ class ImportDeclBase extends Synth::TImportDecl, Decl {
predicate isExported() { Synth::convertImportDeclToRaw(this).(Raw::ImportDecl).isExported() }
ModuleDecl getImmediateModule() {
ModuleDecl getImmediateImportedModule() {
result =
Synth::convertModuleDeclFromRaw(Synth::convertImportDeclToRaw(this)
.(Raw::ImportDecl)
.getModule())
.getImportedModule())
}
final ModuleDecl getModule() { result = getImmediateModule().resolve() }
final ModuleDecl getImportedModule() { result = getImmediateImportedModule().resolve() }
ValueDecl getImmediateDeclaration(int index) {
result =

View File

@@ -423,6 +423,12 @@ struct_decls( //dir=decl
| @value_decl
;
#keyset[id]
decls( //dir=decl
int id: @decl ref,
int module: @module_decl ref
);
@expr =
@abstract_closure_expr
| @any_try_expr
@@ -704,7 +710,7 @@ if_config_clause_is_active( //dir=decl
import_decls( //dir=decl
unique int id: @import_decl,
int module: @module_decl ref
int imported_module: @module_decl ref
);
#keyset[id]

View File

@@ -1,27 +1,27 @@
| accessors.swift:2:9:2:9 | (unnamed function decl) | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:2:9:2:9 | get | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:2:9:2:9 | set | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:3:9:3:9 | (unnamed function decl) | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:4:9:4:28 | get | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:5:9:5:42 | set | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:7:9:7:9 | (unnamed function decl) | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:7:9:7:9 | get | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:7:9:7:9 | set | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:8:9:8:29 | willSet | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | yes | isDidSet: | no |
| accessors.swift:11:9:11:9 | (unnamed function decl) | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:11:9:11:9 | get | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:11:9:11:9 | set | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:12:9:12:19 | willSet | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | yes | isDidSet: | no |
| accessors.swift:15:9:15:9 | (unnamed function decl) | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:15:9:15:9 | get | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:15:9:15:9 | set | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:16:9:16:28 | didSet | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | yes |
| accessors.swift:19:9:19:9 | (unnamed function decl) | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:19:9:19:9 | get | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:19:9:19:9 | set | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:20:9:20:18 | didSet | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | yes |
| accessors.swift:23:9:23:9 | (unnamed function decl) | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:23:9:23:9 | get | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:23:9:23:9 | set | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:24:9:24:19 | willSet | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | yes | isDidSet: | no |
| accessors.swift:26:9:26:18 | didSet | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | yes |
| accessors.swift:2:9:2:9 | (unnamed function decl) | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:2:9:2:9 | get | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:2:9:2:9 | set | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:3:9:3:9 | (unnamed function decl) | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:4:9:4:28 | get | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:5:9:5:42 | set | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:7:9:7:9 | (unnamed function decl) | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:7:9:7:9 | get | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:7:9:7:9 | set | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:8:9:8:29 | willSet | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | yes | isDidSet: | no |
| accessors.swift:11:9:11:9 | (unnamed function decl) | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:11:9:11:9 | get | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:11:9:11:9 | set | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:12:9:12:19 | willSet | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | yes | isDidSet: | no |
| accessors.swift:15:9:15:9 | (unnamed function decl) | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:15:9:15:9 | get | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:15:9:15:9 | set | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:16:9:16:28 | didSet | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | yes |
| accessors.swift:19:9:19:9 | (unnamed function decl) | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:19:9:19:9 | get | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:19:9:19:9 | set | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:20:9:20:18 | didSet | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | yes |
| accessors.swift:23:9:23:9 | (unnamed function decl) | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:23:9:23:9 | get | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (Foo) -> () -> Int | getName: | (unnamed function decl) | isGetter: | yes | isSetter: | no | isWillSet: | no | isDidSet: | no |
| accessors.swift:23:9:23:9 | set | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | yes | isWillSet: | no | isDidSet: | no |
| accessors.swift:24:9:24:19 | willSet | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> (Int) -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | yes | isDidSet: | no |
| accessors.swift:26:9:26:18 | didSet | getModule: | file://:0:0:0:0 | accessors | getInterfaceType: | (inout Foo) -> () -> () | getName: | (unnamed function decl) | isGetter: | no | isSetter: | no | isWillSet: | no | isDidSet: | yes |

View File

@@ -3,16 +3,17 @@ import codeql.swift.elements
import TestUtils
from
AccessorDecl x, Type getInterfaceType, string getName, string isGetter, string isSetter,
string isWillSet, string isDidSet
AccessorDecl x, ModuleDecl getModule, Type getInterfaceType, string getName, string isGetter,
string isSetter, string isWillSet, string isDidSet
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName() and
(if x.isGetter() then isGetter = "yes" else isGetter = "no") and
(if x.isSetter() then isSetter = "yes" else isSetter = "no") and
(if x.isWillSet() then isWillSet = "yes" else isWillSet = "no") and
if x.isDidSet() then isDidSet = "yes" else isDidSet = "no"
select x, "getInterfaceType:", getInterfaceType, "getName:", getName, "isGetter:", isGetter,
"isSetter:", isSetter, "isWillSet:", isWillSet, "isDidSet:", isDidSet
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName,
"isGetter:", isGetter, "isSetter:", isSetter, "isWillSet:", isWillSet, "isDidSet:", isDidSet

View File

@@ -1,2 +1,2 @@
| associated_type.swift:2:5:2:20 | Bar | getInterfaceType: | Self.Bar.Type | getName: | Bar |
| associated_type.swift:3:5:3:25 | Baz | getInterfaceType: | Self.Baz.Type | getName: | Baz |
| associated_type.swift:2:5:2:20 | Bar | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Bar.Type | getName: | Bar |
| associated_type.swift:3:5:3:25 | Baz | getModule: | file://:0:0:0:0 | associated_type | getInterfaceType: | Self.Baz.Type | getName: | Baz |

View File

@@ -2,10 +2,11 @@
import codeql.swift.elements
import TestUtils
from AssociatedTypeDecl x, Type getInterfaceType, string getName
from AssociatedTypeDecl x, ModuleDecl getModule, Type getInterfaceType, string getName
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName()
select x, "getInterfaceType:", getInterfaceType, "getName:", getName
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName

View File

@@ -1,3 +1,3 @@
| class.swift:1:1:7:1 | Foo | getInterfaceType: | Foo.Type | getName: | Foo | getType: | Foo |
| class.swift:11:1:14:1 | Generic | getInterfaceType: | Generic<X, Y>.Type | getName: | Generic | getType: | Generic |
| class.swift:16:1:17:1 | Baz | getInterfaceType: | Baz.Type | getName: | Baz | getType: | Baz |
| class.swift:1:1:7:1 | Foo | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Foo.Type | getName: | Foo | getType: | Foo |
| class.swift:11:1:14:1 | Generic | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Generic<X, Y>.Type | getName: | Generic | getType: | Generic |
| class.swift:16:1:17:1 | Baz | getModule: | file://:0:0:0:0 | class | getInterfaceType: | Baz.Type | getName: | Baz | getType: | Baz |

View File

@@ -2,11 +2,13 @@
import codeql.swift.elements
import TestUtils
from ClassDecl x, Type getInterfaceType, string getName, Type getType
from ClassDecl x, ModuleDecl getModule, Type getInterfaceType, string getName, Type getType
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName() and
getType = x.getType()
select x, "getInterfaceType:", getInterfaceType, "getName:", getName, "getType:", getType
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName,
"getType:", getType

View File

@@ -1,5 +1,5 @@
| functions.swift:1:1:3:1 | foo() | getInterfaceType: | () -> Int | getName: | foo() |
| functions.swift:5:1:7:1 | bar(_:d:) | getInterfaceType: | (Int, Double) -> Int | getName: | bar(_:d:) |
| functions.swift:10:5:10:28 | noBody(x:) | getInterfaceType: | <Self where Self : Beep> (Self) -> (Int) -> Int | getName: | noBody(x:) |
| functions.swift:13:1:15:1 | variadic(_:) | getInterfaceType: | (Int...) -> () | getName: | variadic(_:) |
| functions.swift:17:1:19:1 | generic(x:y:) | getInterfaceType: | <X, Y> (x: X, y: Y) -> () | getName: | generic(x:y:) |
| functions.swift:1:1:3:1 | foo() | getModule: | file://:0:0:0:0 | functions | getInterfaceType: | () -> Int | getName: | foo() |
| functions.swift:5:1:7:1 | bar(_:d:) | getModule: | file://:0:0:0:0 | functions | getInterfaceType: | (Int, Double) -> Int | getName: | bar(_:d:) |
| functions.swift:10:5:10:28 | noBody(x:) | getModule: | file://:0:0:0:0 | functions | getInterfaceType: | <Self where Self : Beep> (Self) -> (Int) -> Int | getName: | noBody(x:) |
| functions.swift:13:1:15:1 | variadic(_:) | getModule: | file://:0:0:0:0 | functions | getInterfaceType: | (Int...) -> () | getName: | variadic(_:) |
| functions.swift:17:1:19:1 | generic(x:y:) | getModule: | file://:0:0:0:0 | functions | getInterfaceType: | <X, Y> (x: X, y: Y) -> () | getName: | generic(x:y:) |

View File

@@ -2,10 +2,11 @@
import codeql.swift.elements
import TestUtils
from ConcreteFuncDecl x, Type getInterfaceType, string getName
from ConcreteFuncDecl x, ModuleDecl getModule, Type getInterfaceType, string getName
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName()
select x, "getInterfaceType:", getInterfaceType, "getName:", getName
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName

View File

@@ -1,7 +1,7 @@
| var_decls.swift:4:7:4:7 | i | getInterfaceType: | Int | getName: | i | getType: | Int | getIntroducerInt: | 1 |
| var_decls.swift:7:5:7:5 | numbers | getInterfaceType: | [Int] | getName: | numbers | getType: | [Int] | getIntroducerInt: | 1 |
| var_decls.swift:10:12:10:12 | numbers | getInterfaceType: | [Int] | getName: | numbers | getType: | [Int] | getIntroducerInt: | 0 |
| var_decls.swift:15:7:15:7 | wrappedValue | getInterfaceType: | T | getName: | wrappedValue | getType: | T | getIntroducerInt: | 1 |
| var_decls.swift:20:7:20:7 | wrappedValue | getInterfaceType: | Int | getName: | wrappedValue | getType: | Int | getIntroducerInt: | 1 |
| var_decls.swift:24:15:24:15 | _wrapped | getInterfaceType: | X<Y> | getName: | _wrapped | getType: | X<Y> | getIntroducerInt: | 1 |
| var_decls.swift:24:15:24:15 | wrapped | getInterfaceType: | Int | getName: | wrapped | getType: | Int | getIntroducerInt: | 1 |
| var_decls.swift:4:7:4:7 | i | getModule: | file://:0:0:0:0 | var_decls | getInterfaceType: | Int | getName: | i | getType: | Int | getIntroducerInt: | 1 |
| var_decls.swift:7:5:7:5 | numbers | getModule: | file://:0:0:0:0 | var_decls | getInterfaceType: | [Int] | getName: | numbers | getType: | [Int] | getIntroducerInt: | 1 |
| var_decls.swift:10:12:10:12 | numbers | getModule: | file://:0:0:0:0 | var_decls | getInterfaceType: | [Int] | getName: | numbers | getType: | [Int] | getIntroducerInt: | 0 |
| var_decls.swift:15:7:15:7 | wrappedValue | getModule: | file://:0:0:0:0 | var_decls | getInterfaceType: | T | getName: | wrappedValue | getType: | T | getIntroducerInt: | 1 |
| var_decls.swift:20:7:20:7 | wrappedValue | getModule: | file://:0:0:0:0 | var_decls | getInterfaceType: | Int | getName: | wrappedValue | getType: | Int | getIntroducerInt: | 1 |
| var_decls.swift:24:15:24:15 | _wrapped | getModule: | file://:0:0:0:0 | var_decls | getInterfaceType: | X<Y> | getName: | _wrapped | getType: | X<Y> | getIntroducerInt: | 1 |
| var_decls.swift:24:15:24:15 | wrapped | getModule: | file://:0:0:0:0 | var_decls | getInterfaceType: | Int | getName: | wrapped | getType: | Int | getIntroducerInt: | 1 |

View File

@@ -2,13 +2,16 @@
import codeql.swift.elements
import TestUtils
from ConcreteVarDecl x, Type getInterfaceType, string getName, Type getType, int getIntroducerInt
from
ConcreteVarDecl x, ModuleDecl getModule, Type getInterfaceType, string getName, Type getType,
int getIntroducerInt
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName() and
getType = x.getType() and
getIntroducerInt = x.getIntroducerInt()
select x, "getInterfaceType:", getInterfaceType, "getName:", getName, "getType:", getType,
"getIntroducerInt:", getIntroducerInt
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName,
"getType:", getType, "getIntroducerInt:", getIntroducerInt

View File

@@ -1,4 +1,4 @@
| enums.swift:1:1:4:1 | EnumValues | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getType: | EnumValues |
| enums.swift:7:1:10:1 | EnumValuesWithBase | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getType: | EnumValuesWithBase |
| enums.swift:12:1:16:1 | EnumWithParams | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getType: | EnumWithParams |
| enums.swift:18:1:21:1 | GenericEnum | getInterfaceType: | GenericEnum<T>.Type | getName: | GenericEnum | getType: | GenericEnum |
| enums.swift:1:1:4:1 | EnumValues | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValues.Type | getName: | EnumValues | getType: | EnumValues |
| enums.swift:7:1:10:1 | EnumValuesWithBase | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumValuesWithBase.Type | getName: | EnumValuesWithBase | getType: | EnumValuesWithBase |
| enums.swift:12:1:16:1 | EnumWithParams | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | EnumWithParams.Type | getName: | EnumWithParams | getType: | EnumWithParams |
| enums.swift:18:1:21:1 | GenericEnum | getModule: | file://:0:0:0:0 | enums | getInterfaceType: | GenericEnum<T>.Type | getName: | GenericEnum | getType: | GenericEnum |

View File

@@ -2,11 +2,13 @@
import codeql.swift.elements
import TestUtils
from EnumDecl x, Type getInterfaceType, string getName, Type getType
from EnumDecl x, ModuleDecl getModule, Type getInterfaceType, string getName, Type getType
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName() and
getType = x.getType()
select x, "getInterfaceType:", getInterfaceType, "getName:", getName, "getType:", getType
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName,
"getType:", getType

View File

@@ -1 +1 @@
| if_config.swift:1:1:10:1 | #if ... |
| if_config.swift:1:1:10:1 | #if ... | getModule: | file://:0:0:0:0 | if_config |

View File

@@ -2,6 +2,9 @@
import codeql.swift.elements
import TestUtils
from IfConfigDecl x
where toBeTested(x) and not x.isUnknown()
select x
from IfConfigDecl x, ModuleDecl getModule
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule()
select x, "getModule:", getModule

View File

@@ -1,5 +1,5 @@
| import.swift:1:1:1:8 | import ... | isExported: | no | getModule: | file://:0:0:0:0 | Swift |
| import.swift:2:1:2:24 | import ... | isExported: | no | getModule: | file://:0:0:0:0 | Swift |
| import.swift:3:12:3:32 | import ... | isExported: | yes | getModule: | file://:0:0:0:0 | Swift |
| import.swift:4:1:4:19 | import ... | isExported: | no | getModule: | file://:0:0:0:0 | Swift |
| import.swift:5:1:5:23 | import ... | isExported: | no | getModule: | file://:0:0:0:0 | Swift |
| import.swift:1:1:1:8 | import ... | getModule: | file://:0:0:0:0 | import | isExported: | no | getImportedModule: | file://:0:0:0:0 | Swift |
| import.swift:2:1:2:24 | import ... | getModule: | file://:0:0:0:0 | import | isExported: | no | getImportedModule: | file://:0:0:0:0 | Swift |
| import.swift:3:12:3:32 | import ... | getModule: | file://:0:0:0:0 | import | isExported: | yes | getImportedModule: | file://:0:0:0:0 | Swift |
| import.swift:4:1:4:19 | import ... | getModule: | file://:0:0:0:0 | import | isExported: | no | getImportedModule: | file://:0:0:0:0 | Swift |
| import.swift:5:1:5:23 | import ... | getModule: | file://:0:0:0:0 | import | isExported: | no | getImportedModule: | file://:0:0:0:0 | Swift |

View File

@@ -2,10 +2,12 @@
import codeql.swift.elements
import TestUtils
from ImportDecl x, string isExported, ModuleDecl getModule
from ImportDecl x, ModuleDecl getModule, string isExported, ModuleDecl getImportedModule
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
(if x.isExported() then isExported = "yes" else isExported = "no") and
getModule = x.getModule()
select x, "isExported:", isExported, "getModule:", getModule
getImportedModule = x.getImportedModule()
select x, "getModule:", getModule, "isExported:", isExported, "getImportedModule:",
getImportedModule

View File

@@ -1,2 +1,2 @@
| file://:0:0:0:0 | Foo | getInterfaceType: | module<Foo> | getName: | Foo | isBuiltinModule: | no | isSystemModule: | no |
| file://:0:0:0:0 | default_module_name | getInterfaceType: | module<default_module_name> | getName: | default_module_name | isBuiltinModule: | no | isSystemModule: | no |
| file://:0:0:0:0 | Foo | getModule: | file://:0:0:0:0 | Foo | getInterfaceType: | module<Foo> | getName: | Foo | isBuiltinModule: | no | isSystemModule: | no |
| file://:0:0:0:0 | default_module_name | getModule: | file://:0:0:0:0 | default_module_name | getInterfaceType: | module<default_module_name> | getName: | default_module_name | isBuiltinModule: | no | isSystemModule: | no |

View File

@@ -3,13 +3,15 @@ import codeql.swift.elements
import TestUtils
from
ModuleDecl x, Type getInterfaceType, string getName, string isBuiltinModule, string isSystemModule
ModuleDecl x, ModuleDecl getModule, Type getInterfaceType, string getName, string isBuiltinModule,
string isSystemModule
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName() and
(if x.isBuiltinModule() then isBuiltinModule = "yes" else isBuiltinModule = "no") and
if x.isSystemModule() then isSystemModule = "yes" else isSystemModule = "no"
select x, "getInterfaceType:", getInterfaceType, "getName:", getName, "isBuiltinModule:",
isBuiltinModule, "isSystemModule:", isSystemModule
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName,
"isBuiltinModule:", isBuiltinModule, "isSystemModule:", isSystemModule

View File

@@ -1,18 +1,18 @@
| param_decls.swift:1:10:1:13 | _ | getInterfaceType: | Int | getName: | _ | getType: | Int | isInout: | no |
| param_decls.swift:1:18:1:29 | y | getInterfaceType: | Double | getName: | y | getType: | Double | isInout: | yes |
| param_decls.swift:2:10:2:13 | _ | getInterfaceType: | Int | getName: | _ | getType: | Int | isInout: | no |
| param_decls.swift:2:18:2:29 | y | getInterfaceType: | Double | getName: | y | getType: | Double | isInout: | yes |
| param_decls.swift:4:8:4:8 | self | getInterfaceType: | S | getName: | self | getType: | S | isInout: | yes |
| param_decls.swift:5:5:5:5 | self | getInterfaceType: | S | getName: | self | getType: | S | isInout: | yes |
| param_decls.swift:5:15:5:15 | x | getInterfaceType: | Int | getName: | x | getType: | Int | isInout: | no |
| param_decls.swift:5:15:5:15 | x | getInterfaceType: | Int | getName: | x | getType: | Int | isInout: | no |
| param_decls.swift:5:15:5:18 | x | getInterfaceType: | Int | getName: | x | getType: | Int | isInout: | no |
| param_decls.swift:5:23:5:23 | y | getInterfaceType: | Int | getName: | y | getType: | Int | isInout: | no |
| param_decls.swift:5:23:5:23 | y | getInterfaceType: | Int | getName: | y | getType: | Int | isInout: | no |
| param_decls.swift:5:23:5:26 | y | getInterfaceType: | Int | getName: | y | getType: | Int | isInout: | no |
| param_decls.swift:6:9:6:9 | self | getInterfaceType: | S | getName: | self | getType: | S | isInout: | no |
| param_decls.swift:7:9:7:9 | newValue | getInterfaceType: | Int? | getName: | newValue | getType: | Int? | isInout: | no |
| param_decls.swift:7:9:7:9 | self | getInterfaceType: | S | getName: | self | getType: | S | isInout: | yes |
| param_decls.swift:12:13:12:22 | s | getInterfaceType: | String | getName: | s | getType: | String | isInout: | yes |
| param_decls.swift:13:13:13:22 | s | getInterfaceType: | String | getName: | s | getType: | String | isInout: | yes |
| param_decls.swift:14:26:14:26 | $0 | getInterfaceType: | Int | getName: | $0 | getType: | Int | isInout: | no |
| param_decls.swift:1:10:1:13 | _ | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | _ | getType: | Int | isInout: | no |
| param_decls.swift:1:18:1:29 | y | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Double | getName: | y | getType: | Double | isInout: | yes |
| param_decls.swift:2:10:2:13 | _ | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | _ | getType: | Int | isInout: | no |
| param_decls.swift:2:18:2:29 | y | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Double | getName: | y | getType: | Double | isInout: | yes |
| param_decls.swift:4:8:4:8 | self | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | S | getName: | self | getType: | S | isInout: | yes |
| param_decls.swift:5:5:5:5 | self | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | S | getName: | self | getType: | S | isInout: | yes |
| param_decls.swift:5:15:5:15 | x | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | x | getType: | Int | isInout: | no |
| param_decls.swift:5:15:5:15 | x | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | x | getType: | Int | isInout: | no |
| param_decls.swift:5:15:5:18 | x | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | x | getType: | Int | isInout: | no |
| param_decls.swift:5:23:5:23 | y | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | y | getType: | Int | isInout: | no |
| param_decls.swift:5:23:5:23 | y | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | y | getType: | Int | isInout: | no |
| param_decls.swift:5:23:5:26 | y | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | y | getType: | Int | isInout: | no |
| param_decls.swift:6:9:6:9 | self | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | S | getName: | self | getType: | S | isInout: | no |
| param_decls.swift:7:9:7:9 | newValue | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int? | getName: | newValue | getType: | Int? | isInout: | no |
| param_decls.swift:7:9:7:9 | self | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | S | getName: | self | getType: | S | isInout: | yes |
| param_decls.swift:12:13:12:22 | s | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | String | getName: | s | getType: | String | isInout: | yes |
| param_decls.swift:13:13:13:22 | s | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | String | getName: | s | getType: | String | isInout: | yes |
| param_decls.swift:14:26:14:26 | $0 | getModule: | file://:0:0:0:0 | param_decls | getInterfaceType: | Int | getName: | $0 | getType: | Int | isInout: | no |

View File

@@ -2,13 +2,16 @@
import codeql.swift.elements
import TestUtils
from ParamDecl x, Type getInterfaceType, string getName, Type getType, string isInout
from
ParamDecl x, ModuleDecl getModule, Type getInterfaceType, string getName, Type getType,
string isInout
where
toBeTested(x) and
not x.isUnknown() and
getModule = x.getModule() and
getInterfaceType = x.getInterfaceType() and
getName = x.getName() and
getType = x.getType() and
if x.isInout() then isInout = "yes" else isInout = "no"
select x, "getInterfaceType:", getInterfaceType, "getName:", getName, "getType:", getType,
"isInout:", isInout
select x, "getModule:", getModule, "getInterfaceType:", getInterfaceType, "getName:", getName,
"getType:", getType, "isInout:", isInout