CodeQL library for Swift
codeql/swift-all 2.0.4-dev (changelog, source)
Search

Module swift

Top-level import for the Swift language pack

Import path

import swift

Classes

AddExpr

An add expression. a + b a &+ b

AndBitwiseExpr

A bitwise AND expression. a & b

ArithmeticOperation

An arithmetic operation, such as: a + b

BinaryArithmeticOperation

A binary arithmetic operation, such as: a + b

BinaryBitwiseOperation

A binary bitwise operation, such as: a & b a << b a .^ b

BinaryLogicalOperation
BitwiseOperation

A bitwise operation, such as: a & b a << b ~a

BoolType

The Bool type.

CharacterType

The Character type.

ClassOrStructDecl

A class or struct declaration. For example MyStruct or MyClass in the following example:

CompilerError

A compiler error message.

CompilerNote

A compiler-generated note (typically attached to an error or warning).

CompilerRemark

A compiler-generated remark (milder than a warning, this does not indicate an issue).

CompilerWarning

A compiler-generated warning.

DidSetObserver
DivExpr

A divide expression. a / b

DocComment
EnumElementExpr

An expression that references a case of an enum. For example both enumElement in: let value = MyEnum.enumElement ... switch (anotherValue) { case .enumElement: ...

FieldDecl

A field declaration. That is, a variable declaration that is a member of a class, struct, enum or protocol.

FloatingPointType

A floating-point type. This includes the Float type, the Double, and builtin floating-point types.

FreeFunction

A free (non-member) function.

InitializerCallExpr
InitializerLookupExpr
IntegralType

An integer-like type. For example, Int, Int16, Uint16, etc.

LogicalAndExpr
LogicalOperation
LogicalOrExpr
MethodCallExpr
MulExpr

A multiply expression. a * b a &* b

MultiLineComment
MultiLineDocComment
NilCoalescingExpr

A Swift nil-coalesing expr (??).

NotBitwiseExpr

A bitwise NOT expression. ~a

NotExpr
NumericType

A numeric type. This includes the integer and floating point types.

OrBitwiseExpr

A bitwise OR expression. a | b

PointwiseAndExpr

A pointwise bitwise-and expression: a .& b

PointwiseOrExpr

A pointwise bitwise-or expression: a .| b

PointwiseXorExpr

A pointwise bitwise exclusive-or expression: a .^ b

RemExpr

A remainder expression. a % b

SelfRefExpr

A reference to self.

ShiftLeftBitwiseExpr

A bitwise shift left expression. a << b a &<<

ShiftRightBitwiseExpr

A bitwise shift right expression. a >> b a &>>

SingleLineComment
SingleLineDocComment
SubExpr

A subtract expression. a - b a &- b

UnaryArithmeticOperation

A unary arithmetic operation, such as: -a

UnaryBitwiseOperation

A unary bitwise operation, such as: ~a

UnaryLogicalOperation
UnaryMinusExpr

A unary minus expression. -a

UnaryPlusExpr

A unary plus expression. +a

Unit

The trivial type with a single element.

WillSetObserver
XorBitwiseExpr

A bitwise XOR expression. a ^ b

Aliases

AbiSafeConversionExpr
AbstractStorageDecl
AbstractTypeParamDecl
Accessor
AccessorOrNamedFunction

INTERNAL: Do not use.

AnyBuiltinIntegerType
AnyFunctionType
AnyGenericType
AnyHashableErasureExpr
AnyMetatypeType
AnyPattern
AnyTryExpr
AppliedPropertyWrapperExpr

An implicit application of a property wrapper on the argument of a call.

ApplyExpr
ArchetypeToSuperExpr
ArchetypeType
Argument
ArrayExpr
ArraySliceType
ArrayToPointerExpr
AssignAddExpr

An addition assignment expression: a += b a &+= b

AssignAndExpr

A bitwise-and assignment expression: a &= b

AssignArithmeticOperation

An arithmetic assignment expression. For example: x += 1 y *= z

AssignBitwiseOperation

A bitwise assignment expression. For example: x &= y z <<= 1

AssignDivExpr

A division assignment expression: a /= b

AssignExpr

A simple assignment expression using the = operator: x = 0

AssignLShiftExpr

A left-shift assignment expression: a <<= b a &<<= b

AssignMulExpr

A multiplication assignment expression: a *= b a &*= b

AssignOperation

An assignment expression apart from =. For example: x += 1 y &= z

AssignOrExpr

A bitwise-or assignment expression: a |= b

AssignPointwiseAndExpr

A pointwise bitwise-and assignment expression: a .&= b

AssignPointwiseOperation

A pointwise assignment expression. For example: x .&= y

AssignPointwiseOrExpr

A pointwise bitwise-or assignment expression: a .|= b

AssignPointwiseXorExpr

A pointwise bitwise exclusive-or assignment expression: a .^= b

AssignRShiftExpr

A right-shift assignment expression: a >>= b a &>>= b

AssignRemExpr

A remainder assignment expression: a %= b

AssignSubExpr

A subtraction assignment expression: a -= b a &-= b

AssignXorExpr

A bitwise exclusive-or assignment expression: a ^= b

Assignment

An assignment expression. For example: x = 0 y += 1 z <<= 1

AssociatedTypeDecl
AstNode

A node in the abstract syntax tree.

AutoClosureExpr

A Swift autoclosure expression, that is, a closure automatically generated around an argument when the parameter has the @autoclosure attribute or for the right-hand operand of short-circuiting logical operations. For example, there is an AutoClosureExpr around the value 0 in:

AvailabilityInfo

An availability condition of an if, while, or guard statements.

AvailabilitySpec

An availability spec, that is, part of an AvailabilityInfo condition. For example iOS 12 and * in: if #available(iOS 12, *)

AwaitExpr
BinaryExpr

A Swift binary expression, that is, an expression that appears between its two operands. For example: x + y

BindOptionalExpr
BindingPattern
BoolPattern
BooleanLiteralExpr

A boolean literal. For example true in: let x = true

BorrowExpr

An expression that marks value as borrowed. In the example below, _borrow marks the borrow expression:

BoundGenericClassType
BoundGenericEnumType
BoundGenericStructType
BoundGenericType
BraceStmt
BreakStmt
BridgeFromObjCExpr
BridgeToObjCExpr
BuiltinBridgeObjectType
BuiltinDefaultActorStorageType
BuiltinExecutorType
BuiltinFloatType
BuiltinIntegerLiteralType
BuiltinIntegerType
BuiltinJobType
BuiltinLiteralExpr

A Swift literal of a kind that is built in to the Swift language.

BuiltinNativeObjectType
BuiltinRawPointerType
BuiltinRawUnsafeContinuationType
BuiltinType
BuiltinUnsafeValueBufferType
BuiltinVectorType
CallExpr
Callable
CaptureListExpr
CapturedDecl

A captured variable or function parameter in the scope of a closure.

CaseLabelItem
CaseStmt
CheckedCastExpr
ClassDecl
ClassMetatypeToObjectExpr
ClassType
ClosureExpr
CoerceExpr
CollectionExpr
CollectionUpcastConversionExpr
Comment
ConcreteVarDecl
ConditionElement
ConditionalBridgeFromObjCExpr
ConditionalCheckedCastExpr
ConsumeExpr

An expression that forces value to be moved. In the example below, consume marks the move expression:

ContinueStmt
CopyExpr

An expression that forces value to be copied. In the example below, copy marks the copy expression:

CovariantFunctionConversionExpr
CovariantReturnConversionExpr
DbFile
DbLocation
Decl
DeclRefExpr

An expression that references or accesses a declaration.

DefaultArgumentExpr
DeferStmt
Deinitializer

A deinitializer of a class.

DependentMemberType
DerivedToBaseExpr
DestructureTupleExpr
Diagnostics

A compiler-generated error, warning, note or remark.

DictionaryExpr
DictionaryType
DifferentiableFunctionExpr
DifferentiableFunctionExtractOriginalExpr
DiscardAssignmentExpr
DiscardStmt

A statement that takes a non-copyable value and destructs its members/fields.

DoCatchStmt
DoStmt
DotSelfExpr
DotSyntaxBaseIgnoredExpr

An expression representing a partially applied lookup of an instance property via the receiver’s type object.

DynamicLookupExpr
DynamicMemberRefExpr
DynamicSelfType
DynamicSubscriptExpr
DynamicTypeExpr
Element
ElementArchetypeType

An archetype type of PackElementType.

EnumCaseDecl
EnumDecl

An enumeration declaration, for example: enum MyColours { case red case green case blue }

EnumElementDecl

An enum element declaration, for example enumElement and anotherEnumElement in: enum MyEnum { case enumElement case anotherEnumElement(Int) }

EnumElementPattern
EnumIsCaseExpr
EnumType
ErasureExpr
ErrorElement

The superclass of all elements indicating some kind of error.

ErrorExpr
ErrorType
ExistentialMetatypeToObjectExpr
ExistentialMetatypeType
ExistentialType
ExplicitCastExpr
ExplicitClosureExpr

A Swift explicit closure expr, that is, a closure written using { ... -> ... in ... } syntax rather than automatically generated by the compiler.

Expr

The base class for all expressions in Swift.

ExprPattern
ExtensionDecl
FailStmt
FallthroughStmt
File
FloatLiteralExpr
ForEachStmt
ForceTryExpr
ForceValueExpr
ForcedCheckedCastExpr
ForeignObjectConversionExpr
Function

A function.

FunctionConversionExpr
FunctionType
GenericContext
GenericFunctionType

The type of a generic function with type parameters

GenericTypeDecl
GenericTypeParamDecl
GenericTypeParamType
GuardStmt
IdentityExpr
IfConfigDecl
IfExpr
IfStmt
ImplicitConversionExpr
ImportDecl
InOutExpr
InOutToPointerExpr
InOutType
InfixOperatorDecl
Initializer

An initializer of a class, struct, enum or protocol.

InjectIntoOptionalExpr
IntegerLiteralExpr

An integer literal. For example 1 in: let x = 1

InterpolatedStringLiteralExpr
IsExpr
IsPattern
KeyPathApplicationExpr
KeyPathComponent

A component of a KeyPathExpr.

KeyPathDotExpr
KeyPathExpr

A key-path expression.

LValueType
LabeledConditionalStmt
LabeledStmt
LazyInitializationExpr
LinearFunctionExpr
LinearFunctionExtractOriginalExpr
LinearToDifferentiableFunctionExpr
LiteralExpr

A Swift literal.

LoadExpr
LocalArchetypeType
Locatable
Location

A location of a program element.

LookupExpr
MacroDecl

A declaration of a macro. Some examples:

MacroRole

The role of a macro, for example #freestanding(declaration) or @attached(member).

MagicIdentifierLiteralExpr

An identifier literal that is expanded at compile time. For example #file in: let x = #file

MakeTemporarilyEscapableExpr
MaterializePackExpr

An expression that materializes a pack during expansion. Appears around PackExpansionExpr.

MemberRefExpr
MetatypeConversionExpr
MetatypeType
Method

A function that is a member of a class, struct, enum or protocol.

MethodApplyExpr
MethodLookupExpr
MissingMemberDecl

A placeholder for missing declarations that can arise on object deserialization.

ModuleDecl
ModuleType
NamedFunction
NamedPattern

A pattern that corresponds to a fresh variable binding.

NilLiteralExpr
NominalOrBoundGenericNominalType
NominalType

A class, struct, enum or protocol.

NominalTypeDecl

A class, struct, enum or protocol.

NumberLiteralExpr
ObjCSelectorExpr
ObjectLiteralExpr

An instance of #fileLiteral, #imageLiteral or #colorLiteral expressions, which are used in playgrounds.

OneWayExpr
OpaqueTypeArchetypeType

An opaque type, that is a type formally equivalent to an underlying type but abstracting it away.

OpaqueTypeDecl

A declaration of an opaque type, that is formally equivalent to a given type but abstracts it away.

OpaqueValueExpr
OpenExistentialExpr

An implicit expression created by the compiler when a method is called on a protocol. For example in protocol P { func foo() -> Int } func bar(x: P) -> Int { return x.foo() } `x.foo()` is actually wrapped in an `OpenExistentialExpr` that "opens" `x` replacing it in its subexpression with an `OpaqueValueExpr`.

OpenedArchetypeType
OperatorDecl
OptionalEvaluationExpr
OptionalSomePattern
OptionalTryExpr
OptionalType
OtherAvailabilitySpec

A wildcard availability spec *

OtherInitializerRefExpr
OverloadedDeclRefExpr

An ambiguous expression that might refer to multiple declarations. This will be present only for failing compilations.

PackArchetypeType

An archetype type of PackType.

PackElementExpr

A pack element expression is a child of PackExpansionExpr.

PackElementType

A type of PackElementExpr, see PackElementExpr for more information.

PackExpansionExpr

A pack expansion expression.

PackExpansionType

A type of PackExpansionExpr, see PackExpansionExpr for more information.

PackType

An actual type of a pack expression at the instatiation point.

ParamDecl
ParameterizedProtocolType

A sugar type of the form P<X> with P a protocol.

ParenExpr
ParenPattern
ParenType
Pattern

A syntactic construct that can be matched against an expression, occurring in switch cases, conditions, and variable bindings.

PatternBindingDecl
PlatformVersionAvailabilitySpec

An availability spec based on platform and version, for example macOS 12 or watchOS 14

PointerToPointerExpr
PostfixOperatorDecl
PostfixUnaryExpr

A Swift postfix unary expression, that is, a unary expression that appears after its operand. For example: x!

PoundAssertStmt
PoundDiagnosticDecl

A diagnostic directive, which is either #error or #warning.

PrecedenceGroupDecl
PrefixOperatorDecl
PrefixUnaryExpr

A Swift prefix unary expression, that is, a unary expression that appears before its operand. For example: -x

PrimaryArchetypeType
PropertyWrapperValuePlaceholderExpr

A placeholder substituting property initializations with = when the property has a property wrapper with an initializer.

ProtocolCompositionType
ProtocolDecl
ProtocolMetatypeToObjectExpr
ProtocolType
RebindSelfInInitializerExpr
ReferenceStorageType
RegexLiteralExpr

A regular expression literal which is checked at compile time, for example /a(a|b)*b/.

RepeatWhileStmt
ReturnStmt
SelfParamDecl

A self parameter.

SequenceExpr
SingleValueStmtExpr

An expression that wraps a statement which produces a single value.

Stmt
StmtCondition
StringLiteralExpr

A string literal. For example "abc" in: let x = "abc"

StringToPointerExpr
StructDecl
StructType
SubscriptDecl
SubscriptExpr
SubstitutableType
SugarType
SuperRefExpr

A reference to super.

SwitchStmt
SyntaxSugarType
TapExpr

A TapExpr is an internal expression generated by the Swift compiler.

ThenStmt

A statement implicitly wrapping values to be used in branches of if/switch expressions. For example in: let rank = switch value { case 0..<0x80: 1 case 0x80..<0x0800: 2 default: 3 } the literal expressions 1, 2 and 3 are wrapped in ThenStmt.

ThrowStmt
TopLevelCodeDecl
TryExpr
TupleElementExpr
TupleExpr
TuplePattern
TupleType

A tuple type, for example: (Int, String)

Type

A Swift type.

TypeAliasDecl

A declaration of a type alias to another type. For example: typealias MyInt = Int

TypeAliasType

A type alias to another type. For example: typealias MyInt = Int

TypeDecl

A Swift type declaration, for example a class, struct, enum or protocol declaration.

TypeExpr
TypeRepr
TypedPattern
UnarySyntaxSugarType
UnboundGenericType
UnderlyingToOpaqueExpr
UnevaluatedInstanceExpr
UnknownFile
UnknownLocation

A Location that is given to something that is not associated with any position in the source code.

UnmanagedStorageType
UnownedStorageType
UnresolvedDeclRefExpr
UnresolvedDotExpr
UnresolvedMemberChainResultExpr
UnresolvedMemberExpr
UnresolvedPatternExpr
UnresolvedSpecializeExpr
UnresolvedType
UnresolvedTypeConversionExpr
UnspecifiedElement
ValueDecl

A declaration that introduces a value with a type.

VarDecl

A declaration of a variable such as * a local variable in a function: func foo() { var x = 42 // <- let y = "hello" // <- ... } * a member of a struct or class: struct S { var size : Int // <- } * …

VarargExpansionExpr
VariadicSequenceType

A variadic sequence type, that is, an array-like type that holds variadic arguments. For example the type Int... of args in: func myVarargsFunction(args: Int...) { ... }

WeakStorageType
WhileStmt
YieldStmt