diff --git a/swift/codegen/BUILD.bazel b/swift/codegen/BUILD.bazel index 5b2a86f0e0b..9e32994dc1b 100644 --- a/swift/codegen/BUILD.bazel +++ b/swift/codegen/BUILD.bazel @@ -27,7 +27,10 @@ py_binary( py_binary( name = "trapgen", srcs = ["trapgen.py"], - data = ["//swift/codegen/templates:trap"], + data = [ + "//swift:dbscheme", + "//swift/codegen/templates:trap", + ], visibility = ["//swift:__subpackages__"], deps = [ "//swift/codegen/lib", @@ -38,7 +41,11 @@ py_binary( py_binary( name = "cppgen", srcs = ["cppgen.py"], - data = ["//swift/codegen/templates:cpp"], + data = [ + ":schema", + ":schema_includes", + "//swift/codegen/templates:cpp", + ], visibility = ["//swift:__subpackages__"], deps = [ "//swift/codegen/lib", diff --git a/swift/codegen/schema.yml b/swift/codegen/schema.yml index 46e0b508ae5..59ac2270d40 100644 --- a/swift/codegen/schema.yml +++ b/swift/codegen/schema.yml @@ -12,12 +12,12 @@ _directories: expr: Expr$ stmt: Stmt$ +Element: + is_unknown: predicate + File: name: string -IterableDeclContext: - members: Decl* - Locatable: location: Location @@ -28,9 +28,12 @@ Location: end_line: int end_column: int -Type: - diagnostics_name: string - canonical_type: Type +Type: {} +# diagnostics_name: string +# canonical_type: Type + +IterableDeclContext: {} +# members: Decl* ExtensionDecl: _extends: @@ -42,29 +45,29 @@ NominalTypeDecl: _extends: - IterableDeclContext - GenericTypeDecl - type: Type +# type: Type AstNode: _extends: Locatable ConditionElement: _extends: Locatable - boolean: Expr? - pattern: Pattern? - initializer: Expr? +# boolean: Expr? +# pattern: Pattern? +# initializer: Expr? _dir: stmt AnyFunctionType: _extends: Type - result: Type - param_types: Type* - param_labels: string* - is_throwing: predicate +# result: Type +# param_types: Type* +# param_labels: string* +# is_throwing: predicate AnyGenericType: _extends: Type - parent: Type? - declaration: Decl +# parent: Type? +# declaration: Decl AnyMetatypeType: _extends: Type @@ -86,7 +89,7 @@ InOutType: LValueType: _extends: Type - object_type: Type +# object_type: Type ModuleType: _extends: Type @@ -127,10 +130,6 @@ TupleType: TypeVariableType: _extends: Type -UnknownType: - _extends: Type - name: string - UnresolvedType: _extends: Type @@ -151,7 +150,7 @@ Decl: Expr: _extends: AstNode - type: Type? +# type: Type? Pattern: _extends: AstNode @@ -167,7 +166,7 @@ FunctionType: GenericFunctionType: _extends: AnyFunctionType - generic_params: GenericTypeParamType* +# generic_params: GenericTypeParamType* NominalOrBoundGenericNominalType: _extends: AnyGenericType @@ -228,7 +227,7 @@ ArchetypeType: GenericTypeParamType: _extends: SubstitutableType - name: string +# name: string ParenType: _extends: SugarType @@ -241,7 +240,7 @@ TypeAliasType: EnumCaseDecl: _extends: Decl - elements: EnumElementDecl* +# elements: EnumElementDecl* IfConfigDecl: _extends: Decl @@ -257,8 +256,8 @@ OperatorDecl: PatternBindingDecl: _extends: Decl - inits: Expr?* - patterns: Pattern* +# inits: Expr?* +# patterns: Pattern* PoundDiagnosticDecl: _extends: Decl @@ -268,57 +267,48 @@ PrecedenceGroupDecl: TopLevelCodeDecl: _extends: Decl - body: BraceStmt - -UnknownAstNode: - _extends: - - Decl - - Expr - - Pattern - - Stmt - - TypeRepr - name: string +# body: BraceStmt ValueDecl: _extends: Decl - interface_type: Type +# interface_type: Type AbstractClosureExpr: _extends: Expr AnyTryExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr AppliedPropertyWrapperExpr: _extends: Expr Argument: - label: string - expr: Expr +# label: string +# expr: Expr _dir: expr ApplyExpr: _extends: Expr - function: Expr - arguments: Argument* +# function: Expr +# arguments: Argument* ArrowExpr: _extends: Expr AssignExpr: _extends: Expr - dest: Expr - source: Expr +# dest: Expr +# source: Expr BindOptionalExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr CaptureListExpr: _extends: Expr - binding_decls: PatternBindingDecl* - closure_body: ClosureExpr +# binding_decls: PatternBindingDecl* +# closure_body: ClosureExpr CodeCompletionExpr: _extends: Expr @@ -328,64 +318,64 @@ CollectionExpr: DeclRefExpr: _extends: Expr - decl: Decl - replacement_types: Type* +# decl: Decl +# replacement_types: Type* DefaultArgumentExpr: _extends: Expr - param_decl: ParamDecl - param_index: int - caller_side_default: Expr? +# param_decl: ParamDecl +# param_index: int +# caller_side_default: Expr? DiscardAssignmentExpr: _extends: Expr DotSyntaxBaseIgnoredExpr: _extends: Expr - qualifier: Expr - sub_expr: Expr +# qualifier: Expr +# sub_expr: Expr DynamicTypeExpr: _extends: Expr - base_expr: Expr +# base_expr: Expr EditorPlaceholderExpr: _extends: Expr EnumIsCaseExpr: _extends: Expr - sub_expr: Expr - type_repr: TypeRepr - element: EnumElementDecl +# sub_expr: Expr +# type_repr: TypeRepr +# element: EnumElementDecl ErrorExpr: _extends: Expr ExplicitCastExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr ForceValueExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr IdentityExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr IfExpr: _extends: Expr - condition: Expr - then_expr: Expr - else_expr: Expr +# condition: Expr +# then_expr: Expr +# else_expr: Expr ImplicitConversionExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr InOutExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr KeyPathApplicationExpr: _extends: Expr @@ -395,12 +385,12 @@ KeyPathDotExpr: KeyPathExpr: _extends: Expr - parsed_root: Expr? - parsed_path: Expr? +# parsed_root: Expr? +# parsed_path: Expr? LazyInitializerExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr LiteralExpr: _extends: Expr @@ -410,31 +400,31 @@ LookupExpr: MakeTemporarilyEscapableExpr: _extends: Expr - escaping_closure: OpaqueValueExpr - nonescaping_closure: Expr - sub_expr: Expr +# escaping_closure: OpaqueValueExpr +# nonescaping_closure: Expr +# sub_expr: Expr ObjCSelectorExpr: _extends: Expr - sub_expr: Expr - method: AbstractFunctionDecl +# sub_expr: Expr +# method: AbstractFunctionDecl OneWayExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr OpaqueValueExpr: _extends: Expr OpenExistentialExpr: _extends: Expr - sub_expr: Expr - existential: Expr - opaque_expr: OpaqueValueExpr +# sub_expr: Expr +# existential: Expr +# opaque_expr: OpaqueValueExpr OptionalEvaluationExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr OtherConstructorDeclRefExpr: _extends: Expr @@ -447,34 +437,34 @@ PropertyWrapperValuePlaceholderExpr: RebindSelfInConstructorExpr: _extends: Expr - sub_expr: Expr - self: VarDecl +# sub_expr: Expr +# self: VarDecl SequenceExpr: _extends: Expr SuperRefExpr: _extends: Expr - self: VarDecl +# self: VarDecl TapExpr: _extends: Expr - sub_expr: Expr? - var: VarDecl - body: BraceStmt +# sub_expr: Expr? +# var: VarDecl +# body: BraceStmt TupleElementExpr: _extends: Expr - sub_expr: Expr - index: int +# sub_expr: Expr +# index: int TupleExpr: _extends: Expr - elements: Expr* +# elements: Expr* TypeExpr: _extends: Expr - type_repr: TypeRepr? +# type_repr: TypeRepr? UnresolvedDeclRefExpr: _extends: Expr @@ -493,106 +483,106 @@ UnresolvedSpecializeExpr: VarargExpansionExpr: _extends: Expr - sub_expr: Expr +# sub_expr: Expr AnyPattern: _extends: Pattern BindingPattern: _extends: Pattern - sub_pattern: Pattern +# sub_pattern: Pattern BoolPattern: _extends: Pattern - value: boolean +# value: boolean EnumElementPattern: _extends: Pattern - element: EnumElementDecl - sub_pattern: Pattern? +# element: EnumElementDecl +# sub_pattern: Pattern? ExprPattern: _extends: Pattern - sub_expr: Expr +# sub_expr: Expr IsPattern: _extends: Pattern - cast_type_repr: TypeRepr? - sub_pattern: Pattern? +# cast_type_repr: TypeRepr? +# sub_pattern: Pattern? NamedPattern: _extends: Pattern - name: string +# name: string OptionalSomePattern: _extends: Pattern - sub_pattern: Pattern +# sub_pattern: Pattern ParenPattern: _extends: Pattern - sub_pattern: Pattern +# sub_pattern: Pattern TuplePattern: _extends: Pattern - elements: Pattern* +# elements: Pattern* TypedPattern: _extends: Pattern - sub_pattern: Pattern - type_repr: TypeRepr? +# sub_pattern: Pattern +# type_repr: TypeRepr? BraceStmt: _extends: Stmt - elements: AstNode* +# elements: AstNode* BreakStmt: _extends: Stmt - target_name: string? - target: Stmt? +# target_name: string? +# target: Stmt? CaseStmt: _extends: Stmt - body: Stmt - labels: CaseLabelItem* - variables: VarDecl* +# body: Stmt +# labels: CaseLabelItem* +# variables: VarDecl* CaseLabelItem: _extends: AstNode - pattern: Pattern - guard: Expr? +# pattern: Pattern +# guard: Expr? _dir: stmt ContinueStmt: _extends: Stmt - target_name: string? - target: Stmt? +# target_name: string? +# target: Stmt? DeferStmt: _extends: Stmt - body: BraceStmt +# body: BraceStmt FailStmt: _extends: Stmt FallthroughStmt: _extends: Stmt - fallthrough_source: CaseStmt - fallthrough_dest: CaseStmt +# fallthrough_source: CaseStmt +# fallthrough_dest: CaseStmt LabeledStmt: _extends: Stmt - label: string? +# label: string? PoundAssertStmt: _extends: Stmt ReturnStmt: _extends: Stmt - result: Expr? +# result: Expr? ThrowStmt: _extends: Stmt - sub_expr: Expr +# sub_expr: Expr YieldStmt: _extends: Stmt @@ -623,7 +613,7 @@ OpenedArchetypeType: PrimaryArchetypeType: _extends: ArchetypeType - interface_type: GenericTypeParamType +# interface_type: GenericTypeParamType DictionaryType: _extends: SyntaxSugarType @@ -644,29 +634,29 @@ AbstractFunctionDecl: _extends: - GenericContext - ValueDecl - name: string - body: BraceStmt? - params: ParamDecl* +# name: string +# body: BraceStmt? +# params: ParamDecl* AbstractStorageDecl: _extends: ValueDecl EnumElementDecl: _extends: ValueDecl - name: string - params: ParamDecl* +# name: string +# params: ParamDecl* TypeDecl: _extends: ValueDecl - name: string +# name: string AutoClosureExpr: _extends: AbstractClosureExpr - body: BraceStmt +# body: BraceStmt ClosureExpr: _extends: AbstractClosureExpr - body: BraceStmt +# body: BraceStmt ForceTryExpr: _extends: AnyTryExpr @@ -691,15 +681,15 @@ PrefixUnaryExpr: SelfApplyExpr: _extends: ApplyExpr - base_expr: Expr +# base_expr: Expr ArrayExpr: _extends: CollectionExpr - elements: Expr* +# elements: Expr* DictionaryExpr: _extends: CollectionExpr - elements: Expr* +# elements: Expr* CheckedCastExpr: _extends: ExplicitCastExpr @@ -817,10 +807,10 @@ BuiltinLiteralExpr: InterpolatedStringLiteralExpr: _extends: LiteralExpr - interpolation_expr: OpaqueValueExpr? - interpolation_count_expr: Expr? - literal_capacity_expr: Expr? - appending_expr: TapExpr? +# interpolation_expr: OpaqueValueExpr? +# interpolation_count_expr: Expr? +# literal_capacity_expr: Expr? +# appending_expr: TapExpr? RegexLiteralExpr: _extends: LiteralExpr @@ -836,51 +826,51 @@ DynamicLookupExpr: MemberRefExpr: _extends: LookupExpr - base_expr: Expr +# base_expr: Expr SubscriptExpr: _extends: - GenericContext - LookupExpr - base_expr: Expr - arguments: Argument* +# base_expr: Expr +# arguments: Argument* OverloadedDeclRefExpr: _extends: OverloadSetRefExpr DoCatchStmt: _extends: LabeledStmt - body: Stmt - catches: CaseStmt* +# body: Stmt +# catches: CaseStmt* DoStmt: _extends: LabeledStmt - body: BraceStmt +# body: BraceStmt ForEachStmt: _extends: LabeledStmt - body: BraceStmt - sequence: Expr - where: Expr? +# body: BraceStmt +# sequence: Expr +# where: Expr? LabeledConditionalStmt: _extends: LabeledStmt - condition: StmtCondition +# condition: StmtCondition StmtCondition: _extends: AstNode - elements: ConditionElement* +# elements: ConditionElement* _dir: stmt RepeatWhileStmt: _extends: LabeledStmt - condition: Expr - body: Stmt +# condition: Expr +# body: Stmt SwitchStmt: _extends: LabeledStmt - expr: Expr - cases: CaseStmt* +# expr: Expr +# cases: CaseStmt* BoundGenericClassType: _extends: BoundGenericType @@ -893,7 +883,7 @@ BoundGenericStructType: ClassType: _extends: NominalType - decl: ClassDecl +# decl: ClassDecl EnumType: _extends: NominalType @@ -903,7 +893,7 @@ ProtocolType: StructType: _extends: NominalType - decl: StructDecl +# decl: StructDecl ArraySliceType: _extends: UnarySyntaxSugarType @@ -928,14 +918,14 @@ SubscriptDecl: VarDecl: _extends: AbstractStorageDecl - name: string - type: Type +# name: string +# type: Type AbstractTypeParamDecl: _extends: TypeDecl -GenericContext: - generic_type_params: GenericTypeParamDecl* +GenericContext: {} +# generic_type_params: GenericTypeParamDecl* GenericTypeDecl: _extends: @@ -962,18 +952,18 @@ IsExpr: BooleanLiteralExpr: _extends: BuiltinLiteralExpr - value: boolean +# value: boolean MagicIdentifierLiteralExpr: _extends: BuiltinLiteralExpr - kind: string +# kind: string NumberLiteralExpr: _extends: BuiltinLiteralExpr StringLiteralExpr: _extends: BuiltinLiteralExpr - value: string +# value: string DynamicMemberRefExpr: _extends: DynamicLookupExpr @@ -983,16 +973,16 @@ DynamicSubscriptExpr: GuardStmt: _extends: LabeledConditionalStmt - body: BraceStmt +# body: BraceStmt IfStmt: _extends: LabeledConditionalStmt - then: Stmt - else: Stmt? +# then: Stmt +# else: Stmt? WhileStmt: _extends: LabeledConditionalStmt - body: Stmt +# body: Stmt AccessorDecl: _extends: FuncDecl @@ -1002,7 +992,7 @@ ConcreteFuncDecl: ConcreteVarDecl: _extends: VarDecl - introducer_int: int +# introducer_int: int ParamDecl: _extends: VarDecl @@ -1021,8 +1011,92 @@ TypeAliasDecl: FloatLiteralExpr: _extends: NumberLiteralExpr - string_value: string +# string_value: string IntegerLiteralExpr: _extends: NumberLiteralExpr - string_value: string +# string_value: string + +ErrorTypeRepr: + _extends: TypeRepr + +AttributedTypeRepr: + _extends: TypeRepr + +IdentTypeRepr: + _extends: TypeRepr + +ComponentIdentTypeRepr: + _extends: IdentTypeRepr + +SimpleIdentTypeRepr: + _extends: ComponentIdentTypeRepr + +GenericIdentTypeRepr: + _extends: ComponentIdentTypeRepr + +CompoundIdentTypeRepr: + _extends: IdentTypeRepr + +FunctionTypeRepr: + _extends: TypeRepr + +ArrayTypeRepr: + _extends: TypeRepr + +DictionaryTypeRepr: + _extends: TypeRepr + +OptionalTypeRepr: + _extends: TypeRepr + +ImplicitlyUnwrappedOptionalTypeRepr: + _extends: TypeRepr + +TupleTypeRepr: + _extends: TypeRepr + +CompositionTypeRepr: + _extends: TypeRepr + +MetatypeTypeRepr: + _extends: TypeRepr + +ProtocolTypeRepr: + _extends: TypeRepr + +OpaqueReturnTypeRepr: + _extends: TypeRepr + +NamedOpaqueReturnTypeRepr: + _extends: TypeRepr + +ExistentialTypeRepr: + _extends: TypeRepr + +PlaceholderTypeRepr: + _extends: TypeRepr + +SpecifierTypeRepr: + _extends: TypeRepr + +InOutTypeRepr: + _extends: SpecifierTypeRepr + +SharedTypeRepr: + _extends: SpecifierTypeRepr + +OwnedTypeRepr: + _extends: SpecifierTypeRepr + +IsolatedTypeRepr: + _extends: SpecifierTypeRepr + +CompileTimeConstTypeRepr: + _extends: SpecifierTypeRepr + +FixedTypeRepr: + _extends: TypeRepr + +SilBoxTypeRepr: + _extends: TypeRepr diff --git a/swift/codegen/templates/trap_traps.mustache b/swift/codegen/templates/trap_traps.mustache index 0e17131e1dc..e5a576f0a33 100644 --- a/swift/codegen/templates/trap_traps.mustache +++ b/swift/codegen/templates/trap_traps.mustache @@ -29,5 +29,14 @@ inline std::ostream &operator<<(std::ostream &out, const {{name}}{{trap_affix}} << {{#get_streamer}}e.{{field_name}}{{/get_streamer}}{{/fields}} << ")"; return out; } +{{#id}} + +namespace detail { +template<> +struct ToBindingTrapFunctor<{{type}}> { + using type = {{name}}{{trap_affix}}; +}; +} +{{/id}} {{/traps}} } diff --git a/swift/extractor/BUILD.bazel b/swift/extractor/BUILD.bazel index 7c7a1571ee1..c1badb3f67f 100644 --- a/swift/extractor/BUILD.bazel +++ b/swift/extractor/BUILD.bazel @@ -3,22 +3,24 @@ load("//swift:rules.bzl", "swift_cc_binary") swift_cc_binary( name = "extractor", srcs = [ + "SwiftDispatcher.h", "SwiftExtractor.cpp", "SwiftExtractor.h", "SwiftExtractorConfiguration.h", - "SwiftDispatcher.h", "SwiftTagTraits.h", - "main.cpp", "SwiftVisitor.h", + "main.cpp", "visitors/DeclVisitor.h", "visitors/ExprVisitor.h", - "visitors/StmtVisitor.h", - "visitors/TypeVisitor.h", "visitors/PatternVisitor.h", + "visitors/StmtVisitor.h", + "visitors/TypeReprVisitor.h", + "visitors/TypeVisitor.h", + "visitors/VisitorBase.h", ], visibility = ["//swift:__pkg__"], deps = [ - "//swift/tools/prebuilt:swift-llvm-support", "//swift/extractor/trap", + "//swift/tools/prebuilt:swift-llvm-support", ], ) diff --git a/swift/extractor/SwiftDispatcher.h b/swift/extractor/SwiftDispatcher.h index a3803777425..4bcafc03995 100644 --- a/swift/extractor/SwiftDispatcher.h +++ b/swift/extractor/SwiftDispatcher.h @@ -10,42 +10,6 @@ namespace codeql { -namespace detail { - -// The following `getKindName`s are used within "TBD" TRAP entries to visually mark an AST node as -// not properly emitted yet. -// TODO: To be replaced with QL counterpart -template -inline std::string getKindName(Kind kind) { - return Parent::getKindName(kind).str(); -} - -template <> -inline std::string getKindName(swift::TypeKind kind) { - switch (kind) { -#define TYPE(CLASS, PARENT) \ - case swift::TypeKind::CLASS: \ - return #CLASS; -#include "swift/AST/TypeNodes.def" - default: - return "Unknown"; - } -} - -template <> -std::string inline getKindName(swift::TypeReprKind kind) { - switch (kind) { -#define TYPEREPR(CLASS, PARENT) \ - case swift::TypeReprKind::CLASS: \ - return #CLASS; -#include "swift/AST/TypeReprNodes.def" - default: - return "Unknown"; - } -} - -} // namespace detail - // The main responsibilities of the SwiftDispatcher are as follows: // * redirect specific AST node emission to a corresponding visitor (statements, expressions, etc.) // * storing TRAP labels for emitted AST nodes (in the TrapLabelStore) to avoid re-emission @@ -57,18 +21,21 @@ class SwiftDispatcher { SwiftDispatcher(const swift::SourceManager& sourceManager, TrapArena& arena, TrapOutput& trap) : sourceManager{sourceManager}, arena{arena}, trap{trap} {} + template + void emit(const Entry& entry) { + trap.emit(entry); + } + // This is a helper method to emit TRAP entries for AST nodes that we don't fully support yet. - template - void TBD(Child* entity, const std::string& suffix) { - using namespace std::string_literals; + template + void emitUnknown(E* entity) { auto label = assignNewLabel(entity); - auto kind = detail::getKindName(static_cast(entity)->getKind()); - auto name = "TBD ("s + kind + suffix + ")"; - if constexpr (std::is_same_v) { - trap.emit(UnknownTypesTrap{label, name}); - } else { - trap.emit(UnknownAstNodesTrap{label, name}); - } + using Trap = BindingTrapOf; + static_assert(sizeof(Trap) == sizeof(label), + "Binding traps of unknown entities must only have the `id` field (the class " + "should be empty in schema.yml)"); + emit(Trap{label}); + emit(ElementIsUnknownTrap{label}); } private: @@ -88,7 +55,7 @@ class SwiftDispatcher { // this is required so we avoid any recursive loop: a `fetchLabel` during the visit of `e` might // end up calling `fetchLabel` on `e` itself, so we want the visit of `e` to call `fetchLabel` // only after having called `assignNewLabel` on `e`. - assert(holds_alternative(waitingForNewLabel) && + assert(std::holds_alternative(waitingForNewLabel) && "fetchLabel called before assignNewLabel"); if (auto l = store.get(e)) { return *l; diff --git a/swift/extractor/SwiftTagTraits.h b/swift/extractor/SwiftTagTraits.h index bc8886bfaea..f2bd7fb0266 100644 --- a/swift/extractor/SwiftTagTraits.h +++ b/swift/extractor/SwiftTagTraits.h @@ -14,6 +14,7 @@ using SILBlockStorageTypeTag = SilBlockStorageTypeTag; using SILBoxTypeTag = SilBoxTypeTag; using SILFunctionTypeTag = SilFunctionTypeTag; using SILTokenTypeTag = SilTokenTypeTag; +using SILBoxTypeReprTag = SilBoxTypeReprTag; #define MAP_TYPE_TO_TAG(TYPE, TAG) \ template <> \ @@ -54,6 +55,10 @@ MAP_TAG(Pattern); #include "swift/AST/PatternNodes.def" MAP_TAG(TypeRepr); +#define ABSTRACT_TYPEREPR(CLASS, PARENT) MAP_SUBTAG(CLASS##TypeRepr, PARENT) +#define TYPEREPR(CLASS, PARENT) ABSTRACT_TYPEREPR(CLASS, PARENT) +#include "swift/AST/TypeReprNodes.def" + MAP_TYPE_TO_TAG(TypeBase, TypeTag); #define ABSTRACT_TYPE(CLASS, PARENT) MAP_SUBTAG(CLASS##Type, PARENT) #define TYPE(CLASS, PARENT) ABSTRACT_TYPE(CLASS, PARENT) diff --git a/swift/extractor/SwiftVisitor.h b/swift/extractor/SwiftVisitor.h index bc766ce1278..6efcb8b953e 100644 --- a/swift/extractor/SwiftVisitor.h +++ b/swift/extractor/SwiftVisitor.h @@ -5,6 +5,7 @@ #include "swift/extractor/visitors/ExprVisitor.h" #include "swift/extractor/visitors/StmtVisitor.h" #include "swift/extractor/visitors/TypeVisitor.h" +#include "swift/extractor/visitors/TypeReprVisitor.h" #include "swift/extractor/visitors/PatternVisitor.h" namespace codeql { @@ -23,12 +24,13 @@ class SwiftVisitor : private SwiftDispatcher { void visit(swift::Stmt* stmt) override { stmtVisitor.visit(stmt); } void visit(swift::Expr* expr) override { exprVisitor.visit(expr); } void visit(swift::Pattern* pattern) override { patternVisitor.visit(pattern); } - void visit(swift::TypeRepr* type) override { TBD(type, "TypeRepr"); } + void visit(swift::TypeRepr* type) override { typeReprVisitor.visit(type); } void visit(swift::TypeBase* type) override { typeVisitor.visit(type); } DeclVisitor declVisitor{*this}; ExprVisitor exprVisitor{*this}; StmtVisitor stmtVisitor{*this}; + TypeReprVisitor typeReprVisitor{*this}; TypeVisitor typeVisitor{*this}; PatternVisitor patternVisitor{*this}; }; diff --git a/swift/extractor/trap/TrapLabel.h b/swift/extractor/trap/TrapLabel.h index fb710fc8625..9776f728e98 100644 --- a/swift/extractor/trap/TrapLabel.h +++ b/swift/extractor/trap/TrapLabel.h @@ -4,8 +4,6 @@ #include #include -#include "swift/extractor/trap/generated/TrapTags.h" - namespace codeql { class UntypedTrapLabel { @@ -46,14 +44,7 @@ class TrapLabel : public UntypedTrapLabel { template TrapLabel(const TrapLabel& other) : UntypedTrapLabel(other) { - // we temporarily need to bypass the label type system for unknown AST nodes and types - if constexpr (std::is_same_v) { - static_assert(std::is_base_of_v, "wrong label assignment!"); - } else if constexpr (std::is_same_v) { - static_assert(std::is_base_of_v, "wrong label assignment!"); - } else { - static_assert(std::is_base_of_v, "wrong label assignment!"); - } + static_assert(std::is_base_of_v, "wrong label assignment!"); } }; diff --git a/swift/extractor/trap/TrapTagTraits.h b/swift/extractor/trap/TrapTagTraits.h index 359951f6810..430f8e0cd2b 100644 --- a/swift/extractor/trap/TrapTagTraits.h +++ b/swift/extractor/trap/TrapTagTraits.h @@ -8,11 +8,17 @@ namespace codeql { namespace detail { +// must be instantiated for default mapping from entities to tags template struct ToTagFunctor; + +// can be instantiated to override the default mapping for special cases template struct ToTagOverride : ToTagFunctor {}; +// must be instantiated to map trap labels to the corresponding generated binding trap entry +template +struct ToBindingTrapFunctor; } // namespace detail template @@ -21,4 +27,7 @@ using TrapTagOf = typename detail::ToTagOverride>::type; template using TrapLabelOf = TrapLabel>; +template +using BindingTrapOf = typename detail::ToBindingTrapFunctor>::type; + } // namespace codeql diff --git a/swift/extractor/visitors/DeclVisitor.h b/swift/extractor/visitors/DeclVisitor.h index 536239f93f7..77fffda3e50 100644 --- a/swift/extractor/visitors/DeclVisitor.h +++ b/swift/extractor/visitors/DeclVisitor.h @@ -1,22 +1,12 @@ #pragma once -#include "swift/extractor/SwiftDispatcher.h" -#include +#include "swift/extractor/visitors/VisitorBase.h" namespace codeql { -class DeclVisitor : public swift::DeclVisitor { +class DeclVisitor : public AstVisitorBase { public: - // SwiftDispatcher should outlive the DeclVisitor - DeclVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {} - - template - void visitDecl(E* decl) { - dispatcher.TBD(decl, "Decl"); - } - - private: - SwiftDispatcher& dispatcher; + using AstVisitorBase::AstVisitorBase; }; } // namespace codeql diff --git a/swift/extractor/visitors/ExprVisitor.h b/swift/extractor/visitors/ExprVisitor.h index 68eeadba6a6..5ac9f4f6ebb 100644 --- a/swift/extractor/visitors/ExprVisitor.h +++ b/swift/extractor/visitors/ExprVisitor.h @@ -1,22 +1,12 @@ #pragma once -#include "swift/extractor/SwiftDispatcher.h" -#include +#include "swift/extractor/visitors/VisitorBase.h" namespace codeql { -class ExprVisitor : public swift::ExprVisitor { +class ExprVisitor : public AstVisitorBase { public: - // SwiftDispatcher should outlive the ExprVisitor - ExprVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {} - - template - void visitExpr(E* expr) { - dispatcher.TBD(expr, "Expr"); - } - - private: - SwiftDispatcher& dispatcher; + using AstVisitorBase::AstVisitorBase; }; } // namespace codeql diff --git a/swift/extractor/visitors/PatternVisitor.h b/swift/extractor/visitors/PatternVisitor.h index d51500a413f..011908b612a 100644 --- a/swift/extractor/visitors/PatternVisitor.h +++ b/swift/extractor/visitors/PatternVisitor.h @@ -1,38 +1,12 @@ #pragma once -#include "swift/extractor/SwiftDispatcher.h" -#include +#include "swift/extractor/visitors/VisitorBase.h" namespace codeql { -namespace detail { -// swift code lacks default implementations of visitor for some entities. We can add those here -// while we do not have yet all implemented. This is a simplified version of the corresponding Expr -// code in swift/AST/ASTVisitor.h -template -class PatchedPatternVisitor : public swift::PatternVisitor { +class PatternVisitor : public AstVisitorBase { public: -#define PATTERN(CLASS, PARENT) \ - void visit##CLASS##Pattern(swift::CLASS##Pattern* E) { \ - return static_cast(this)->visit##PARENT(E); \ - } -#include "swift/AST/PatternNodes.def" -}; - -} // namespace detail - -class PatternVisitor : public detail::PatchedPatternVisitor { - public: - // SwiftDispatcher should outlive the PatternVisitor - PatternVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {} - - template - void visitPattern(E* pattern) { - dispatcher.TBD(pattern, "Pattern"); - } - - private: - SwiftDispatcher& dispatcher; + using AstVisitorBase::AstVisitorBase; }; } // namespace codeql diff --git a/swift/extractor/visitors/StmtVisitor.h b/swift/extractor/visitors/StmtVisitor.h index dd6e9d468a9..363f4a88cc8 100644 --- a/swift/extractor/visitors/StmtVisitor.h +++ b/swift/extractor/visitors/StmtVisitor.h @@ -1,39 +1,12 @@ #pragma once -#include "swift/extractor/SwiftDispatcher.h" -#include +#include "swift/extractor/visitors/VisitorBase.h" namespace codeql { -namespace detail { -// swift code lacks default implementations of visitor for some entities. We can add those here -// while we do not have yet all implemented. This is a simplified version of the corresponding Expr -// code in swift/AST/ASTVisitor.h -template -class PatchedStmtVisitor : public swift::StmtVisitor { +class StmtVisitor : public AstVisitorBase { public: -#define ABSTRACT_STMT(CLASS, PARENT) \ - void visit##CLASS##Stmt(swift::CLASS##Stmt* E) { \ - return static_cast(this)->visit##PARENT(E); \ - } -#define STMT(CLASS, PARENT) ABSTRACT_STMT(CLASS, PARENT) -#include "swift/AST/StmtNodes.def" -}; - -} // namespace detail - -class StmtVisitor : public detail::PatchedStmtVisitor { - public: - // SwiftDispatcher should outlive the StmtVisitor - StmtVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {} - - template - void visitStmt(E* stmt) { - dispatcher.TBD(stmt, "Stmt"); - } - - private: - SwiftDispatcher& dispatcher; + using AstVisitorBase::AstVisitorBase; }; } // namespace codeql diff --git a/swift/extractor/visitors/TypeReprVisitor.h b/swift/extractor/visitors/TypeReprVisitor.h new file mode 100644 index 00000000000..81b17d625ae --- /dev/null +++ b/swift/extractor/visitors/TypeReprVisitor.h @@ -0,0 +1,12 @@ +#pragma once + +#include "swift/extractor/visitors/VisitorBase.h" + +namespace codeql { + +class TypeReprVisitor : public AstVisitorBase { + public: + using AstVisitorBase::AstVisitorBase; +}; + +} // namespace codeql diff --git a/swift/extractor/visitors/TypeVisitor.h b/swift/extractor/visitors/TypeVisitor.h index 982f875e8c2..d57d1b45b90 100644 --- a/swift/extractor/visitors/TypeVisitor.h +++ b/swift/extractor/visitors/TypeVisitor.h @@ -1,22 +1,10 @@ #pragma once -#include "swift/extractor/SwiftDispatcher.h" -#include - +#include "swift/extractor/visitors/VisitorBase.h" namespace codeql { - -class TypeVisitor : public swift::TypeVisitor { +class TypeVisitor : public TypeVisitorBase { public: - // SwiftDispatcher should outlive the TypeVisitor - TypeVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {} - - template - void visitType(E* type) { - dispatcher.TBD(type, "Type"); - } - - private: - SwiftDispatcher& dispatcher; + using TypeVisitorBase::TypeVisitorBase; }; } // namespace codeql diff --git a/swift/extractor/visitors/VisitorBase.h b/swift/extractor/visitors/VisitorBase.h new file mode 100644 index 00000000000..132d3b1663c --- /dev/null +++ b/swift/extractor/visitors/VisitorBase.h @@ -0,0 +1,63 @@ +#pragma once + +#include +#include + +#include "swift/extractor/SwiftDispatcher.h" + +namespace codeql { + +namespace detail { +class DispatcherWrapper { + protected: + SwiftDispatcher& dispatcher_; + + public: + // SwiftDispatcher should outlive this instance + DispatcherWrapper(SwiftDispatcher& dispatcher) : dispatcher_{dispatcher} {} +}; + +} // namespace detail + +// we want to override the default swift visitor behaviour of chaining calls to immediate +// superclasses by default and instead provide our own TBD default (using the exact type) +#define DEFAULT(KIND, CLASS, PARENT) \ + void visit##CLASS##KIND(swift::CLASS##KIND* e) { dispatcher_.emitUnknown(e); } + +// base class for our AST visitors, getting a SwiftDispatcher member and default emission for +// unknown/TBD entities +template +class AstVisitorBase : public swift::ASTVisitor, detail::DispatcherWrapper { + public: + using DispatcherWrapper::DispatcherWrapper; + +#define DECL(CLASS, PARENT) DEFAULT(Decl, CLASS, PARENT) +#include "swift/AST/DeclNodes.def" + +#define STMT(CLASS, PARENT) DEFAULT(Stmt, CLASS, PARENT) +#include "swift/AST/StmtNodes.def" + +#define EXPR(CLASS, PARENT) DEFAULT(Expr, CLASS, PARENT) +#include "swift/AST/ExprNodes.def" + +#define PATTERN(CLASS, PARENT) DEFAULT(Pattern, CLASS, PARENT) +#include "swift/AST/PatternNodes.def" + +#define TYPEREPR(CLASS, PARENT) DEFAULT(TypeRepr, CLASS, PARENT) +#include "swift/AST/TypeReprNodes.def" +}; + +// base class for our type visitor, getting a SwiftDispatcher member and default emission for +// unknown/TBD types +template +class TypeVisitorBase : public swift::TypeVisitor, detail::DispatcherWrapper { + public: + using DispatcherWrapper::DispatcherWrapper; + +#define TYPE(CLASS, PARENT) DEFAULT(Type, CLASS, PARENT) +#include "swift/AST/TypeNodes.def" +}; + +#undef DEFAULT + +} // namespace codeql diff --git a/swift/ql/lib/codeql/swift/elements.qll b/swift/ql/lib/codeql/swift/elements.qll index ab923309b42..54f6253a598 100644 --- a/swift/ql/lib/codeql/swift/elements.qll +++ b/swift/ql/lib/codeql/swift/elements.qll @@ -19,10 +19,12 @@ import codeql.swift.elements.expr.Argument import codeql.swift.elements.expr.ArrayExpr import codeql.swift.elements.type.ArraySliceType import codeql.swift.elements.expr.ArrayToPointerExpr +import codeql.swift.elements.typerepr.ArrayTypeRepr import codeql.swift.elements.expr.ArrowExpr import codeql.swift.elements.expr.AssignExpr import codeql.swift.elements.decl.AssociatedTypeDecl import codeql.swift.elements.AstNode +import codeql.swift.elements.typerepr.AttributedTypeRepr import codeql.swift.elements.expr.AutoClosureExpr import codeql.swift.elements.expr.AwaitExpr import codeql.swift.elements.expr.BinaryExpr @@ -65,6 +67,10 @@ import codeql.swift.elements.expr.CodeCompletionExpr import codeql.swift.elements.expr.CoerceExpr import codeql.swift.elements.expr.CollectionExpr import codeql.swift.elements.expr.CollectionUpcastConversionExpr +import codeql.swift.elements.typerepr.CompileTimeConstTypeRepr +import codeql.swift.elements.typerepr.ComponentIdentTypeRepr +import codeql.swift.elements.typerepr.CompositionTypeRepr +import codeql.swift.elements.typerepr.CompoundIdentTypeRepr import codeql.swift.elements.decl.ConcreteFuncDecl import codeql.swift.elements.decl.ConcreteVarDecl import codeql.swift.elements.stmt.ConditionElement @@ -85,6 +91,7 @@ import codeql.swift.elements.decl.DestructorDecl import codeql.swift.elements.expr.DestructureTupleExpr import codeql.swift.elements.expr.DictionaryExpr import codeql.swift.elements.type.DictionaryType +import codeql.swift.elements.typerepr.DictionaryTypeRepr import codeql.swift.elements.expr.DifferentiableFunctionExpr import codeql.swift.elements.expr.DifferentiableFunctionExtractOriginalExpr import codeql.swift.elements.expr.DiscardAssignmentExpr @@ -109,9 +116,11 @@ import codeql.swift.elements.type.EnumType import codeql.swift.elements.expr.ErasureExpr import codeql.swift.elements.expr.ErrorExpr import codeql.swift.elements.type.ErrorType +import codeql.swift.elements.typerepr.ErrorTypeRepr import codeql.swift.elements.expr.ExistentialMetatypeToObjectExpr import codeql.swift.elements.type.ExistentialMetatypeType import codeql.swift.elements.type.ExistentialType +import codeql.swift.elements.typerepr.ExistentialTypeRepr import codeql.swift.elements.expr.ExplicitCastExpr import codeql.swift.elements.expr.Expr import codeql.swift.elements.pattern.ExprPattern @@ -119,6 +128,7 @@ import codeql.swift.elements.decl.ExtensionDecl import codeql.swift.elements.stmt.FailStmt import codeql.swift.elements.stmt.FallthroughStmt import codeql.swift.elements.File +import codeql.swift.elements.typerepr.FixedTypeRepr import codeql.swift.elements.expr.FloatLiteralExpr import codeql.swift.elements.stmt.ForEachStmt import codeql.swift.elements.expr.ForceTryExpr @@ -128,27 +138,33 @@ import codeql.swift.elements.expr.ForeignObjectConversionExpr import codeql.swift.elements.decl.FuncDecl import codeql.swift.elements.expr.FunctionConversionExpr import codeql.swift.elements.type.FunctionType +import codeql.swift.elements.typerepr.FunctionTypeRepr import codeql.swift.elements.decl.GenericContext import codeql.swift.elements.type.GenericFunctionType +import codeql.swift.elements.typerepr.GenericIdentTypeRepr import codeql.swift.elements.decl.GenericTypeDecl import codeql.swift.elements.decl.GenericTypeParamDecl import codeql.swift.elements.type.GenericTypeParamType import codeql.swift.elements.stmt.GuardStmt +import codeql.swift.elements.typerepr.IdentTypeRepr import codeql.swift.elements.expr.IdentityExpr import codeql.swift.elements.decl.IfConfigDecl import codeql.swift.elements.expr.IfExpr import codeql.swift.elements.stmt.IfStmt import codeql.swift.elements.expr.ImplicitConversionExpr +import codeql.swift.elements.typerepr.ImplicitlyUnwrappedOptionalTypeRepr import codeql.swift.elements.decl.ImportDecl import codeql.swift.elements.expr.InOutExpr import codeql.swift.elements.expr.InOutToPointerExpr import codeql.swift.elements.type.InOutType +import codeql.swift.elements.typerepr.InOutTypeRepr import codeql.swift.elements.decl.InfixOperatorDecl import codeql.swift.elements.expr.InjectIntoOptionalExpr import codeql.swift.elements.expr.IntegerLiteralExpr import codeql.swift.elements.expr.InterpolatedStringLiteralExpr import codeql.swift.elements.expr.IsExpr import codeql.swift.elements.pattern.IsPattern +import codeql.swift.elements.typerepr.IsolatedTypeRepr import codeql.swift.elements.decl.IterableDeclContext import codeql.swift.elements.expr.KeyPathApplicationExpr import codeql.swift.elements.expr.KeyPathDotExpr @@ -170,9 +186,11 @@ import codeql.swift.elements.expr.MakeTemporarilyEscapableExpr import codeql.swift.elements.expr.MemberRefExpr import codeql.swift.elements.expr.MetatypeConversionExpr import codeql.swift.elements.type.MetatypeType +import codeql.swift.elements.typerepr.MetatypeTypeRepr import codeql.swift.elements.decl.MissingMemberDecl import codeql.swift.elements.decl.ModuleDecl import codeql.swift.elements.type.ModuleType +import codeql.swift.elements.typerepr.NamedOpaqueReturnTypeRepr import codeql.swift.elements.pattern.NamedPattern import codeql.swift.elements.type.NestedArchetypeType import codeql.swift.elements.expr.NilLiteralExpr @@ -183,6 +201,7 @@ import codeql.swift.elements.expr.NumberLiteralExpr import codeql.swift.elements.expr.ObjCSelectorExpr import codeql.swift.elements.expr.ObjectLiteralExpr import codeql.swift.elements.expr.OneWayExpr +import codeql.swift.elements.typerepr.OpaqueReturnTypeRepr import codeql.swift.elements.type.OpaqueTypeArchetypeType import codeql.swift.elements.decl.OpaqueTypeDecl import codeql.swift.elements.expr.OpaqueValueExpr @@ -193,9 +212,11 @@ import codeql.swift.elements.expr.OptionalEvaluationExpr import codeql.swift.elements.pattern.OptionalSomePattern import codeql.swift.elements.expr.OptionalTryExpr import codeql.swift.elements.type.OptionalType +import codeql.swift.elements.typerepr.OptionalTypeRepr import codeql.swift.elements.expr.OtherConstructorDeclRefExpr import codeql.swift.elements.expr.OverloadSetRefExpr import codeql.swift.elements.expr.OverloadedDeclRefExpr +import codeql.swift.elements.typerepr.OwnedTypeRepr import codeql.swift.elements.decl.ParamDecl import codeql.swift.elements.expr.ParenExpr import codeql.swift.elements.pattern.ParenPattern @@ -203,6 +224,7 @@ import codeql.swift.elements.type.ParenType import codeql.swift.elements.pattern.Pattern import codeql.swift.elements.decl.PatternBindingDecl import codeql.swift.elements.type.PlaceholderType +import codeql.swift.elements.typerepr.PlaceholderTypeRepr import codeql.swift.elements.expr.PointerToPointerExpr import codeql.swift.elements.decl.PostfixOperatorDecl import codeql.swift.elements.expr.PostfixUnaryExpr @@ -217,6 +239,7 @@ import codeql.swift.elements.type.ProtocolCompositionType import codeql.swift.elements.decl.ProtocolDecl import codeql.swift.elements.expr.ProtocolMetatypeToObjectExpr import codeql.swift.elements.type.ProtocolType +import codeql.swift.elements.typerepr.ProtocolTypeRepr import codeql.swift.elements.expr.RebindSelfInConstructorExpr import codeql.swift.elements.type.ReferenceStorageType import codeql.swift.elements.expr.RegexLiteralExpr @@ -225,10 +248,14 @@ import codeql.swift.elements.stmt.ReturnStmt import codeql.swift.elements.expr.SelfApplyExpr import codeql.swift.elements.type.SequenceArchetypeType import codeql.swift.elements.expr.SequenceExpr +import codeql.swift.elements.typerepr.SharedTypeRepr import codeql.swift.elements.type.SilBlockStorageType import codeql.swift.elements.type.SilBoxType +import codeql.swift.elements.typerepr.SilBoxTypeRepr import codeql.swift.elements.type.SilFunctionType import codeql.swift.elements.type.SilTokenType +import codeql.swift.elements.typerepr.SimpleIdentTypeRepr +import codeql.swift.elements.typerepr.SpecifierTypeRepr import codeql.swift.elements.stmt.Stmt import codeql.swift.elements.stmt.StmtCondition import codeql.swift.elements.expr.StringLiteralExpr @@ -250,6 +277,7 @@ import codeql.swift.elements.expr.TupleElementExpr import codeql.swift.elements.expr.TupleExpr import codeql.swift.elements.pattern.TuplePattern import codeql.swift.elements.type.TupleType +import codeql.swift.elements.typerepr.TupleTypeRepr import codeql.swift.elements.type.Type import codeql.swift.elements.decl.TypeAliasDecl import codeql.swift.elements.type.TypeAliasType @@ -262,8 +290,6 @@ import codeql.swift.elements.type.UnarySyntaxSugarType import codeql.swift.elements.type.UnboundGenericType import codeql.swift.elements.expr.UnderlyingToOpaqueExpr import codeql.swift.elements.expr.UnevaluatedInstanceExpr -import codeql.swift.elements.UnknownAstNode -import codeql.swift.elements.type.UnknownType import codeql.swift.elements.type.UnmanagedStorageType import codeql.swift.elements.type.UnownedStorageType import codeql.swift.elements.expr.UnresolvedDeclRefExpr diff --git a/swift/ql/lib/codeql/swift/elements/Element.qll b/swift/ql/lib/codeql/swift/elements/Element.qll index 34350140805..65da2459a28 100644 --- a/swift/ql/lib/codeql/swift/elements/Element.qll +++ b/swift/ql/lib/codeql/swift/elements/Element.qll @@ -1,4 +1,11 @@ -// generated by codegen/codegen.py, remove this comment if you wish to edit this file private import codeql.swift.generated.Element -class Element extends ElementBase { } +class Element extends ElementBase { + override string toString() { result = getPrimaryQlClasses() } +} + +class UnknownElement extends Element { + UnknownElement() { isUnknown() } + + override string toString() { result = "TBD (" + getPrimaryQlClasses() + ")" } +} diff --git a/swift/ql/lib/codeql/swift/elements/UnknownAstNode.qll b/swift/ql/lib/codeql/swift/elements/UnknownAstNode.qll deleted file mode 100644 index 7314e01d4b6..00000000000 --- a/swift/ql/lib/codeql/swift/elements/UnknownAstNode.qll +++ /dev/null @@ -1,5 +0,0 @@ -private import codeql.swift.generated.UnknownAstNode - -class UnknownAstNode extends UnknownAstNodeBase { - override string toString() { result = getName() } -} diff --git a/swift/ql/lib/codeql/swift/elements/type/UnknownType.qll b/swift/ql/lib/codeql/swift/elements/type/UnknownType.qll deleted file mode 100644 index b869a3b2f61..00000000000 --- a/swift/ql/lib/codeql/swift/elements/type/UnknownType.qll +++ /dev/null @@ -1,4 +0,0 @@ -// generated by codegen/codegen.py, remove this comment if you wish to edit this file -private import codeql.swift.generated.type.UnknownType - -class UnknownType extends UnknownTypeBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/ArrayTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/ArrayTypeRepr.qll new file mode 100644 index 00000000000..84f2705b6fe --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/ArrayTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.ArrayTypeRepr + +class ArrayTypeRepr extends ArrayTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/AttributedTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/AttributedTypeRepr.qll new file mode 100644 index 00000000000..73d3ea97b8f --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/AttributedTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.AttributedTypeRepr + +class AttributedTypeRepr extends AttributedTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/CompileTimeConstTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/CompileTimeConstTypeRepr.qll new file mode 100644 index 00000000000..4235ccbcf50 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/CompileTimeConstTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.CompileTimeConstTypeRepr + +class CompileTimeConstTypeRepr extends CompileTimeConstTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/ComponentIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/ComponentIdentTypeRepr.qll new file mode 100644 index 00000000000..0b5640208f4 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/ComponentIdentTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.ComponentIdentTypeRepr + +class ComponentIdentTypeRepr extends ComponentIdentTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/CompositionTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/CompositionTypeRepr.qll new file mode 100644 index 00000000000..4f79f493e7e --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/CompositionTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.CompositionTypeRepr + +class CompositionTypeRepr extends CompositionTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/CompoundIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/CompoundIdentTypeRepr.qll new file mode 100644 index 00000000000..aafc54489ac --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/CompoundIdentTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.CompoundIdentTypeRepr + +class CompoundIdentTypeRepr extends CompoundIdentTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/DictionaryTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/DictionaryTypeRepr.qll new file mode 100644 index 00000000000..a226c72c1d1 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/DictionaryTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.DictionaryTypeRepr + +class DictionaryTypeRepr extends DictionaryTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/ErrorTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/ErrorTypeRepr.qll new file mode 100644 index 00000000000..bc3a125e0ac --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/ErrorTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.ErrorTypeRepr + +class ErrorTypeRepr extends ErrorTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/ExistentialTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/ExistentialTypeRepr.qll new file mode 100644 index 00000000000..7762a02bb64 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/ExistentialTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.ExistentialTypeRepr + +class ExistentialTypeRepr extends ExistentialTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/FixedTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/FixedTypeRepr.qll new file mode 100644 index 00000000000..8c1687c8853 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/FixedTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.FixedTypeRepr + +class FixedTypeRepr extends FixedTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/FunctionTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/FunctionTypeRepr.qll new file mode 100644 index 00000000000..96cba609393 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/FunctionTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.FunctionTypeRepr + +class FunctionTypeRepr extends FunctionTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/GenericIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/GenericIdentTypeRepr.qll new file mode 100644 index 00000000000..48774afb51b --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/GenericIdentTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.GenericIdentTypeRepr + +class GenericIdentTypeRepr extends GenericIdentTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/IdentTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/IdentTypeRepr.qll new file mode 100644 index 00000000000..5fa70e354e4 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/IdentTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.IdentTypeRepr + +class IdentTypeRepr extends IdentTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/ImplicitlyUnwrappedOptionalTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/ImplicitlyUnwrappedOptionalTypeRepr.qll new file mode 100644 index 00000000000..d04f438d676 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/ImplicitlyUnwrappedOptionalTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.ImplicitlyUnwrappedOptionalTypeRepr + +class ImplicitlyUnwrappedOptionalTypeRepr extends ImplicitlyUnwrappedOptionalTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/InOutTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/InOutTypeRepr.qll new file mode 100644 index 00000000000..3c17987ccb1 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/InOutTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.InOutTypeRepr + +class InOutTypeRepr extends InOutTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/IsolatedTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/IsolatedTypeRepr.qll new file mode 100644 index 00000000000..1ba568bb793 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/IsolatedTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.IsolatedTypeRepr + +class IsolatedTypeRepr extends IsolatedTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/MetatypeTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/MetatypeTypeRepr.qll new file mode 100644 index 00000000000..6eb6f16f733 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/MetatypeTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.MetatypeTypeRepr + +class MetatypeTypeRepr extends MetatypeTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/NamedOpaqueReturnTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/NamedOpaqueReturnTypeRepr.qll new file mode 100644 index 00000000000..115b02b9858 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/NamedOpaqueReturnTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.NamedOpaqueReturnTypeRepr + +class NamedOpaqueReturnTypeRepr extends NamedOpaqueReturnTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/OpaqueReturnTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/OpaqueReturnTypeRepr.qll new file mode 100644 index 00000000000..cd0586d67f4 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/OpaqueReturnTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.OpaqueReturnTypeRepr + +class OpaqueReturnTypeRepr extends OpaqueReturnTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/OptionalTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/OptionalTypeRepr.qll new file mode 100644 index 00000000000..840cd191f52 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/OptionalTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.OptionalTypeRepr + +class OptionalTypeRepr extends OptionalTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/OwnedTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/OwnedTypeRepr.qll new file mode 100644 index 00000000000..4221a66b762 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/OwnedTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.OwnedTypeRepr + +class OwnedTypeRepr extends OwnedTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/PlaceholderTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/PlaceholderTypeRepr.qll new file mode 100644 index 00000000000..423ced1a5d8 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/PlaceholderTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.PlaceholderTypeRepr + +class PlaceholderTypeRepr extends PlaceholderTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/ProtocolTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/ProtocolTypeRepr.qll new file mode 100644 index 00000000000..ca229b0fad5 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/ProtocolTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.ProtocolTypeRepr + +class ProtocolTypeRepr extends ProtocolTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/SharedTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/SharedTypeRepr.qll new file mode 100644 index 00000000000..a2ab0f3a6fe --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/SharedTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.SharedTypeRepr + +class SharedTypeRepr extends SharedTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/SilBoxTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/SilBoxTypeRepr.qll new file mode 100644 index 00000000000..f792f2fa348 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/SilBoxTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.SilBoxTypeRepr + +class SilBoxTypeRepr extends SilBoxTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/SimpleIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/SimpleIdentTypeRepr.qll new file mode 100644 index 00000000000..070146f5ace --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/SimpleIdentTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.SimpleIdentTypeRepr + +class SimpleIdentTypeRepr extends SimpleIdentTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/SpecifierTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/SpecifierTypeRepr.qll new file mode 100644 index 00000000000..40d1d648881 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/SpecifierTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.SpecifierTypeRepr + +class SpecifierTypeRepr extends SpecifierTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/elements/typerepr/TupleTypeRepr.qll b/swift/ql/lib/codeql/swift/elements/typerepr/TupleTypeRepr.qll new file mode 100644 index 00000000000..44614dab3d2 --- /dev/null +++ b/swift/ql/lib/codeql/swift/elements/typerepr/TupleTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py, remove this comment if you wish to edit this file +private import codeql.swift.generated.typerepr.TupleTypeRepr + +class TupleTypeRepr extends TupleTypeReprBase { } diff --git a/swift/ql/lib/codeql/swift/generated/Element.qll b/swift/ql/lib/codeql/swift/generated/Element.qll index a2c0de1016f..a2c546d9c6b 100644 --- a/swift/ql/lib/codeql/swift/generated/Element.qll +++ b/swift/ql/lib/codeql/swift/generated/Element.qll @@ -13,4 +13,6 @@ class ElementBase extends @element { or result = getResolveStep().resolve() } + + predicate isUnknown() { element_is_unknown(this) } } diff --git a/swift/ql/lib/codeql/swift/generated/UnknownAstNode.qll b/swift/ql/lib/codeql/swift/generated/UnknownAstNode.qll deleted file mode 100644 index b3fe1fd4587..00000000000 --- a/swift/ql/lib/codeql/swift/generated/UnknownAstNode.qll +++ /dev/null @@ -1,12 +0,0 @@ -// generated by codegen/codegen.py -import codeql.swift.elements.decl.Decl -import codeql.swift.elements.expr.Expr -import codeql.swift.elements.pattern.Pattern -import codeql.swift.elements.stmt.Stmt -import codeql.swift.elements.typerepr.TypeRepr - -class UnknownAstNodeBase extends @unknown_ast_node, Decl, Expr, Pattern, Stmt, TypeRepr { - override string getAPrimaryQlClass() { result = "UnknownAstNode" } - - string getName() { unknown_ast_nodes(this, result) } -} diff --git a/swift/ql/lib/codeql/swift/generated/decl/AbstractFunctionDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/AbstractFunctionDecl.qll index 5a6ba0e41a7..120120ae136 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/AbstractFunctionDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/AbstractFunctionDecl.qll @@ -1,29 +1,5 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.BraceStmt import codeql.swift.elements.decl.GenericContext -import codeql.swift.elements.decl.ParamDecl import codeql.swift.elements.decl.ValueDecl -class AbstractFunctionDeclBase extends @abstract_function_decl, GenericContext, ValueDecl { - string getName() { abstract_function_decls(this, result) } - - BraceStmt getBody() { - exists(BraceStmt x | - abstract_function_decl_bodies(this, x) and - result = x.resolve() - ) - } - - predicate hasBody() { exists(getBody()) } - - ParamDecl getParam(int index) { - exists(ParamDecl x | - abstract_function_decl_params(this, index, x) and - result = x.resolve() - ) - } - - ParamDecl getAParam() { result = getParam(_) } - - int getNumberOfParams() { result = count(getAParam()) } -} +class AbstractFunctionDeclBase extends @abstract_function_decl, GenericContext, ValueDecl { } diff --git a/swift/ql/lib/codeql/swift/generated/decl/ConcreteVarDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/ConcreteVarDecl.qll index 5be11bfe33a..b8a5462a917 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/ConcreteVarDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/ConcreteVarDecl.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.decl.VarDecl class ConcreteVarDeclBase extends @concrete_var_decl, VarDecl { override string getAPrimaryQlClass() { result = "ConcreteVarDecl" } - - int getIntroducerInt() { concrete_var_decls(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/decl/EnumCaseDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/EnumCaseDecl.qll index 179552ebf94..c35853b6508 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/EnumCaseDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/EnumCaseDecl.qll @@ -1,18 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.decl.Decl -import codeql.swift.elements.decl.EnumElementDecl class EnumCaseDeclBase extends @enum_case_decl, Decl { override string getAPrimaryQlClass() { result = "EnumCaseDecl" } - - EnumElementDecl getElement(int index) { - exists(EnumElementDecl x | - enum_case_decl_elements(this, index, x) and - result = x.resolve() - ) - } - - EnumElementDecl getAnElement() { result = getElement(_) } - - int getNumberOfElements() { result = count(getAnElement()) } } diff --git a/swift/ql/lib/codeql/swift/generated/decl/EnumElementDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/EnumElementDecl.qll index 5a7cc81bb31..ddedc7cac87 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/EnumElementDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/EnumElementDecl.qll @@ -1,20 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.ParamDecl import codeql.swift.elements.decl.ValueDecl class EnumElementDeclBase extends @enum_element_decl, ValueDecl { override string getAPrimaryQlClass() { result = "EnumElementDecl" } - - string getName() { enum_element_decls(this, result) } - - ParamDecl getParam(int index) { - exists(ParamDecl x | - enum_element_decl_params(this, index, x) and - result = x.resolve() - ) - } - - ParamDecl getAParam() { result = getParam(_) } - - int getNumberOfParams() { result = count(getAParam()) } } diff --git a/swift/ql/lib/codeql/swift/generated/decl/GenericContext.qll b/swift/ql/lib/codeql/swift/generated/decl/GenericContext.qll index 3a474400f5c..f8dd6643292 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/GenericContext.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/GenericContext.qll @@ -1,16 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.Element -import codeql.swift.elements.decl.GenericTypeParamDecl -class GenericContextBase extends @generic_context, Element { - GenericTypeParamDecl getGenericTypeParam(int index) { - exists(GenericTypeParamDecl x | - generic_context_generic_type_params(this, index, x) and - result = x.resolve() - ) - } - - GenericTypeParamDecl getAGenericTypeParam() { result = getGenericTypeParam(_) } - - int getNumberOfGenericTypeParams() { result = count(getAGenericTypeParam()) } -} +class GenericContextBase extends @generic_context, Element { } diff --git a/swift/ql/lib/codeql/swift/generated/decl/IterableDeclContext.qll b/swift/ql/lib/codeql/swift/generated/decl/IterableDeclContext.qll index b389c8588d4..8c2ff0ab4b9 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/IterableDeclContext.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/IterableDeclContext.qll @@ -1,16 +1,4 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.Decl import codeql.swift.elements.Element -class IterableDeclContextBase extends @iterable_decl_context, Element { - Decl getMember(int index) { - exists(Decl x | - iterable_decl_context_members(this, index, x) and - result = x.resolve() - ) - } - - Decl getAMember() { result = getMember(_) } - - int getNumberOfMembers() { result = count(getAMember()) } -} +class IterableDeclContextBase extends @iterable_decl_context, Element { } diff --git a/swift/ql/lib/codeql/swift/generated/decl/NominalTypeDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/NominalTypeDecl.qll index 4924bb32a87..fdf14d54a77 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/NominalTypeDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/NominalTypeDecl.qll @@ -1,13 +1,5 @@ // generated by codegen/codegen.py import codeql.swift.elements.decl.GenericTypeDecl import codeql.swift.elements.decl.IterableDeclContext -import codeql.swift.elements.type.Type -class NominalTypeDeclBase extends @nominal_type_decl, GenericTypeDecl, IterableDeclContext { - Type getType() { - exists(Type x | - nominal_type_decls(this, x) and - result = x.resolve() - ) - } -} +class NominalTypeDeclBase extends @nominal_type_decl, GenericTypeDecl, IterableDeclContext { } diff --git a/swift/ql/lib/codeql/swift/generated/decl/PatternBindingDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/PatternBindingDecl.qll index 44c80c76efa..bf54ea37b30 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/PatternBindingDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/PatternBindingDecl.qll @@ -1,30 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.decl.Decl -import codeql.swift.elements.expr.Expr -import codeql.swift.elements.pattern.Pattern class PatternBindingDeclBase extends @pattern_binding_decl, Decl { override string getAPrimaryQlClass() { result = "PatternBindingDecl" } - - Expr getInit(int index) { - exists(Expr x | - pattern_binding_decl_inits(this, index, x) and - result = x.resolve() - ) - } - - predicate hasInit(int index) { exists(getInit(index)) } - - Expr getAnInit() { result = getInit(_) } - - Pattern getPattern(int index) { - exists(Pattern x | - pattern_binding_decl_patterns(this, index, x) and - result = x.resolve() - ) - } - - Pattern getAPattern() { result = getPattern(_) } - - int getNumberOfPatterns() { result = count(getAPattern()) } } diff --git a/swift/ql/lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll index 7c664ad9bca..de0477a038d 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/TopLevelCodeDecl.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.BraceStmt import codeql.swift.elements.decl.Decl class TopLevelCodeDeclBase extends @top_level_code_decl, Decl { override string getAPrimaryQlClass() { result = "TopLevelCodeDecl" } - - BraceStmt getBody() { - exists(BraceStmt x | - top_level_code_decls(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll index 89ff09d7511..92db5b23a59 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/TypeDecl.qll @@ -1,6 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.decl.ValueDecl -class TypeDeclBase extends @type_decl, ValueDecl { - string getName() { type_decls(this, result) } -} +class TypeDeclBase extends @type_decl, ValueDecl { } diff --git a/swift/ql/lib/codeql/swift/generated/decl/ValueDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/ValueDecl.qll index a9850e1c2a8..1ff38c8a696 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/ValueDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/ValueDecl.qll @@ -1,12 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.decl.Decl -import codeql.swift.elements.type.Type -class ValueDeclBase extends @value_decl, Decl { - Type getInterfaceType() { - exists(Type x | - value_decls(this, x) and - result = x.resolve() - ) - } -} +class ValueDeclBase extends @value_decl, Decl { } diff --git a/swift/ql/lib/codeql/swift/generated/decl/VarDecl.qll b/swift/ql/lib/codeql/swift/generated/decl/VarDecl.qll index 1ecd28c384a..26e9e1adc5a 100644 --- a/swift/ql/lib/codeql/swift/generated/decl/VarDecl.qll +++ b/swift/ql/lib/codeql/swift/generated/decl/VarDecl.qll @@ -1,14 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.decl.AbstractStorageDecl -import codeql.swift.elements.type.Type -class VarDeclBase extends @var_decl, AbstractStorageDecl { - string getName() { var_decls(this, result, _) } - - Type getType() { - exists(Type x | - var_decls(this, _, x) and - result = x.resolve() - ) - } -} +class VarDeclBase extends @var_decl, AbstractStorageDecl { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/AnyTryExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/AnyTryExpr.qll index 47a8b2505d9..5512ff6145b 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/AnyTryExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/AnyTryExpr.qll @@ -1,11 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -class AnyTryExprBase extends @any_try_expr, Expr { - Expr getSubExpr() { - exists(Expr x | - any_try_exprs(this, x) and - result = x.resolve() - ) - } -} +class AnyTryExprBase extends @any_try_expr, Expr { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/ApplyExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/ApplyExpr.qll index d9416bfa5e7..a5cf2699f24 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/ApplyExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/ApplyExpr.qll @@ -1,23 +1,4 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Argument import codeql.swift.elements.expr.Expr -class ApplyExprBase extends @apply_expr, Expr { - Expr getFunction() { - exists(Expr x | - apply_exprs(this, x) and - result = x.resolve() - ) - } - - Argument getArgument(int index) { - exists(Argument x | - apply_expr_arguments(this, index, x) and - result = x.resolve() - ) - } - - Argument getAnArgument() { result = getArgument(_) } - - int getNumberOfArguments() { result = count(getAnArgument()) } -} +class ApplyExprBase extends @apply_expr, Expr { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/Argument.qll b/swift/ql/lib/codeql/swift/generated/expr/Argument.qll index 9f16b90e3fe..0c50c9942b6 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/Argument.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/Argument.qll @@ -1,16 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.Element -import codeql.swift.elements.expr.Expr class ArgumentBase extends @argument, Element { override string getAPrimaryQlClass() { result = "Argument" } - - string getLabel() { arguments(this, result, _) } - - Expr getExpr() { - exists(Expr x | - arguments(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/ArrayExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/ArrayExpr.qll index e62af8dde55..6228a2ac5a6 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/ArrayExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/ArrayExpr.qll @@ -1,18 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.CollectionExpr -import codeql.swift.elements.expr.Expr class ArrayExprBase extends @array_expr, CollectionExpr { override string getAPrimaryQlClass() { result = "ArrayExpr" } - - Expr getElement(int index) { - exists(Expr x | - array_expr_elements(this, index, x) and - result = x.resolve() - ) - } - - Expr getAnElement() { result = getElement(_) } - - int getNumberOfElements() { result = count(getAnElement()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/AssignExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/AssignExpr.qll index b733f8fc3e2..84a7d94a2d5 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/AssignExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/AssignExpr.qll @@ -3,18 +3,4 @@ import codeql.swift.elements.expr.Expr class AssignExprBase extends @assign_expr, Expr { override string getAPrimaryQlClass() { result = "AssignExpr" } - - Expr getDest() { - exists(Expr x | - assign_exprs(this, x, _) and - result = x.resolve() - ) - } - - Expr getSource() { - exists(Expr x | - assign_exprs(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/AutoClosureExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/AutoClosureExpr.qll index f25248ed0fb..b8f4aa6e40f 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/AutoClosureExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/AutoClosureExpr.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.AbstractClosureExpr -import codeql.swift.elements.stmt.BraceStmt class AutoClosureExprBase extends @auto_closure_expr, AbstractClosureExpr { override string getAPrimaryQlClass() { result = "AutoClosureExpr" } - - BraceStmt getBody() { - exists(BraceStmt x | - auto_closure_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/BindOptionalExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/BindOptionalExpr.qll index 9cd270891ea..c059c171d81 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/BindOptionalExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/BindOptionalExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class BindOptionalExprBase extends @bind_optional_expr, Expr { override string getAPrimaryQlClass() { result = "BindOptionalExpr" } - - Expr getSubExpr() { - exists(Expr x | - bind_optional_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/BooleanLiteralExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/BooleanLiteralExpr.qll index 853c8f08629..42dac40df15 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/BooleanLiteralExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/BooleanLiteralExpr.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.expr.BuiltinLiteralExpr class BooleanLiteralExprBase extends @boolean_literal_expr, BuiltinLiteralExpr { override string getAPrimaryQlClass() { result = "BooleanLiteralExpr" } - - boolean getValue() { boolean_literal_exprs(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/CaptureListExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/CaptureListExpr.qll index 5e273ab1e4c..50abd143226 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/CaptureListExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/CaptureListExpr.qll @@ -1,26 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.ClosureExpr import codeql.swift.elements.expr.Expr -import codeql.swift.elements.decl.PatternBindingDecl class CaptureListExprBase extends @capture_list_expr, Expr { override string getAPrimaryQlClass() { result = "CaptureListExpr" } - - PatternBindingDecl getBindingDecl(int index) { - exists(PatternBindingDecl x | - capture_list_expr_binding_decls(this, index, x) and - result = x.resolve() - ) - } - - PatternBindingDecl getABindingDecl() { result = getBindingDecl(_) } - - int getNumberOfBindingDecls() { result = count(getABindingDecl()) } - - ClosureExpr getClosureBody() { - exists(ClosureExpr x | - capture_list_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/ClosureExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/ClosureExpr.qll index e1c1261654c..42ef84824f0 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/ClosureExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/ClosureExpr.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.AbstractClosureExpr -import codeql.swift.elements.stmt.BraceStmt class ClosureExprBase extends @closure_expr, AbstractClosureExpr { override string getAPrimaryQlClass() { result = "ClosureExpr" } - - BraceStmt getBody() { - exists(BraceStmt x | - closure_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/DeclRefExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/DeclRefExpr.qll index 11d81e5aecf..4832663c4ec 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/DeclRefExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/DeclRefExpr.qll @@ -1,26 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.Decl import codeql.swift.elements.expr.Expr -import codeql.swift.elements.type.Type class DeclRefExprBase extends @decl_ref_expr, Expr { override string getAPrimaryQlClass() { result = "DeclRefExpr" } - - Decl getDecl() { - exists(Decl x | - decl_ref_exprs(this, x) and - result = x.resolve() - ) - } - - Type getReplacementType(int index) { - exists(Type x | - decl_ref_expr_replacement_types(this, index, x) and - result = x.resolve() - ) - } - - Type getAReplacementType() { result = getReplacementType(_) } - - int getNumberOfReplacementTypes() { result = count(getAReplacementType()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/DefaultArgumentExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/DefaultArgumentExpr.qll index e959c9c4a44..da736a33062 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/DefaultArgumentExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/DefaultArgumentExpr.qll @@ -1,25 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -import codeql.swift.elements.decl.ParamDecl class DefaultArgumentExprBase extends @default_argument_expr, Expr { override string getAPrimaryQlClass() { result = "DefaultArgumentExpr" } - - ParamDecl getParamDecl() { - exists(ParamDecl x | - default_argument_exprs(this, x, _) and - result = x.resolve() - ) - } - - int getParamIndex() { default_argument_exprs(this, _, result) } - - Expr getCallerSideDefault() { - exists(Expr x | - default_argument_expr_caller_side_defaults(this, x) and - result = x.resolve() - ) - } - - predicate hasCallerSideDefault() { exists(getCallerSideDefault()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/DictionaryExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/DictionaryExpr.qll index 1daef547291..5b710d6394b 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/DictionaryExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/DictionaryExpr.qll @@ -1,18 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.CollectionExpr -import codeql.swift.elements.expr.Expr class DictionaryExprBase extends @dictionary_expr, CollectionExpr { override string getAPrimaryQlClass() { result = "DictionaryExpr" } - - Expr getElement(int index) { - exists(Expr x | - dictionary_expr_elements(this, index, x) and - result = x.resolve() - ) - } - - Expr getAnElement() { result = getElement(_) } - - int getNumberOfElements() { result = count(getAnElement()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/DotSyntaxBaseIgnoredExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/DotSyntaxBaseIgnoredExpr.qll index bf5f76b3229..bbad1c18ed3 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/DotSyntaxBaseIgnoredExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/DotSyntaxBaseIgnoredExpr.qll @@ -3,18 +3,4 @@ import codeql.swift.elements.expr.Expr class DotSyntaxBaseIgnoredExprBase extends @dot_syntax_base_ignored_expr, Expr { override string getAPrimaryQlClass() { result = "DotSyntaxBaseIgnoredExpr" } - - Expr getQualifier() { - exists(Expr x | - dot_syntax_base_ignored_exprs(this, x, _) and - result = x.resolve() - ) - } - - Expr getSubExpr() { - exists(Expr x | - dot_syntax_base_ignored_exprs(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll index c43659d6dd1..3d94cf4b126 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class DynamicTypeExprBase extends @dynamic_type_expr, Expr { override string getAPrimaryQlClass() { result = "DynamicTypeExpr" } - - Expr getBaseExpr() { - exists(Expr x | - dynamic_type_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/EnumIsCaseExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/EnumIsCaseExpr.qll index e02b97813a4..3ba701cdf0d 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/EnumIsCaseExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/EnumIsCaseExpr.qll @@ -1,29 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.EnumElementDecl import codeql.swift.elements.expr.Expr -import codeql.swift.elements.typerepr.TypeRepr class EnumIsCaseExprBase extends @enum_is_case_expr, Expr { override string getAPrimaryQlClass() { result = "EnumIsCaseExpr" } - - Expr getSubExpr() { - exists(Expr x | - enum_is_case_exprs(this, x, _, _) and - result = x.resolve() - ) - } - - TypeRepr getTypeRepr() { - exists(TypeRepr x | - enum_is_case_exprs(this, _, x, _) and - result = x.resolve() - ) - } - - EnumElementDecl getElement() { - exists(EnumElementDecl x | - enum_is_case_exprs(this, _, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/ExplicitCastExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/ExplicitCastExpr.qll index 305be5338a0..a2fe6a003fa 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/ExplicitCastExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/ExplicitCastExpr.qll @@ -1,11 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -class ExplicitCastExprBase extends @explicit_cast_expr, Expr { - Expr getSubExpr() { - exists(Expr x | - explicit_cast_exprs(this, x) and - result = x.resolve() - ) - } -} +class ExplicitCastExprBase extends @explicit_cast_expr, Expr { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/Expr.qll b/swift/ql/lib/codeql/swift/generated/expr/Expr.qll index 281d30988a9..a10a0891457 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/Expr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/Expr.qll @@ -1,14 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.AstNode -import codeql.swift.elements.type.Type -class ExprBase extends @expr, AstNode { - Type getType() { - exists(Type x | - expr_types(this, x) and - result = x.resolve() - ) - } - - predicate hasType() { exists(getType()) } -} +class ExprBase extends @expr, AstNode { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/FloatLiteralExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/FloatLiteralExpr.qll index 984819e59aa..f708ac4f677 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/FloatLiteralExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/FloatLiteralExpr.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.expr.NumberLiteralExpr class FloatLiteralExprBase extends @float_literal_expr, NumberLiteralExpr { override string getAPrimaryQlClass() { result = "FloatLiteralExpr" } - - string getStringValue() { float_literal_exprs(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/ForceValueExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/ForceValueExpr.qll index 224dc78316e..d264252af80 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/ForceValueExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/ForceValueExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class ForceValueExprBase extends @force_value_expr, Expr { override string getAPrimaryQlClass() { result = "ForceValueExpr" } - - Expr getSubExpr() { - exists(Expr x | - force_value_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/IdentityExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/IdentityExpr.qll index 4047ebfde78..f40a7878f55 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/IdentityExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/IdentityExpr.qll @@ -1,11 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -class IdentityExprBase extends @identity_expr, Expr { - Expr getSubExpr() { - exists(Expr x | - identity_exprs(this, x) and - result = x.resolve() - ) - } -} +class IdentityExprBase extends @identity_expr, Expr { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/IfExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/IfExpr.qll index b1ec1a192f7..8a6345d8a42 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/IfExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/IfExpr.qll @@ -3,25 +3,4 @@ import codeql.swift.elements.expr.Expr class IfExprBase extends @if_expr, Expr { override string getAPrimaryQlClass() { result = "IfExpr" } - - Expr getCondition() { - exists(Expr x | - if_exprs(this, x, _, _) and - result = x.resolve() - ) - } - - Expr getThenExpr() { - exists(Expr x | - if_exprs(this, _, x, _) and - result = x.resolve() - ) - } - - Expr getElseExpr() { - exists(Expr x | - if_exprs(this, _, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/ImplicitConversionExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/ImplicitConversionExpr.qll index 75d4a9337fa..ed47bbff2bd 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/ImplicitConversionExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/ImplicitConversionExpr.qll @@ -1,11 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -class ImplicitConversionExprBase extends @implicit_conversion_expr, Expr { - Expr getSubExpr() { - exists(Expr x | - implicit_conversion_exprs(this, x) and - result = x.resolve() - ) - } -} +class ImplicitConversionExprBase extends @implicit_conversion_expr, Expr { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/InOutExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/InOutExpr.qll index 43da09784ae..13aad81df69 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/InOutExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/InOutExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class InOutExprBase extends @in_out_expr, Expr { override string getAPrimaryQlClass() { result = "InOutExpr" } - - Expr getSubExpr() { - exists(Expr x | - in_out_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/IntegerLiteralExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/IntegerLiteralExpr.qll index dcd8f4b97a5..7a283f6559e 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/IntegerLiteralExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/IntegerLiteralExpr.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.expr.NumberLiteralExpr class IntegerLiteralExprBase extends @integer_literal_expr, NumberLiteralExpr { override string getAPrimaryQlClass() { result = "IntegerLiteralExpr" } - - string getStringValue() { integer_literal_exprs(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/InterpolatedStringLiteralExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/InterpolatedStringLiteralExpr.qll index 72f0fdac418..ccc3c9b2c99 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/InterpolatedStringLiteralExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/InterpolatedStringLiteralExpr.qll @@ -1,45 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Expr import codeql.swift.elements.expr.LiteralExpr -import codeql.swift.elements.expr.OpaqueValueExpr -import codeql.swift.elements.expr.TapExpr class InterpolatedStringLiteralExprBase extends @interpolated_string_literal_expr, LiteralExpr { override string getAPrimaryQlClass() { result = "InterpolatedStringLiteralExpr" } - - OpaqueValueExpr getInterpolationExpr() { - exists(OpaqueValueExpr x | - interpolated_string_literal_expr_interpolation_exprs(this, x) and - result = x.resolve() - ) - } - - predicate hasInterpolationExpr() { exists(getInterpolationExpr()) } - - Expr getInterpolationCountExpr() { - exists(Expr x | - interpolated_string_literal_expr_interpolation_count_exprs(this, x) and - result = x.resolve() - ) - } - - predicate hasInterpolationCountExpr() { exists(getInterpolationCountExpr()) } - - Expr getLiteralCapacityExpr() { - exists(Expr x | - interpolated_string_literal_expr_literal_capacity_exprs(this, x) and - result = x.resolve() - ) - } - - predicate hasLiteralCapacityExpr() { exists(getLiteralCapacityExpr()) } - - TapExpr getAppendingExpr() { - exists(TapExpr x | - interpolated_string_literal_expr_appending_exprs(this, x) and - result = x.resolve() - ) - } - - predicate hasAppendingExpr() { exists(getAppendingExpr()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/KeyPathExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/KeyPathExpr.qll index 7ac3d4614f0..a2039f22ca4 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/KeyPathExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/KeyPathExpr.qll @@ -3,22 +3,4 @@ import codeql.swift.elements.expr.Expr class KeyPathExprBase extends @key_path_expr, Expr { override string getAPrimaryQlClass() { result = "KeyPathExpr" } - - Expr getParsedRoot() { - exists(Expr x | - key_path_expr_parsed_roots(this, x) and - result = x.resolve() - ) - } - - predicate hasParsedRoot() { exists(getParsedRoot()) } - - Expr getParsedPath() { - exists(Expr x | - key_path_expr_parsed_paths(this, x) and - result = x.resolve() - ) - } - - predicate hasParsedPath() { exists(getParsedPath()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/LazyInitializerExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/LazyInitializerExpr.qll index b38aa2ebd5a..a710b80c39f 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/LazyInitializerExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/LazyInitializerExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class LazyInitializerExprBase extends @lazy_initializer_expr, Expr { override string getAPrimaryQlClass() { result = "LazyInitializerExpr" } - - Expr getSubExpr() { - exists(Expr x | - lazy_initializer_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/MagicIdentifierLiteralExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/MagicIdentifierLiteralExpr.qll index 075cb1f955a..2b2b3a8f410 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/MagicIdentifierLiteralExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/MagicIdentifierLiteralExpr.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.expr.BuiltinLiteralExpr class MagicIdentifierLiteralExprBase extends @magic_identifier_literal_expr, BuiltinLiteralExpr { override string getAPrimaryQlClass() { result = "MagicIdentifierLiteralExpr" } - - string getKind() { magic_identifier_literal_exprs(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/MakeTemporarilyEscapableExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/MakeTemporarilyEscapableExpr.qll index 5fe0c7c829d..4857df7bb6c 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/MakeTemporarilyEscapableExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/MakeTemporarilyEscapableExpr.qll @@ -1,28 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -import codeql.swift.elements.expr.OpaqueValueExpr class MakeTemporarilyEscapableExprBase extends @make_temporarily_escapable_expr, Expr { override string getAPrimaryQlClass() { result = "MakeTemporarilyEscapableExpr" } - - OpaqueValueExpr getEscapingClosure() { - exists(OpaqueValueExpr x | - make_temporarily_escapable_exprs(this, x, _, _) and - result = x.resolve() - ) - } - - Expr getNonescapingClosure() { - exists(Expr x | - make_temporarily_escapable_exprs(this, _, x, _) and - result = x.resolve() - ) - } - - Expr getSubExpr() { - exists(Expr x | - make_temporarily_escapable_exprs(this, _, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/MemberRefExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/MemberRefExpr.qll index 94bf0d6acf0..d8cf51a434c 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/MemberRefExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/MemberRefExpr.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Expr import codeql.swift.elements.expr.LookupExpr class MemberRefExprBase extends @member_ref_expr, LookupExpr { override string getAPrimaryQlClass() { result = "MemberRefExpr" } - - Expr getBaseExpr() { - exists(Expr x | - member_ref_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/ObjCSelectorExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/ObjCSelectorExpr.qll index 9853878d1a2..6a0c5641120 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/ObjCSelectorExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/ObjCSelectorExpr.qll @@ -1,21 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.AbstractFunctionDecl import codeql.swift.elements.expr.Expr class ObjCSelectorExprBase extends @obj_c_selector_expr, Expr { override string getAPrimaryQlClass() { result = "ObjCSelectorExpr" } - - Expr getSubExpr() { - exists(Expr x | - obj_c_selector_exprs(this, x, _) and - result = x.resolve() - ) - } - - AbstractFunctionDecl getMethod() { - exists(AbstractFunctionDecl x | - obj_c_selector_exprs(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/OneWayExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/OneWayExpr.qll index 4bebba18f26..dbdac5825fd 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/OneWayExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/OneWayExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class OneWayExprBase extends @one_way_expr, Expr { override string getAPrimaryQlClass() { result = "OneWayExpr" } - - Expr getSubExpr() { - exists(Expr x | - one_way_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/OpenExistentialExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/OpenExistentialExpr.qll index 5ee0583013d..682931e47a4 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/OpenExistentialExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/OpenExistentialExpr.qll @@ -1,28 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -import codeql.swift.elements.expr.OpaqueValueExpr class OpenExistentialExprBase extends @open_existential_expr, Expr { override string getAPrimaryQlClass() { result = "OpenExistentialExpr" } - - Expr getSubExpr() { - exists(Expr x | - open_existential_exprs(this, x, _, _) and - result = x.resolve() - ) - } - - Expr getExistential() { - exists(Expr x | - open_existential_exprs(this, _, x, _) and - result = x.resolve() - ) - } - - OpaqueValueExpr getOpaqueExpr() { - exists(OpaqueValueExpr x | - open_existential_exprs(this, _, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/OptionalEvaluationExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/OptionalEvaluationExpr.qll index a4ae044d1a4..5f389c18073 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/OptionalEvaluationExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/OptionalEvaluationExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class OptionalEvaluationExprBase extends @optional_evaluation_expr, Expr { override string getAPrimaryQlClass() { result = "OptionalEvaluationExpr" } - - Expr getSubExpr() { - exists(Expr x | - optional_evaluation_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/RebindSelfInConstructorExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/RebindSelfInConstructorExpr.qll index 101a8c73b09..d249fb49ba7 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/RebindSelfInConstructorExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/RebindSelfInConstructorExpr.qll @@ -1,21 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -import codeql.swift.elements.decl.VarDecl class RebindSelfInConstructorExprBase extends @rebind_self_in_constructor_expr, Expr { override string getAPrimaryQlClass() { result = "RebindSelfInConstructorExpr" } - - Expr getSubExpr() { - exists(Expr x | - rebind_self_in_constructor_exprs(this, x, _) and - result = x.resolve() - ) - } - - VarDecl getSelf() { - exists(VarDecl x | - rebind_self_in_constructor_exprs(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll index daa78c89a7e..9c585c010a7 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/SelfApplyExpr.qll @@ -1,12 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.ApplyExpr -import codeql.swift.elements.expr.Expr -class SelfApplyExprBase extends @self_apply_expr, ApplyExpr { - Expr getBaseExpr() { - exists(Expr x | - self_apply_exprs(this, x) and - result = x.resolve() - ) - } -} +class SelfApplyExprBase extends @self_apply_expr, ApplyExpr { } diff --git a/swift/ql/lib/codeql/swift/generated/expr/StringLiteralExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/StringLiteralExpr.qll index bb8e4174ad7..581c6528a7d 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/StringLiteralExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/StringLiteralExpr.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.expr.BuiltinLiteralExpr class StringLiteralExprBase extends @string_literal_expr, BuiltinLiteralExpr { override string getAPrimaryQlClass() { result = "StringLiteralExpr" } - - string getValue() { string_literal_exprs(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/SubscriptExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/SubscriptExpr.qll index cddbe8e8a2b..78a16e2f092 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/SubscriptExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/SubscriptExpr.qll @@ -1,27 +1,7 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Argument -import codeql.swift.elements.expr.Expr import codeql.swift.elements.decl.GenericContext import codeql.swift.elements.expr.LookupExpr class SubscriptExprBase extends @subscript_expr, GenericContext, LookupExpr { override string getAPrimaryQlClass() { result = "SubscriptExpr" } - - Expr getBaseExpr() { - exists(Expr x | - subscript_exprs(this, x) and - result = x.resolve() - ) - } - - Argument getArgument(int index) { - exists(Argument x | - subscript_expr_arguments(this, index, x) and - result = x.resolve() - ) - } - - Argument getAnArgument() { result = getArgument(_) } - - int getNumberOfArguments() { result = count(getAnArgument()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/SuperRefExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/SuperRefExpr.qll index 3513af5c0d7..bcaa570776b 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/SuperRefExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/SuperRefExpr.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -import codeql.swift.elements.decl.VarDecl class SuperRefExprBase extends @super_ref_expr, Expr { override string getAPrimaryQlClass() { result = "SuperRefExpr" } - - VarDecl getSelf() { - exists(VarDecl x | - super_ref_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/TapExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/TapExpr.qll index a61533704e6..b3a5711acc6 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/TapExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/TapExpr.qll @@ -1,31 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.BraceStmt import codeql.swift.elements.expr.Expr -import codeql.swift.elements.decl.VarDecl class TapExprBase extends @tap_expr, Expr { override string getAPrimaryQlClass() { result = "TapExpr" } - - Expr getSubExpr() { - exists(Expr x | - tap_expr_sub_exprs(this, x) and - result = x.resolve() - ) - } - - predicate hasSubExpr() { exists(getSubExpr()) } - - VarDecl getVar() { - exists(VarDecl x | - tap_exprs(this, x, _) and - result = x.resolve() - ) - } - - BraceStmt getBody() { - exists(BraceStmt x | - tap_exprs(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/TupleElementExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/TupleElementExpr.qll index 4281d8d875c..87dc58f3ed2 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/TupleElementExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/TupleElementExpr.qll @@ -3,13 +3,4 @@ import codeql.swift.elements.expr.Expr class TupleElementExprBase extends @tuple_element_expr, Expr { override string getAPrimaryQlClass() { result = "TupleElementExpr" } - - Expr getSubExpr() { - exists(Expr x | - tuple_element_exprs(this, x, _) and - result = x.resolve() - ) - } - - int getIndex() { tuple_element_exprs(this, _, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/TupleExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/TupleExpr.qll index b985d64d111..9af148bd088 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/TupleExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/TupleExpr.qll @@ -3,15 +3,4 @@ import codeql.swift.elements.expr.Expr class TupleExprBase extends @tuple_expr, Expr { override string getAPrimaryQlClass() { result = "TupleExpr" } - - Expr getElement(int index) { - exists(Expr x | - tuple_expr_elements(this, index, x) and - result = x.resolve() - ) - } - - Expr getAnElement() { result = getElement(_) } - - int getNumberOfElements() { result = count(getAnElement()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/TypeExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/TypeExpr.qll index 8b9e238b3ca..6f5666249f2 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/TypeExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/TypeExpr.qll @@ -1,16 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.expr.Expr -import codeql.swift.elements.typerepr.TypeRepr class TypeExprBase extends @type_expr, Expr { override string getAPrimaryQlClass() { result = "TypeExpr" } - - TypeRepr getTypeRepr() { - exists(TypeRepr x | - type_expr_type_reprs(this, x) and - result = x.resolve() - ) - } - - predicate hasTypeRepr() { exists(getTypeRepr()) } } diff --git a/swift/ql/lib/codeql/swift/generated/expr/VarargExpansionExpr.qll b/swift/ql/lib/codeql/swift/generated/expr/VarargExpansionExpr.qll index b72261cf82f..783e8d148f8 100644 --- a/swift/ql/lib/codeql/swift/generated/expr/VarargExpansionExpr.qll +++ b/swift/ql/lib/codeql/swift/generated/expr/VarargExpansionExpr.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.expr.Expr class VarargExpansionExprBase extends @vararg_expansion_expr, Expr { override string getAPrimaryQlClass() { result = "VarargExpansionExpr" } - - Expr getSubExpr() { - exists(Expr x | - vararg_expansion_exprs(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/BindingPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/BindingPattern.qll index 0303ddab467..d9e90afd529 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/BindingPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/BindingPattern.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.pattern.Pattern class BindingPatternBase extends @binding_pattern, Pattern { override string getAPrimaryQlClass() { result = "BindingPattern" } - - Pattern getSubPattern() { - exists(Pattern x | - binding_patterns(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/BoolPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/BoolPattern.qll index 2890e662e28..2a46151c29a 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/BoolPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/BoolPattern.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.pattern.Pattern class BoolPatternBase extends @bool_pattern, Pattern { override string getAPrimaryQlClass() { result = "BoolPattern" } - - boolean getValue() { bool_patterns(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/EnumElementPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/EnumElementPattern.qll index e0df35b15a0..a2bfc250d97 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/EnumElementPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/EnumElementPattern.qll @@ -1,23 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.EnumElementDecl import codeql.swift.elements.pattern.Pattern class EnumElementPatternBase extends @enum_element_pattern, Pattern { override string getAPrimaryQlClass() { result = "EnumElementPattern" } - - EnumElementDecl getElement() { - exists(EnumElementDecl x | - enum_element_patterns(this, x) and - result = x.resolve() - ) - } - - Pattern getSubPattern() { - exists(Pattern x | - enum_element_pattern_sub_patterns(this, x) and - result = x.resolve() - ) - } - - predicate hasSubPattern() { exists(getSubPattern()) } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/ExprPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/ExprPattern.qll index 75fdb81cad9..56774bbccbe 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/ExprPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/ExprPattern.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Expr import codeql.swift.elements.pattern.Pattern class ExprPatternBase extends @expr_pattern, Pattern { override string getAPrimaryQlClass() { result = "ExprPattern" } - - Expr getSubExpr() { - exists(Expr x | - expr_patterns(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/IsPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/IsPattern.qll index 8caf5493b36..5e4f5913c85 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/IsPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/IsPattern.qll @@ -1,25 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.pattern.Pattern -import codeql.swift.elements.typerepr.TypeRepr class IsPatternBase extends @is_pattern, Pattern { override string getAPrimaryQlClass() { result = "IsPattern" } - - TypeRepr getCastTypeRepr() { - exists(TypeRepr x | - is_pattern_cast_type_reprs(this, x) and - result = x.resolve() - ) - } - - predicate hasCastTypeRepr() { exists(getCastTypeRepr()) } - - Pattern getSubPattern() { - exists(Pattern x | - is_pattern_sub_patterns(this, x) and - result = x.resolve() - ) - } - - predicate hasSubPattern() { exists(getSubPattern()) } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll index a3d382fda9e..891dd7433ca 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/NamedPattern.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.pattern.Pattern class NamedPatternBase extends @named_pattern, Pattern { override string getAPrimaryQlClass() { result = "NamedPattern" } - - string getName() { named_patterns(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/OptionalSomePattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/OptionalSomePattern.qll index 3517777b9ce..ce494a0062e 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/OptionalSomePattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/OptionalSomePattern.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.pattern.Pattern class OptionalSomePatternBase extends @optional_some_pattern, Pattern { override string getAPrimaryQlClass() { result = "OptionalSomePattern" } - - Pattern getSubPattern() { - exists(Pattern x | - optional_some_patterns(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/ParenPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/ParenPattern.qll index 63d5e2909ec..d26719772b4 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/ParenPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/ParenPattern.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.pattern.Pattern class ParenPatternBase extends @paren_pattern, Pattern { override string getAPrimaryQlClass() { result = "ParenPattern" } - - Pattern getSubPattern() { - exists(Pattern x | - paren_patterns(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/TuplePattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/TuplePattern.qll index b9eb01c83c9..b11c6c38719 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/TuplePattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/TuplePattern.qll @@ -3,15 +3,4 @@ import codeql.swift.elements.pattern.Pattern class TuplePatternBase extends @tuple_pattern, Pattern { override string getAPrimaryQlClass() { result = "TuplePattern" } - - Pattern getElement(int index) { - exists(Pattern x | - tuple_pattern_elements(this, index, x) and - result = x.resolve() - ) - } - - Pattern getAnElement() { result = getElement(_) } - - int getNumberOfElements() { result = count(getAnElement()) } } diff --git a/swift/ql/lib/codeql/swift/generated/pattern/TypedPattern.qll b/swift/ql/lib/codeql/swift/generated/pattern/TypedPattern.qll index 9a16c9cfe02..9d4ca12b962 100644 --- a/swift/ql/lib/codeql/swift/generated/pattern/TypedPattern.qll +++ b/swift/ql/lib/codeql/swift/generated/pattern/TypedPattern.qll @@ -1,23 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.pattern.Pattern -import codeql.swift.elements.typerepr.TypeRepr class TypedPatternBase extends @typed_pattern, Pattern { override string getAPrimaryQlClass() { result = "TypedPattern" } - - Pattern getSubPattern() { - exists(Pattern x | - typed_patterns(this, x) and - result = x.resolve() - ) - } - - TypeRepr getTypeRepr() { - exists(TypeRepr x | - typed_pattern_type_reprs(this, x) and - result = x.resolve() - ) - } - - predicate hasTypeRepr() { exists(getTypeRepr()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/BraceStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/BraceStmt.qll index 0cb37ff31bf..4e58935f384 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/BraceStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/BraceStmt.qll @@ -1,18 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.AstNode import codeql.swift.elements.stmt.Stmt class BraceStmtBase extends @brace_stmt, Stmt { override string getAPrimaryQlClass() { result = "BraceStmt" } - - AstNode getElement(int index) { - exists(AstNode x | - brace_stmt_elements(this, index, x) and - result = x.resolve() - ) - } - - AstNode getAnElement() { result = getElement(_) } - - int getNumberOfElements() { result = count(getAnElement()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/BreakStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/BreakStmt.qll index 05ba4de8fd3..1232a427db7 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/BreakStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/BreakStmt.qll @@ -3,17 +3,4 @@ import codeql.swift.elements.stmt.Stmt class BreakStmtBase extends @break_stmt, Stmt { override string getAPrimaryQlClass() { result = "BreakStmt" } - - string getTargetName() { break_stmt_target_names(this, result) } - - predicate hasTargetName() { exists(getTargetName()) } - - Stmt getTarget() { - exists(Stmt x | - break_stmt_targets(this, x) and - result = x.resolve() - ) - } - - predicate hasTarget() { exists(getTarget()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/CaseLabelItem.qll b/swift/ql/lib/codeql/swift/generated/stmt/CaseLabelItem.qll index f4f00f285b0..c43d7f07b53 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/CaseLabelItem.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/CaseLabelItem.qll @@ -1,24 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.AstNode -import codeql.swift.elements.expr.Expr -import codeql.swift.elements.pattern.Pattern class CaseLabelItemBase extends @case_label_item, AstNode { override string getAPrimaryQlClass() { result = "CaseLabelItem" } - - Pattern getPattern() { - exists(Pattern x | - case_label_items(this, x) and - result = x.resolve() - ) - } - - Expr getGuard() { - exists(Expr x | - case_label_item_guards(this, x) and - result = x.resolve() - ) - } - - predicate hasGuard() { exists(getGuard()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll index d7111914429..ad6675868f1 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/CaseStmt.qll @@ -1,37 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.CaseLabelItem import codeql.swift.elements.stmt.Stmt -import codeql.swift.elements.decl.VarDecl class CaseStmtBase extends @case_stmt, Stmt { override string getAPrimaryQlClass() { result = "CaseStmt" } - - Stmt getBody() { - exists(Stmt x | - case_stmts(this, x) and - result = x.resolve() - ) - } - - CaseLabelItem getLabel(int index) { - exists(CaseLabelItem x | - case_stmt_labels(this, index, x) and - result = x.resolve() - ) - } - - CaseLabelItem getALabel() { result = getLabel(_) } - - int getNumberOfLabels() { result = count(getALabel()) } - - VarDecl getVariable(int index) { - exists(VarDecl x | - case_stmt_variables(this, index, x) and - result = x.resolve() - ) - } - - VarDecl getAVariable() { result = getVariable(_) } - - int getNumberOfVariables() { result = count(getAVariable()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/ConditionElement.qll b/swift/ql/lib/codeql/swift/generated/stmt/ConditionElement.qll index eb68c35bdf0..4885fd21621 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/ConditionElement.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/ConditionElement.qll @@ -1,35 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Expr import codeql.swift.elements.Locatable -import codeql.swift.elements.pattern.Pattern class ConditionElementBase extends @condition_element, Locatable { override string getAPrimaryQlClass() { result = "ConditionElement" } - - Expr getBoolean() { - exists(Expr x | - condition_element_booleans(this, x) and - result = x.resolve() - ) - } - - predicate hasBoolean() { exists(getBoolean()) } - - Pattern getPattern() { - exists(Pattern x | - condition_element_patterns(this, x) and - result = x.resolve() - ) - } - - predicate hasPattern() { exists(getPattern()) } - - Expr getInitializer() { - exists(Expr x | - condition_element_initializers(this, x) and - result = x.resolve() - ) - } - - predicate hasInitializer() { exists(getInitializer()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/ContinueStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/ContinueStmt.qll index 10e6b2ac302..eb1eee3c014 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/ContinueStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/ContinueStmt.qll @@ -3,17 +3,4 @@ import codeql.swift.elements.stmt.Stmt class ContinueStmtBase extends @continue_stmt, Stmt { override string getAPrimaryQlClass() { result = "ContinueStmt" } - - string getTargetName() { continue_stmt_target_names(this, result) } - - predicate hasTargetName() { exists(getTargetName()) } - - Stmt getTarget() { - exists(Stmt x | - continue_stmt_targets(this, x) and - result = x.resolve() - ) - } - - predicate hasTarget() { exists(getTarget()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/DeferStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/DeferStmt.qll index 7edd92fe917..59ef024c465 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/DeferStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/DeferStmt.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.BraceStmt import codeql.swift.elements.stmt.Stmt class DeferStmtBase extends @defer_stmt, Stmt { override string getAPrimaryQlClass() { result = "DeferStmt" } - - BraceStmt getBody() { - exists(BraceStmt x | - defer_stmts(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/DoCatchStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/DoCatchStmt.qll index 7f98906d007..9254ca57143 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/DoCatchStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/DoCatchStmt.qll @@ -1,26 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.CaseStmt import codeql.swift.elements.stmt.LabeledStmt -import codeql.swift.elements.stmt.Stmt class DoCatchStmtBase extends @do_catch_stmt, LabeledStmt { override string getAPrimaryQlClass() { result = "DoCatchStmt" } - - Stmt getBody() { - exists(Stmt x | - do_catch_stmts(this, x) and - result = x.resolve() - ) - } - - CaseStmt getCatch(int index) { - exists(CaseStmt x | - do_catch_stmt_catches(this, index, x) and - result = x.resolve() - ) - } - - CaseStmt getACatch() { result = getCatch(_) } - - int getNumberOfCatches() { result = count(getACatch()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/DoStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/DoStmt.qll index f83646426e4..25afb39508f 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/DoStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/DoStmt.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.BraceStmt import codeql.swift.elements.stmt.LabeledStmt class DoStmtBase extends @do_stmt, LabeledStmt { override string getAPrimaryQlClass() { result = "DoStmt" } - - BraceStmt getBody() { - exists(BraceStmt x | - do_stmts(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/FallthroughStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/FallthroughStmt.qll index 5faaac0ad9b..42e425a942a 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/FallthroughStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/FallthroughStmt.qll @@ -1,21 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.CaseStmt import codeql.swift.elements.stmt.Stmt class FallthroughStmtBase extends @fallthrough_stmt, Stmt { override string getAPrimaryQlClass() { result = "FallthroughStmt" } - - CaseStmt getFallthroughSource() { - exists(CaseStmt x | - fallthrough_stmts(this, x, _) and - result = x.resolve() - ) - } - - CaseStmt getFallthroughDest() { - exists(CaseStmt x | - fallthrough_stmts(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/ForEachStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/ForEachStmt.qll index f75e0a6f08b..d823712927c 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/ForEachStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/ForEachStmt.qll @@ -1,31 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.BraceStmt -import codeql.swift.elements.expr.Expr import codeql.swift.elements.stmt.LabeledStmt class ForEachStmtBase extends @for_each_stmt, LabeledStmt { override string getAPrimaryQlClass() { result = "ForEachStmt" } - - BraceStmt getBody() { - exists(BraceStmt x | - for_each_stmts(this, x, _) and - result = x.resolve() - ) - } - - Expr getSequence() { - exists(Expr x | - for_each_stmts(this, _, x) and - result = x.resolve() - ) - } - - Expr getWhere() { - exists(Expr x | - for_each_stmt_wheres(this, x) and - result = x.resolve() - ) - } - - predicate hasWhere() { exists(getWhere()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/GuardStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/GuardStmt.qll index 7ce5fae33a2..87db50f11e1 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/GuardStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/GuardStmt.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.BraceStmt import codeql.swift.elements.stmt.LabeledConditionalStmt class GuardStmtBase extends @guard_stmt, LabeledConditionalStmt { override string getAPrimaryQlClass() { result = "GuardStmt" } - - BraceStmt getBody() { - exists(BraceStmt x | - guard_stmts(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/IfStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/IfStmt.qll index 4311173fe51..a9b6c08a2fd 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/IfStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/IfStmt.qll @@ -1,23 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.stmt.LabeledConditionalStmt -import codeql.swift.elements.stmt.Stmt class IfStmtBase extends @if_stmt, LabeledConditionalStmt { override string getAPrimaryQlClass() { result = "IfStmt" } - - Stmt getThen() { - exists(Stmt x | - if_stmts(this, x) and - result = x.resolve() - ) - } - - Stmt getElse() { - exists(Stmt x | - if_stmt_elses(this, x) and - result = x.resolve() - ) - } - - predicate hasElse() { exists(getElse()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/LabeledConditionalStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/LabeledConditionalStmt.qll index c6d7acded63..9364aee3bdc 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/LabeledConditionalStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/LabeledConditionalStmt.qll @@ -1,12 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.stmt.LabeledStmt -import codeql.swift.elements.stmt.StmtCondition -class LabeledConditionalStmtBase extends @labeled_conditional_stmt, LabeledStmt { - StmtCondition getCondition() { - exists(StmtCondition x | - labeled_conditional_stmts(this, x) and - result = x.resolve() - ) - } -} +class LabeledConditionalStmtBase extends @labeled_conditional_stmt, LabeledStmt { } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/LabeledStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/LabeledStmt.qll index 98374c9a5d2..dcb90f0aa2d 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/LabeledStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/LabeledStmt.qll @@ -1,8 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.stmt.Stmt -class LabeledStmtBase extends @labeled_stmt, Stmt { - string getLabel() { labeled_stmt_labels(this, result) } - - predicate hasLabel() { exists(getLabel()) } -} +class LabeledStmtBase extends @labeled_stmt, Stmt { } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/RepeatWhileStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/RepeatWhileStmt.qll index 6d03dcc07a9..9bcf47a5077 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/RepeatWhileStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/RepeatWhileStmt.qll @@ -1,22 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Expr import codeql.swift.elements.stmt.LabeledStmt -import codeql.swift.elements.stmt.Stmt class RepeatWhileStmtBase extends @repeat_while_stmt, LabeledStmt { override string getAPrimaryQlClass() { result = "RepeatWhileStmt" } - - Expr getCondition() { - exists(Expr x | - repeat_while_stmts(this, x, _) and - result = x.resolve() - ) - } - - Stmt getBody() { - exists(Stmt x | - repeat_while_stmts(this, _, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/ReturnStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/ReturnStmt.qll index dcdaaae19b6..947c2116944 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/ReturnStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/ReturnStmt.qll @@ -1,16 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Expr import codeql.swift.elements.stmt.Stmt class ReturnStmtBase extends @return_stmt, Stmt { override string getAPrimaryQlClass() { result = "ReturnStmt" } - - Expr getResult() { - exists(Expr x | - return_stmt_results(this, x) and - result = x.resolve() - ) - } - - predicate hasResult() { exists(getResult()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/StmtCondition.qll b/swift/ql/lib/codeql/swift/generated/stmt/StmtCondition.qll index 94aa0b746d2..e8e8fc48110 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/StmtCondition.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/StmtCondition.qll @@ -1,18 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.AstNode -import codeql.swift.elements.stmt.ConditionElement class StmtConditionBase extends @stmt_condition, AstNode { override string getAPrimaryQlClass() { result = "StmtCondition" } - - ConditionElement getElement(int index) { - exists(ConditionElement x | - stmt_condition_elements(this, index, x) and - result = x.resolve() - ) - } - - ConditionElement getAnElement() { result = getElement(_) } - - int getNumberOfElements() { result = count(getAnElement()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/SwitchStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/SwitchStmt.qll index 79bd3116cfe..330a48bae75 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/SwitchStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/SwitchStmt.qll @@ -1,26 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.stmt.CaseStmt -import codeql.swift.elements.expr.Expr import codeql.swift.elements.stmt.LabeledStmt class SwitchStmtBase extends @switch_stmt, LabeledStmt { override string getAPrimaryQlClass() { result = "SwitchStmt" } - - Expr getExpr() { - exists(Expr x | - switch_stmts(this, x) and - result = x.resolve() - ) - } - - CaseStmt getCase(int index) { - exists(CaseStmt x | - switch_stmt_cases(this, index, x) and - result = x.resolve() - ) - } - - CaseStmt getACase() { result = getCase(_) } - - int getNumberOfCases() { result = count(getACase()) } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/ThrowStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/ThrowStmt.qll index 7ede67545bb..033b1e6e95d 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/ThrowStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/ThrowStmt.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.expr.Expr import codeql.swift.elements.stmt.Stmt class ThrowStmtBase extends @throw_stmt, Stmt { override string getAPrimaryQlClass() { result = "ThrowStmt" } - - Expr getSubExpr() { - exists(Expr x | - throw_stmts(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/stmt/WhileStmt.qll b/swift/ql/lib/codeql/swift/generated/stmt/WhileStmt.qll index 959a129834b..e50d57d0c9c 100644 --- a/swift/ql/lib/codeql/swift/generated/stmt/WhileStmt.qll +++ b/swift/ql/lib/codeql/swift/generated/stmt/WhileStmt.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.stmt.LabeledConditionalStmt -import codeql.swift.elements.stmt.Stmt class WhileStmtBase extends @while_stmt, LabeledConditionalStmt { override string getAPrimaryQlClass() { result = "WhileStmt" } - - Stmt getBody() { - exists(Stmt x | - while_stmts(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/type/AnyFunctionType.qll b/swift/ql/lib/codeql/swift/generated/type/AnyFunctionType.qll index 6add8032bc1..48f931376ae 100644 --- a/swift/ql/lib/codeql/swift/generated/type/AnyFunctionType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/AnyFunctionType.qll @@ -1,30 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.type.Type -class AnyFunctionTypeBase extends @any_function_type, Type { - Type getResult() { - exists(Type x | - any_function_types(this, x) and - result = x.resolve() - ) - } - - Type getParamType(int index) { - exists(Type x | - any_function_type_param_types(this, index, x) and - result = x.resolve() - ) - } - - Type getAParamType() { result = getParamType(_) } - - int getNumberOfParamTypes() { result = count(getAParamType()) } - - string getParamLabel(int index) { any_function_type_param_labels(this, index, result) } - - string getAParamLabel() { result = getParamLabel(_) } - - int getNumberOfParamLabels() { result = count(getAParamLabel()) } - - predicate isThrowing() { any_function_type_is_throwing(this) } -} +class AnyFunctionTypeBase extends @any_function_type, Type { } diff --git a/swift/ql/lib/codeql/swift/generated/type/AnyGenericType.qll b/swift/ql/lib/codeql/swift/generated/type/AnyGenericType.qll index 41659bd5f08..7397c93344b 100644 --- a/swift/ql/lib/codeql/swift/generated/type/AnyGenericType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/AnyGenericType.qll @@ -1,21 +1,4 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.Decl import codeql.swift.elements.type.Type -class AnyGenericTypeBase extends @any_generic_type, Type { - Type getParent() { - exists(Type x | - any_generic_type_parents(this, x) and - result = x.resolve() - ) - } - - predicate hasParent() { exists(getParent()) } - - Decl getDeclaration() { - exists(Decl x | - any_generic_types(this, x) and - result = x.resolve() - ) - } -} +class AnyGenericTypeBase extends @any_generic_type, Type { } diff --git a/swift/ql/lib/codeql/swift/generated/type/ClassType.qll b/swift/ql/lib/codeql/swift/generated/type/ClassType.qll index 377bf3dc4d3..c19d65608f2 100644 --- a/swift/ql/lib/codeql/swift/generated/type/ClassType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/ClassType.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py -import codeql.swift.elements.decl.ClassDecl import codeql.swift.elements.type.NominalType class ClassTypeBase extends @class_type, NominalType { override string getAPrimaryQlClass() { result = "ClassType" } - - ClassDecl getDecl() { - exists(ClassDecl x | - class_types(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/type/GenericFunctionType.qll b/swift/ql/lib/codeql/swift/generated/type/GenericFunctionType.qll index 7b34e262d03..be830c63fcd 100644 --- a/swift/ql/lib/codeql/swift/generated/type/GenericFunctionType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/GenericFunctionType.qll @@ -1,18 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.type.AnyFunctionType -import codeql.swift.elements.type.GenericTypeParamType class GenericFunctionTypeBase extends @generic_function_type, AnyFunctionType { override string getAPrimaryQlClass() { result = "GenericFunctionType" } - - GenericTypeParamType getGenericParam(int index) { - exists(GenericTypeParamType x | - generic_function_type_generic_params(this, index, x) and - result = x.resolve() - ) - } - - GenericTypeParamType getAGenericParam() { result = getGenericParam(_) } - - int getNumberOfGenericParams() { result = count(getAGenericParam()) } } diff --git a/swift/ql/lib/codeql/swift/generated/type/GenericTypeParamType.qll b/swift/ql/lib/codeql/swift/generated/type/GenericTypeParamType.qll index c0b13904806..9f286d86cc7 100644 --- a/swift/ql/lib/codeql/swift/generated/type/GenericTypeParamType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/GenericTypeParamType.qll @@ -3,6 +3,4 @@ import codeql.swift.elements.type.SubstitutableType class GenericTypeParamTypeBase extends @generic_type_param_type, SubstitutableType { override string getAPrimaryQlClass() { result = "GenericTypeParamType" } - - string getName() { generic_type_param_types(this, result) } } diff --git a/swift/ql/lib/codeql/swift/generated/type/LValueType.qll b/swift/ql/lib/codeql/swift/generated/type/LValueType.qll index df0f433ac84..0c47663dcef 100644 --- a/swift/ql/lib/codeql/swift/generated/type/LValueType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/LValueType.qll @@ -3,11 +3,4 @@ import codeql.swift.elements.type.Type class LValueTypeBase extends @l_value_type, Type { override string getAPrimaryQlClass() { result = "LValueType" } - - Type getObjectType() { - exists(Type x | - l_value_types(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/type/PrimaryArchetypeType.qll b/swift/ql/lib/codeql/swift/generated/type/PrimaryArchetypeType.qll index 6f062e05799..f5fadcb9056 100644 --- a/swift/ql/lib/codeql/swift/generated/type/PrimaryArchetypeType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/PrimaryArchetypeType.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.type.ArchetypeType -import codeql.swift.elements.type.GenericTypeParamType class PrimaryArchetypeTypeBase extends @primary_archetype_type, ArchetypeType { override string getAPrimaryQlClass() { result = "PrimaryArchetypeType" } - - GenericTypeParamType getInterfaceType() { - exists(GenericTypeParamType x | - primary_archetype_types(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/type/StructType.qll b/swift/ql/lib/codeql/swift/generated/type/StructType.qll index fedb9024bfb..89b30746490 100644 --- a/swift/ql/lib/codeql/swift/generated/type/StructType.qll +++ b/swift/ql/lib/codeql/swift/generated/type/StructType.qll @@ -1,14 +1,6 @@ // generated by codegen/codegen.py import codeql.swift.elements.type.NominalType -import codeql.swift.elements.decl.StructDecl class StructTypeBase extends @struct_type, NominalType { override string getAPrimaryQlClass() { result = "StructType" } - - StructDecl getDecl() { - exists(StructDecl x | - struct_types(this, x) and - result = x.resolve() - ) - } } diff --git a/swift/ql/lib/codeql/swift/generated/type/Type.qll b/swift/ql/lib/codeql/swift/generated/type/Type.qll index cfe4b638da3..6c40b0e9c7c 100644 --- a/swift/ql/lib/codeql/swift/generated/type/Type.qll +++ b/swift/ql/lib/codeql/swift/generated/type/Type.qll @@ -1,14 +1,4 @@ // generated by codegen/codegen.py import codeql.swift.elements.Element -import codeql.swift.elements.type.Type -class TypeBase extends @type, Element { - string getDiagnosticsName() { types(this, result, _) } - - Type getCanonicalType() { - exists(Type x | - types(this, _, x) and - result = x.resolve() - ) - } -} +class TypeBase extends @type, Element { } diff --git a/swift/ql/lib/codeql/swift/generated/type/UnknownType.qll b/swift/ql/lib/codeql/swift/generated/type/UnknownType.qll deleted file mode 100644 index 220f9e44370..00000000000 --- a/swift/ql/lib/codeql/swift/generated/type/UnknownType.qll +++ /dev/null @@ -1,8 +0,0 @@ -// generated by codegen/codegen.py -import codeql.swift.elements.type.Type - -class UnknownTypeBase extends @unknown_type, Type { - override string getAPrimaryQlClass() { result = "UnknownType" } - - string getName() { unknown_types(this, result) } -} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/ArrayTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/ArrayTypeRepr.qll new file mode 100644 index 00000000000..486a98a541e --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/ArrayTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class ArrayTypeReprBase extends @array_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "ArrayTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/AttributedTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/AttributedTypeRepr.qll new file mode 100644 index 00000000000..96d78c7c933 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/AttributedTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class AttributedTypeReprBase extends @attributed_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "AttributedTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/CompileTimeConstTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/CompileTimeConstTypeRepr.qll new file mode 100644 index 00000000000..eecb67b9218 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/CompileTimeConstTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.SpecifierTypeRepr + +class CompileTimeConstTypeReprBase extends @compile_time_const_type_repr, SpecifierTypeRepr { + override string getAPrimaryQlClass() { result = "CompileTimeConstTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/ComponentIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/ComponentIdentTypeRepr.qll new file mode 100644 index 00000000000..d0323ad681d --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/ComponentIdentTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.IdentTypeRepr + +class ComponentIdentTypeReprBase extends @component_ident_type_repr, IdentTypeRepr { } diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/CompositionTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/CompositionTypeRepr.qll new file mode 100644 index 00000000000..b0789100618 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/CompositionTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class CompositionTypeReprBase extends @composition_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "CompositionTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/CompoundIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/CompoundIdentTypeRepr.qll new file mode 100644 index 00000000000..7c1c3548272 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/CompoundIdentTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.IdentTypeRepr + +class CompoundIdentTypeReprBase extends @compound_ident_type_repr, IdentTypeRepr { + override string getAPrimaryQlClass() { result = "CompoundIdentTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/DictionaryTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/DictionaryTypeRepr.qll new file mode 100644 index 00000000000..692b9352e20 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/DictionaryTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class DictionaryTypeReprBase extends @dictionary_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "DictionaryTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/ErrorTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/ErrorTypeRepr.qll new file mode 100644 index 00000000000..511f7e25569 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/ErrorTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class ErrorTypeReprBase extends @error_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "ErrorTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/ExistentialTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/ExistentialTypeRepr.qll new file mode 100644 index 00000000000..43aefeed5a9 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/ExistentialTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class ExistentialTypeReprBase extends @existential_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "ExistentialTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/FixedTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/FixedTypeRepr.qll new file mode 100644 index 00000000000..2a6e59a90a8 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/FixedTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class FixedTypeReprBase extends @fixed_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "FixedTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/FunctionTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/FunctionTypeRepr.qll new file mode 100644 index 00000000000..da781a90d4b --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/FunctionTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class FunctionTypeReprBase extends @function_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "FunctionTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/GenericIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/GenericIdentTypeRepr.qll new file mode 100644 index 00000000000..101985aca56 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/GenericIdentTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.ComponentIdentTypeRepr + +class GenericIdentTypeReprBase extends @generic_ident_type_repr, ComponentIdentTypeRepr { + override string getAPrimaryQlClass() { result = "GenericIdentTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/IdentTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/IdentTypeRepr.qll new file mode 100644 index 00000000000..d71eca38b92 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/IdentTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class IdentTypeReprBase extends @ident_type_repr, TypeRepr { } diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/ImplicitlyUnwrappedOptionalTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/ImplicitlyUnwrappedOptionalTypeRepr.qll new file mode 100644 index 00000000000..e0759e0fa3c --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/ImplicitlyUnwrappedOptionalTypeRepr.qll @@ -0,0 +1,7 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class ImplicitlyUnwrappedOptionalTypeReprBase extends @implicitly_unwrapped_optional_type_repr, + TypeRepr { + override string getAPrimaryQlClass() { result = "ImplicitlyUnwrappedOptionalTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/InOutTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/InOutTypeRepr.qll new file mode 100644 index 00000000000..a7adf859579 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/InOutTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.SpecifierTypeRepr + +class InOutTypeReprBase extends @in_out_type_repr, SpecifierTypeRepr { + override string getAPrimaryQlClass() { result = "InOutTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/IsolatedTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/IsolatedTypeRepr.qll new file mode 100644 index 00000000000..63dcdd9e379 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/IsolatedTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.SpecifierTypeRepr + +class IsolatedTypeReprBase extends @isolated_type_repr, SpecifierTypeRepr { + override string getAPrimaryQlClass() { result = "IsolatedTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/MetatypeTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/MetatypeTypeRepr.qll new file mode 100644 index 00000000000..e0477db158b --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/MetatypeTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class MetatypeTypeReprBase extends @metatype_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "MetatypeTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/NamedOpaqueReturnTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/NamedOpaqueReturnTypeRepr.qll new file mode 100644 index 00000000000..af885d21ab4 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/NamedOpaqueReturnTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class NamedOpaqueReturnTypeReprBase extends @named_opaque_return_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "NamedOpaqueReturnTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/OpaqueReturnTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/OpaqueReturnTypeRepr.qll new file mode 100644 index 00000000000..7ecb38e22c6 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/OpaqueReturnTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class OpaqueReturnTypeReprBase extends @opaque_return_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "OpaqueReturnTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/OptionalTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/OptionalTypeRepr.qll new file mode 100644 index 00000000000..62a24285ef5 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/OptionalTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class OptionalTypeReprBase extends @optional_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "OptionalTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/OwnedTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/OwnedTypeRepr.qll new file mode 100644 index 00000000000..b24ca1aa597 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/OwnedTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.SpecifierTypeRepr + +class OwnedTypeReprBase extends @owned_type_repr, SpecifierTypeRepr { + override string getAPrimaryQlClass() { result = "OwnedTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/PlaceholderTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/PlaceholderTypeRepr.qll new file mode 100644 index 00000000000..5bb446c9c73 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/PlaceholderTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class PlaceholderTypeReprBase extends @placeholder_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "PlaceholderTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/ProtocolTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/ProtocolTypeRepr.qll new file mode 100644 index 00000000000..1b2e7fb2652 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/ProtocolTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class ProtocolTypeReprBase extends @protocol_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "ProtocolTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/SharedTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/SharedTypeRepr.qll new file mode 100644 index 00000000000..ca9254217c9 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/SharedTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.SpecifierTypeRepr + +class SharedTypeReprBase extends @shared_type_repr, SpecifierTypeRepr { + override string getAPrimaryQlClass() { result = "SharedTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/SilBoxTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/SilBoxTypeRepr.qll new file mode 100644 index 00000000000..47d4585511b --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/SilBoxTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class SilBoxTypeReprBase extends @sil_box_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "SilBoxTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/SimpleIdentTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/SimpleIdentTypeRepr.qll new file mode 100644 index 00000000000..328b8bc7e69 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/SimpleIdentTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.ComponentIdentTypeRepr + +class SimpleIdentTypeReprBase extends @simple_ident_type_repr, ComponentIdentTypeRepr { + override string getAPrimaryQlClass() { result = "SimpleIdentTypeRepr" } +} diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/SpecifierTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/SpecifierTypeRepr.qll new file mode 100644 index 00000000000..469aa3413d1 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/SpecifierTypeRepr.qll @@ -0,0 +1,4 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class SpecifierTypeReprBase extends @specifier_type_repr, TypeRepr { } diff --git a/swift/ql/lib/codeql/swift/generated/typerepr/TupleTypeRepr.qll b/swift/ql/lib/codeql/swift/generated/typerepr/TupleTypeRepr.qll new file mode 100644 index 00000000000..79e65037aa9 --- /dev/null +++ b/swift/ql/lib/codeql/swift/generated/typerepr/TupleTypeRepr.qll @@ -0,0 +1,6 @@ +// generated by codegen/codegen.py +import codeql.swift.elements.typerepr.TypeRepr + +class TupleTypeReprBase extends @tuple_type_repr, TypeRepr { + override string getAPrimaryQlClass() { result = "TupleTypeRepr" } +} diff --git a/swift/ql/lib/swift.dbscheme b/swift/ql/lib/swift.dbscheme index 8d3ab41cf22..0b2b6d42827 100644 --- a/swift/ql/lib/swift.dbscheme +++ b/swift/ql/lib/swift.dbscheme @@ -22,23 +22,16 @@ sourceLocationPrefix( | @type ; +#keyset[id] +element_is_unknown( + int id: @element ref +); + files( unique int id: @file, string name: string ref ); -@iterable_decl_context = - @extension_decl -| @nominal_type_decl -; - -#keyset[id, index] -iterable_decl_context_members( - int id: @iterable_decl_context ref, - int index: int ref, - int member: @decl ref -); - @locatable = @ast_node | @condition_element @@ -82,16 +75,13 @@ locations( | @sugar_type | @tuple_type | @type_variable_type -| @unknown_type | @unresolved_type ; -#keyset[id] -types( - int id: @type ref, - string diagnostics_name: string ref, - int canonical_type: @type ref -); +@iterable_decl_context = + @extension_decl +| @nominal_type_decl +; extension_decls( unique int id: @extension_decl @@ -104,12 +94,6 @@ extension_decls( | @struct_decl ; -#keyset[id] -nominal_type_decls( - int id: @nominal_type_decl ref, - int type_: @type ref -); - @ast_node = @case_label_item | @decl @@ -124,71 +108,16 @@ condition_elements( unique int id: @condition_element ); -#keyset[id] -condition_element_booleans( - int id: @condition_element ref, - int boolean_: @expr ref -); - -#keyset[id] -condition_element_patterns( - int id: @condition_element ref, - int pattern: @pattern ref -); - -#keyset[id] -condition_element_initializers( - int id: @condition_element ref, - int initializer: @expr ref -); - @any_function_type = @function_type | @generic_function_type ; -#keyset[id] -any_function_types( - int id: @any_function_type ref, - int result: @type ref -); - -#keyset[id, index] -any_function_type_param_types( - int id: @any_function_type ref, - int index: int ref, - int param_type: @type ref -); - -#keyset[id, index] -any_function_type_param_labels( - int id: @any_function_type ref, - int index: int ref, - string param_label: string ref -); - -#keyset[id] -any_function_type_is_throwing( - int id: @any_function_type ref -); - @any_generic_type = @nominal_or_bound_generic_nominal_type | @unbound_generic_type ; -#keyset[id] -any_generic_types( - int id: @any_generic_type ref, - int declaration: @decl ref -); - -#keyset[id] -any_generic_type_parents( - int id: @any_generic_type ref, - int parent: @type ref -); - @any_metatype_type = @existential_metatype_type | @metatype_type @@ -225,8 +154,7 @@ in_out_types( ); l_value_types( - unique int id: @l_value_type, - int object_type: @type ref + unique int id: @l_value_type ); module_types( @@ -286,11 +214,6 @@ type_variable_types( unique int id: @type_variable_type ); -unknown_types( - unique int id: @unknown_type, - string name: string ref -); - unresolved_types( unique int id: @unresolved_type ); @@ -322,7 +245,6 @@ struct_decls( | @pound_diagnostic_decl | @precedence_group_decl | @top_level_code_decl -| @unknown_ast_node | @value_decl ; @@ -373,7 +295,6 @@ struct_decls( | @tuple_element_expr | @tuple_expr | @type_expr -| @unknown_ast_node | @unresolved_decl_ref_expr | @unresolved_dot_expr | @unresolved_member_expr @@ -382,12 +303,6 @@ struct_decls( | @vararg_expansion_expr ; -#keyset[id] -expr_types( - int id: @expr ref, - int type_: @type ref -); - @pattern = @any_pattern | @binding_pattern @@ -400,7 +315,6 @@ expr_types( | @paren_pattern | @tuple_pattern | @typed_pattern -| @unknown_ast_node ; @stmt = @@ -415,12 +329,29 @@ expr_types( | @pound_assert_stmt | @return_stmt | @throw_stmt -| @unknown_ast_node | @yield_stmt ; @type_repr = - @unknown_ast_node + @array_type_repr +| @attributed_type_repr +| @composition_type_repr +| @dictionary_type_repr +| @error_type_repr +| @existential_type_repr +| @fixed_type_repr +| @function_type_repr +| @ident_type_repr +| @implicitly_unwrapped_optional_type_repr +| @metatype_type_repr +| @named_opaque_return_type_repr +| @opaque_return_type_repr +| @optional_type_repr +| @placeholder_type_repr +| @protocol_type_repr +| @sil_box_type_repr +| @specifier_type_repr +| @tuple_type_repr ; function_types( @@ -431,13 +362,6 @@ generic_function_types( unique int id: @generic_function_type ); -#keyset[id, index] -generic_function_type_generic_params( - int id: @generic_function_type ref, - int index: int ref, - int generic_param: @generic_type_param_type ref -); - @nominal_or_bound_generic_nominal_type = @bound_generic_type | @nominal_type @@ -521,8 +445,7 @@ weak_storage_types( ; generic_type_param_types( - unique int id: @generic_type_param_type, - string name: string ref + unique int id: @generic_type_param_type ); paren_types( @@ -542,13 +465,6 @@ enum_case_decls( unique int id: @enum_case_decl ); -#keyset[id, index] -enum_case_decl_elements( - int id: @enum_case_decl ref, - int index: int ref, - int element: @enum_element_decl ref -); - if_config_decls( unique int id: @if_config_decl ); @@ -571,20 +487,6 @@ pattern_binding_decls( unique int id: @pattern_binding_decl ); -#keyset[id, index] -pattern_binding_decl_inits( - int id: @pattern_binding_decl ref, - int index: int ref, - int init: @expr ref -); - -#keyset[id, index] -pattern_binding_decl_patterns( - int id: @pattern_binding_decl ref, - int index: int ref, - int pattern: @pattern ref -); - pound_diagnostic_decls( unique int id: @pound_diagnostic_decl ); @@ -594,13 +496,7 @@ precedence_group_decls( ); top_level_code_decls( - unique int id: @top_level_code_decl, - int body: @brace_stmt ref -); - -unknown_ast_nodes( - unique int id: @unknown_ast_node, - string name: string ref + unique int id: @top_level_code_decl ); @value_decl = @@ -610,12 +506,6 @@ unknown_ast_nodes( | @type_decl ; -#keyset[id] -value_decls( - int id: @value_decl ref, - int interface_type: @type ref -); - @abstract_closure_expr = @auto_closure_expr | @closure_expr @@ -627,20 +517,12 @@ value_decls( | @try_expr ; -#keyset[id] -any_try_exprs( - int id: @any_try_expr ref, - int sub_expr: @expr ref -); - applied_property_wrapper_exprs( unique int id: @applied_property_wrapper_expr ); arguments( - unique int id: @argument, - string label: string ref, - int expr: @expr ref + unique int id: @argument ); @apply_expr = @@ -651,44 +533,20 @@ arguments( | @self_apply_expr ; -#keyset[id] -apply_exprs( - int id: @apply_expr ref, - int function: @expr ref -); - -#keyset[id, index] -apply_expr_arguments( - int id: @apply_expr ref, - int index: int ref, - int argument: @argument ref -); - arrow_exprs( unique int id: @arrow_expr ); assign_exprs( - unique int id: @assign_expr, - int dest: @expr ref, - int source: @expr ref + unique int id: @assign_expr ); bind_optional_exprs( - unique int id: @bind_optional_expr, - int sub_expr: @expr ref + unique int id: @bind_optional_expr ); capture_list_exprs( - unique int id: @capture_list_expr, - int closure_body: @closure_expr ref -); - -#keyset[id, index] -capture_list_expr_binding_decls( - int id: @capture_list_expr ref, - int index: int ref, - int binding_decl: @pattern_binding_decl ref + unique int id: @capture_list_expr ); code_completion_exprs( @@ -701,27 +559,11 @@ code_completion_exprs( ; decl_ref_exprs( - unique int id: @decl_ref_expr, - int decl: @decl ref -); - -#keyset[id, index] -decl_ref_expr_replacement_types( - int id: @decl_ref_expr ref, - int index: int ref, - int replacement_type: @type ref + unique int id: @decl_ref_expr ); default_argument_exprs( - unique int id: @default_argument_expr, - int param_decl: @param_decl ref, - int param_index: int ref -); - -#keyset[id] -default_argument_expr_caller_side_defaults( - int id: @default_argument_expr ref, - int caller_side_default: @expr ref + unique int id: @default_argument_expr ); discard_assignment_exprs( @@ -729,14 +571,11 @@ discard_assignment_exprs( ); dot_syntax_base_ignored_exprs( - unique int id: @dot_syntax_base_ignored_expr, - int qualifier: @expr ref, - int sub_expr: @expr ref + unique int id: @dot_syntax_base_ignored_expr ); dynamic_type_exprs( - unique int id: @dynamic_type_expr, - int base_expr: @expr ref + unique int id: @dynamic_type_expr ); editor_placeholder_exprs( @@ -744,10 +583,7 @@ editor_placeholder_exprs( ); enum_is_case_exprs( - unique int id: @enum_is_case_expr, - int sub_expr: @expr ref, - int type_repr: @type_repr ref, - int element: @enum_element_decl ref + unique int id: @enum_is_case_expr ); error_exprs( @@ -759,15 +595,8 @@ error_exprs( | @coerce_expr ; -#keyset[id] -explicit_cast_exprs( - int id: @explicit_cast_expr ref, - int sub_expr: @expr ref -); - force_value_exprs( - unique int id: @force_value_expr, - int sub_expr: @expr ref + unique int id: @force_value_expr ); @identity_expr = @@ -777,17 +606,8 @@ force_value_exprs( | @unresolved_member_chain_result_expr ; -#keyset[id] -identity_exprs( - int id: @identity_expr ref, - int sub_expr: @expr ref -); - if_exprs( - unique int id: @if_expr, - int condition: @expr ref, - int then_expr: @expr ref, - int else_expr: @expr ref + unique int id: @if_expr ); @implicit_conversion_expr = @@ -824,15 +644,8 @@ if_exprs( | @unresolved_type_conversion_expr ; -#keyset[id] -implicit_conversion_exprs( - int id: @implicit_conversion_expr ref, - int sub_expr: @expr ref -); - in_out_exprs( - unique int id: @in_out_expr, - int sub_expr: @expr ref + unique int id: @in_out_expr ); key_path_application_exprs( @@ -847,21 +660,8 @@ key_path_exprs( unique int id: @key_path_expr ); -#keyset[id] -key_path_expr_parsed_roots( - int id: @key_path_expr ref, - int parsed_root: @expr ref -); - -#keyset[id] -key_path_expr_parsed_paths( - int id: @key_path_expr ref, - int parsed_path: @expr ref -); - lazy_initializer_exprs( - unique int id: @lazy_initializer_expr, - int sub_expr: @expr ref + unique int id: @lazy_initializer_expr ); @literal_expr = @@ -879,21 +679,15 @@ lazy_initializer_exprs( ; make_temporarily_escapable_exprs( - unique int id: @make_temporarily_escapable_expr, - int escaping_closure: @opaque_value_expr ref, - int nonescaping_closure: @expr ref, - int sub_expr: @expr ref + unique int id: @make_temporarily_escapable_expr ); obj_c_selector_exprs( - unique int id: @obj_c_selector_expr, - int sub_expr: @expr ref, - int method: @abstract_function_decl ref + unique int id: @obj_c_selector_expr ); one_way_exprs( - unique int id: @one_way_expr, - int sub_expr: @expr ref + unique int id: @one_way_expr ); opaque_value_exprs( @@ -901,15 +695,11 @@ opaque_value_exprs( ); open_existential_exprs( - unique int id: @open_existential_expr, - int sub_expr: @expr ref, - int existential: @expr ref, - int opaque_expr: @opaque_value_expr ref + unique int id: @open_existential_expr ); optional_evaluation_exprs( - unique int id: @optional_evaluation_expr, - int sub_expr: @expr ref + unique int id: @optional_evaluation_expr ); other_constructor_decl_ref_exprs( @@ -925,9 +715,7 @@ property_wrapper_value_placeholder_exprs( ); rebind_self_in_constructor_exprs( - unique int id: @rebind_self_in_constructor_expr, - int sub_expr: @expr ref, - int self: @var_decl ref + unique int id: @rebind_self_in_constructor_expr ); sequence_exprs( @@ -935,49 +723,25 @@ sequence_exprs( ); super_ref_exprs( - unique int id: @super_ref_expr, - int self: @var_decl ref + unique int id: @super_ref_expr ); tap_exprs( - unique int id: @tap_expr, - int var: @var_decl ref, - int body: @brace_stmt ref -); - -#keyset[id] -tap_expr_sub_exprs( - int id: @tap_expr ref, - int sub_expr: @expr ref + unique int id: @tap_expr ); tuple_element_exprs( - unique int id: @tuple_element_expr, - int sub_expr: @expr ref, - int index: int ref + unique int id: @tuple_element_expr ); tuple_exprs( unique int id: @tuple_expr ); -#keyset[id, index] -tuple_expr_elements( - int id: @tuple_expr ref, - int index: int ref, - int element: @expr ref -); - type_exprs( unique int id: @type_expr ); -#keyset[id] -type_expr_type_reprs( - int id: @type_expr ref, - int type_repr: @type_repr ref -); - unresolved_decl_ref_exprs( unique int id: @unresolved_decl_ref_expr ); @@ -999,8 +763,7 @@ unresolved_specialize_exprs( ); vararg_expansion_exprs( - unique int id: @vararg_expansion_expr, - int sub_expr: @expr ref + unique int id: @vararg_expansion_expr ); any_patterns( @@ -1008,160 +771,67 @@ any_patterns( ); binding_patterns( - unique int id: @binding_pattern, - int sub_pattern: @pattern ref + unique int id: @binding_pattern ); bool_patterns( - unique int id: @bool_pattern, - boolean value: boolean ref + unique int id: @bool_pattern ); enum_element_patterns( - unique int id: @enum_element_pattern, - int element: @enum_element_decl ref -); - -#keyset[id] -enum_element_pattern_sub_patterns( - int id: @enum_element_pattern ref, - int sub_pattern: @pattern ref + unique int id: @enum_element_pattern ); expr_patterns( - unique int id: @expr_pattern, - int sub_expr: @expr ref + unique int id: @expr_pattern ); is_patterns( unique int id: @is_pattern ); -#keyset[id] -is_pattern_cast_type_reprs( - int id: @is_pattern ref, - int cast_type_repr: @type_repr ref -); - -#keyset[id] -is_pattern_sub_patterns( - int id: @is_pattern ref, - int sub_pattern: @pattern ref -); - named_patterns( - unique int id: @named_pattern, - string name: string ref + unique int id: @named_pattern ); optional_some_patterns( - unique int id: @optional_some_pattern, - int sub_pattern: @pattern ref + unique int id: @optional_some_pattern ); paren_patterns( - unique int id: @paren_pattern, - int sub_pattern: @pattern ref + unique int id: @paren_pattern ); tuple_patterns( unique int id: @tuple_pattern ); -#keyset[id, index] -tuple_pattern_elements( - int id: @tuple_pattern ref, - int index: int ref, - int element: @pattern ref -); - typed_patterns( - unique int id: @typed_pattern, - int sub_pattern: @pattern ref -); - -#keyset[id] -typed_pattern_type_reprs( - int id: @typed_pattern ref, - int type_repr: @type_repr ref + unique int id: @typed_pattern ); brace_stmts( unique int id: @brace_stmt ); -#keyset[id, index] -brace_stmt_elements( - int id: @brace_stmt ref, - int index: int ref, - int element: @ast_node ref -); - break_stmts( unique int id: @break_stmt ); -#keyset[id] -break_stmt_target_names( - int id: @break_stmt ref, - string target_name: string ref -); - -#keyset[id] -break_stmt_targets( - int id: @break_stmt ref, - int target: @stmt ref -); - case_stmts( - unique int id: @case_stmt, - int body: @stmt ref -); - -#keyset[id, index] -case_stmt_labels( - int id: @case_stmt ref, - int index: int ref, - int label: @case_label_item ref -); - -#keyset[id, index] -case_stmt_variables( - int id: @case_stmt ref, - int index: int ref, - int variable: @var_decl ref + unique int id: @case_stmt ); case_label_items( - unique int id: @case_label_item, - int pattern: @pattern ref -); - -#keyset[id] -case_label_item_guards( - int id: @case_label_item ref, - int guard: @expr ref + unique int id: @case_label_item ); continue_stmts( unique int id: @continue_stmt ); -#keyset[id] -continue_stmt_target_names( - int id: @continue_stmt ref, - string target_name: string ref -); - -#keyset[id] -continue_stmt_targets( - int id: @continue_stmt ref, - int target: @stmt ref -); - defer_stmts( - unique int id: @defer_stmt, - int body: @brace_stmt ref + unique int id: @defer_stmt ); fail_stmts( @@ -1169,9 +839,7 @@ fail_stmts( ); fallthrough_stmts( - unique int id: @fallthrough_stmt, - int fallthrough_source: @case_stmt ref, - int fallthrough_dest: @case_stmt ref + unique int id: @fallthrough_stmt ); @labeled_stmt = @@ -1183,12 +851,6 @@ fallthrough_stmts( | @switch_stmt ; -#keyset[id] -labeled_stmt_labels( - int id: @labeled_stmt ref, - string label: string ref -); - pound_assert_stmts( unique int id: @pound_assert_stmt ); @@ -1197,15 +859,8 @@ return_stmts( unique int id: @return_stmt ); -#keyset[id] -return_stmt_results( - int id: @return_stmt ref, - int result: @expr ref -); - throw_stmts( - unique int id: @throw_stmt, - int sub_expr: @expr ref + unique int id: @throw_stmt ); yield_stmts( @@ -1250,8 +905,7 @@ opened_archetype_types( ); primary_archetype_types( - unique int id: @primary_archetype_type, - int interface_type: @generic_type_param_type ref + unique int id: @primary_archetype_type ); dictionary_types( @@ -1282,40 +936,13 @@ prefix_operator_decls( | @func_decl ; -#keyset[id] -abstract_function_decls( - int id: @abstract_function_decl ref, - string name: string ref -); - -#keyset[id] -abstract_function_decl_bodies( - int id: @abstract_function_decl ref, - int body: @brace_stmt ref -); - -#keyset[id, index] -abstract_function_decl_params( - int id: @abstract_function_decl ref, - int index: int ref, - int param: @param_decl ref -); - @abstract_storage_decl = @subscript_decl | @var_decl ; enum_element_decls( - unique int id: @enum_element_decl, - string name: string ref -); - -#keyset[id, index] -enum_element_decl_params( - int id: @enum_element_decl ref, - int index: int ref, - int param: @param_decl ref + unique int id: @enum_element_decl ); @type_decl = @@ -1324,20 +951,12 @@ enum_element_decl_params( | @module_decl ; -#keyset[id] -type_decls( - int id: @type_decl ref, - string name: string ref -); - auto_closure_exprs( - unique int id: @auto_closure_expr, - int body: @brace_stmt ref + unique int id: @auto_closure_expr ); closure_exprs( - unique int id: @closure_expr, - int body: @brace_stmt ref + unique int id: @closure_expr ); force_try_exprs( @@ -1373,34 +992,14 @@ prefix_unary_exprs( | @dot_syntax_call_expr ; -#keyset[id] -self_apply_exprs( - int id: @self_apply_expr ref, - int base_expr: @expr ref -); - array_exprs( unique int id: @array_expr ); -#keyset[id, index] -array_expr_elements( - int id: @array_expr ref, - int index: int ref, - int element: @expr ref -); - dictionary_exprs( unique int id: @dictionary_expr ); -#keyset[id, index] -dictionary_expr_elements( - int id: @dictionary_expr ref, - int index: int ref, - int element: @expr ref -); - @checked_cast_expr = @conditional_checked_cast_expr | @forced_checked_cast_expr @@ -1562,30 +1161,6 @@ interpolated_string_literal_exprs( unique int id: @interpolated_string_literal_expr ); -#keyset[id] -interpolated_string_literal_expr_interpolation_exprs( - int id: @interpolated_string_literal_expr ref, - int interpolation_expr: @opaque_value_expr ref -); - -#keyset[id] -interpolated_string_literal_expr_interpolation_count_exprs( - int id: @interpolated_string_literal_expr ref, - int interpolation_count_expr: @expr ref -); - -#keyset[id] -interpolated_string_literal_expr_literal_capacity_exprs( - int id: @interpolated_string_literal_expr ref, - int literal_capacity_expr: @expr ref -); - -#keyset[id] -interpolated_string_literal_expr_appending_exprs( - int id: @interpolated_string_literal_expr ref, - int appending_expr: @tap_expr ref -); - regex_literal_exprs( unique int id: @regex_literal_expr ); @@ -1604,20 +1179,11 @@ object_literal_exprs( ; member_ref_exprs( - unique int id: @member_ref_expr, - int base_expr: @expr ref + unique int id: @member_ref_expr ); subscript_exprs( - unique int id: @subscript_expr, - int base_expr: @expr ref -); - -#keyset[id, index] -subscript_expr_arguments( - int id: @subscript_expr ref, - int index: int ref, - int argument: @argument ref + unique int id: @subscript_expr ); overloaded_decl_ref_exprs( @@ -1625,32 +1191,15 @@ overloaded_decl_ref_exprs( ); do_catch_stmts( - unique int id: @do_catch_stmt, - int body: @stmt ref -); - -#keyset[id, index] -do_catch_stmt_catches( - int id: @do_catch_stmt ref, - int index: int ref, - int catch: @case_stmt ref + unique int id: @do_catch_stmt ); do_stmts( - unique int id: @do_stmt, - int body: @brace_stmt ref + unique int id: @do_stmt ); for_each_stmts( - unique int id: @for_each_stmt, - int body: @brace_stmt ref, - int sequence: @expr ref -); - -#keyset[id] -for_each_stmt_wheres( - int id: @for_each_stmt ref, - int where: @expr ref + unique int id: @for_each_stmt ); @labeled_conditional_stmt = @@ -1659,39 +1208,16 @@ for_each_stmt_wheres( | @while_stmt ; -#keyset[id] -labeled_conditional_stmts( - int id: @labeled_conditional_stmt ref, - int condition: @stmt_condition ref -); - stmt_conditions( unique int id: @stmt_condition ); -#keyset[id, index] -stmt_condition_elements( - int id: @stmt_condition ref, - int index: int ref, - int element: @condition_element ref -); - repeat_while_stmts( - unique int id: @repeat_while_stmt, - int condition: @expr ref, - int body: @stmt ref + unique int id: @repeat_while_stmt ); switch_stmts( - unique int id: @switch_stmt, - int expr: @expr ref -); - -#keyset[id, index] -switch_stmt_cases( - int id: @switch_stmt ref, - int index: int ref, - int case_: @case_stmt ref + unique int id: @switch_stmt ); bound_generic_class_types( @@ -1707,8 +1233,7 @@ bound_generic_struct_types( ); class_types( - unique int id: @class_type, - int decl: @class_decl ref + unique int id: @class_type ); enum_types( @@ -1720,8 +1245,7 @@ protocol_types( ); struct_types( - unique int id: @struct_type, - int decl: @struct_decl ref + unique int id: @struct_type ); array_slice_types( @@ -1758,13 +1282,6 @@ subscript_decls( | @param_decl ; -#keyset[id] -var_decls( - int id: @var_decl ref, - string name: string ref, - int type_: @type ref -); - @abstract_type_param_decl = @associated_type_decl | @generic_type_param_decl @@ -1777,13 +1294,6 @@ var_decls( | @subscript_expr ; -#keyset[id, index] -generic_context_generic_type_params( - int id: @generic_context ref, - int index: int ref, - int generic_type_param: @generic_type_param_decl ref -); - @generic_type_decl = @nominal_type_decl | @opaque_type_decl @@ -1815,13 +1325,11 @@ is_exprs( ); boolean_literal_exprs( - unique int id: @boolean_literal_expr, - boolean value: boolean ref + unique int id: @boolean_literal_expr ); magic_identifier_literal_exprs( - unique int id: @magic_identifier_literal_expr, - string kind: string ref + unique int id: @magic_identifier_literal_expr ); @number_literal_expr = @@ -1830,8 +1338,7 @@ magic_identifier_literal_exprs( ; string_literal_exprs( - unique int id: @string_literal_expr, - string value: string ref + unique int id: @string_literal_expr ); dynamic_member_ref_exprs( @@ -1843,24 +1350,15 @@ dynamic_subscript_exprs( ); guard_stmts( - unique int id: @guard_stmt, - int body: @brace_stmt ref + unique int id: @guard_stmt ); if_stmts( - unique int id: @if_stmt, - int then: @stmt ref -); - -#keyset[id] -if_stmt_elses( - int id: @if_stmt ref, - int else: @stmt ref + unique int id: @if_stmt ); while_stmts( - unique int id: @while_stmt, - int body: @stmt ref + unique int id: @while_stmt ); accessor_decls( @@ -1872,8 +1370,7 @@ concrete_func_decls( ); concrete_var_decls( - unique int id: @concrete_var_decl, - int introducer_int: int ref + unique int id: @concrete_var_decl ); param_decls( @@ -1897,11 +1394,127 @@ type_alias_decls( ); float_literal_exprs( - unique int id: @float_literal_expr, - string string_value: string ref + unique int id: @float_literal_expr ); integer_literal_exprs( - unique int id: @integer_literal_expr, - string string_value: string ref + unique int id: @integer_literal_expr +); + +error_type_reprs( + unique int id: @error_type_repr +); + +attributed_type_reprs( + unique int id: @attributed_type_repr +); + +@ident_type_repr = + @component_ident_type_repr +| @compound_ident_type_repr +; + +@component_ident_type_repr = + @generic_ident_type_repr +| @simple_ident_type_repr +; + +simple_ident_type_reprs( + unique int id: @simple_ident_type_repr +); + +generic_ident_type_reprs( + unique int id: @generic_ident_type_repr +); + +compound_ident_type_reprs( + unique int id: @compound_ident_type_repr +); + +function_type_reprs( + unique int id: @function_type_repr +); + +array_type_reprs( + unique int id: @array_type_repr +); + +dictionary_type_reprs( + unique int id: @dictionary_type_repr +); + +optional_type_reprs( + unique int id: @optional_type_repr +); + +implicitly_unwrapped_optional_type_reprs( + unique int id: @implicitly_unwrapped_optional_type_repr +); + +tuple_type_reprs( + unique int id: @tuple_type_repr +); + +composition_type_reprs( + unique int id: @composition_type_repr +); + +metatype_type_reprs( + unique int id: @metatype_type_repr +); + +protocol_type_reprs( + unique int id: @protocol_type_repr +); + +opaque_return_type_reprs( + unique int id: @opaque_return_type_repr +); + +named_opaque_return_type_reprs( + unique int id: @named_opaque_return_type_repr +); + +existential_type_reprs( + unique int id: @existential_type_repr +); + +placeholder_type_reprs( + unique int id: @placeholder_type_repr +); + +@specifier_type_repr = + @compile_time_const_type_repr +| @in_out_type_repr +| @isolated_type_repr +| @owned_type_repr +| @shared_type_repr +; + +in_out_type_reprs( + unique int id: @in_out_type_repr +); + +shared_type_reprs( + unique int id: @shared_type_repr +); + +owned_type_reprs( + unique int id: @owned_type_repr +); + +isolated_type_reprs( + unique int id: @isolated_type_repr +); + +compile_time_const_type_reprs( + unique int id: @compile_time_const_type_repr +); + +fixed_type_reprs( + unique int id: @fixed_type_repr +); + +sil_box_type_reprs( + unique int id: @sil_box_type_repr ); diff --git a/swift/ql/test/extractor-tests/declarations/test.expected b/swift/ql/test/extractor-tests/declarations/test.expected index 1f9979f5b54..73a33507c81 100644 --- a/swift/ql/test/extractor-tests/declarations/test.expected +++ b/swift/ql/test/extractor-tests/declarations/test.expected @@ -1,2 +1,2 @@ | test.swift:1:1:1:9 | TBD (TopLevelCodeDecl) | -| test.swift:1:5:1:5 | TBD (VarDecl) | +| test.swift:1:5:1:5 | TBD (ConcreteVarDecl) |