зеркало из https://github.com/github/codeql.git
Swift: move TBD code to ql
This allows to avoid bypassing label type correcness in the extractor, and allows to independently resolve TBD extractions, as with this approach TBD nodes do have the correctly typed trap label. The TBD status is now a predicate on the QL side. This requires: * a default visit using the correct type, which is achieved via macro metaprogramming in `VisitorBase.h`, following the way `swift::ASTVisitor` is programmed * a mapping from labels to corresponding binding trap entries. The functor is defined in `TrapTagTraits.h` and instantiated in generated `TrapEntries.h` * Binding trap entries for TBD unknown entities must not have any other field than the `id` (after all, we are supposed to not extract them yet). This is why all unextracted fields in `schema.yml` have been commented out, and will be uncommentend when visitors are added
This commit is contained in:
Родитель
20af134ff0
Коммит
da00bf99a1
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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}}
|
||||
}
|
||||
|
|
|
@ -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",
|
||||
],
|
||||
)
|
||||
|
|
|
@ -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 <typename Parent, typename Kind>
|
||||
inline std::string getKindName(Kind kind) {
|
||||
return Parent::getKindName(kind).str();
|
||||
}
|
||||
|
||||
template <>
|
||||
inline std::string getKindName<swift::TypeBase, swift::TypeKind>(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::TypeRepr, swift::TypeReprKind>(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 <typename Entry>
|
||||
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 <typename Parent, typename Child>
|
||||
void TBD(Child* entity, const std::string& suffix) {
|
||||
using namespace std::string_literals;
|
||||
template <typename E>
|
||||
void emitUnknown(E* entity) {
|
||||
auto label = assignNewLabel(entity);
|
||||
auto kind = detail::getKindName<Parent>(static_cast<const Parent*>(entity)->getKind());
|
||||
auto name = "TBD ("s + kind + suffix + ")";
|
||||
if constexpr (std::is_same_v<Parent, swift::TypeBase>) {
|
||||
trap.emit(UnknownTypesTrap{label, name});
|
||||
} else {
|
||||
trap.emit(UnknownAstNodesTrap{label, name});
|
||||
}
|
||||
using Trap = BindingTrapOf<E>;
|
||||
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<std::monostate>(waitingForNewLabel) &&
|
||||
assert(std::holds_alternative<std::monostate>(waitingForNewLabel) &&
|
||||
"fetchLabel called before assignNewLabel");
|
||||
if (auto l = store.get(e)) {
|
||||
return *l;
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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<swift::TypeRepr>(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};
|
||||
};
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
#include <iostream>
|
||||
#include <string>
|
||||
|
||||
#include "swift/extractor/trap/generated/TrapTags.h"
|
||||
|
||||
namespace codeql {
|
||||
|
||||
class UntypedTrapLabel {
|
||||
|
@ -46,14 +44,7 @@ class TrapLabel : public UntypedTrapLabel {
|
|||
|
||||
template <typename OtherTag>
|
||||
TrapLabel(const TrapLabel<OtherTag>& other) : UntypedTrapLabel(other) {
|
||||
// we temporarily need to bypass the label type system for unknown AST nodes and types
|
||||
if constexpr (std::is_same_v<Tag, UnknownAstNodeTag>) {
|
||||
static_assert(std::is_base_of_v<AstNodeTag, OtherTag>, "wrong label assignment!");
|
||||
} else if constexpr (std::is_same_v<Tag, UnknownTypeTag>) {
|
||||
static_assert(std::is_base_of_v<TypeTag, OtherTag>, "wrong label assignment!");
|
||||
} else {
|
||||
static_assert(std::is_base_of_v<Tag, OtherTag>, "wrong label assignment!");
|
||||
}
|
||||
static_assert(std::is_base_of_v<Tag, OtherTag>, "wrong label assignment!");
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -8,11 +8,17 @@
|
|||
namespace codeql {
|
||||
|
||||
namespace detail {
|
||||
// must be instantiated for default mapping from entities to tags
|
||||
template <typename T>
|
||||
struct ToTagFunctor;
|
||||
|
||||
// can be instantiated to override the default mapping for special cases
|
||||
template <typename T>
|
||||
struct ToTagOverride : ToTagFunctor<T> {};
|
||||
|
||||
// must be instantiated to map trap labels to the corresponding generated binding trap entry
|
||||
template <typename Label>
|
||||
struct ToBindingTrapFunctor;
|
||||
} // namespace detail
|
||||
|
||||
template <typename T>
|
||||
|
@ -21,4 +27,7 @@ using TrapTagOf = typename detail::ToTagOverride<std::remove_const_t<T>>::type;
|
|||
template <typename T>
|
||||
using TrapLabelOf = TrapLabel<TrapTagOf<T>>;
|
||||
|
||||
template <typename T>
|
||||
using BindingTrapOf = typename detail::ToBindingTrapFunctor<TrapLabelOf<T>>::type;
|
||||
|
||||
} // namespace codeql
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "swift/extractor/SwiftDispatcher.h"
|
||||
#include <swift/AST/ASTVisitor.h>
|
||||
#include "swift/extractor/visitors/VisitorBase.h"
|
||||
|
||||
namespace codeql {
|
||||
|
||||
class DeclVisitor : public swift::DeclVisitor<DeclVisitor> {
|
||||
class DeclVisitor : public AstVisitorBase<DeclVisitor> {
|
||||
public:
|
||||
// SwiftDispatcher should outlive the DeclVisitor
|
||||
DeclVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {}
|
||||
|
||||
template <typename E>
|
||||
void visitDecl(E* decl) {
|
||||
dispatcher.TBD<swift::Decl>(decl, "Decl");
|
||||
}
|
||||
|
||||
private:
|
||||
SwiftDispatcher& dispatcher;
|
||||
using AstVisitorBase<DeclVisitor>::AstVisitorBase;
|
||||
};
|
||||
|
||||
} // namespace codeql
|
||||
|
|
|
@ -1,22 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "swift/extractor/SwiftDispatcher.h"
|
||||
#include <swift/AST/ASTVisitor.h>
|
||||
#include "swift/extractor/visitors/VisitorBase.h"
|
||||
|
||||
namespace codeql {
|
||||
|
||||
class ExprVisitor : public swift::ExprVisitor<ExprVisitor> {
|
||||
class ExprVisitor : public AstVisitorBase<ExprVisitor> {
|
||||
public:
|
||||
// SwiftDispatcher should outlive the ExprVisitor
|
||||
ExprVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {}
|
||||
|
||||
template <typename E>
|
||||
void visitExpr(E* expr) {
|
||||
dispatcher.TBD<swift::Expr>(expr, "Expr");
|
||||
}
|
||||
|
||||
private:
|
||||
SwiftDispatcher& dispatcher;
|
||||
using AstVisitorBase<ExprVisitor>::AstVisitorBase;
|
||||
};
|
||||
|
||||
} // namespace codeql
|
||||
|
|
|
@ -1,38 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "swift/extractor/SwiftDispatcher.h"
|
||||
#include <swift/AST/ASTVisitor.h>
|
||||
#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 <typename CrtpSubclass>
|
||||
class PatchedPatternVisitor : public swift::PatternVisitor<CrtpSubclass> {
|
||||
class PatternVisitor : public AstVisitorBase<PatternVisitor> {
|
||||
public:
|
||||
#define PATTERN(CLASS, PARENT) \
|
||||
void visit##CLASS##Pattern(swift::CLASS##Pattern* E) { \
|
||||
return static_cast<CrtpSubclass*>(this)->visit##PARENT(E); \
|
||||
}
|
||||
#include "swift/AST/PatternNodes.def"
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class PatternVisitor : public detail::PatchedPatternVisitor<PatternVisitor> {
|
||||
public:
|
||||
// SwiftDispatcher should outlive the PatternVisitor
|
||||
PatternVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {}
|
||||
|
||||
template <typename E>
|
||||
void visitPattern(E* pattern) {
|
||||
dispatcher.TBD<swift::Pattern>(pattern, "Pattern");
|
||||
}
|
||||
|
||||
private:
|
||||
SwiftDispatcher& dispatcher;
|
||||
using AstVisitorBase<PatternVisitor>::AstVisitorBase;
|
||||
};
|
||||
|
||||
} // namespace codeql
|
||||
|
|
|
@ -1,39 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "swift/extractor/SwiftDispatcher.h"
|
||||
#include <swift/AST/ASTVisitor.h>
|
||||
#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 <typename CrtpSubclass>
|
||||
class PatchedStmtVisitor : public swift::StmtVisitor<CrtpSubclass> {
|
||||
class StmtVisitor : public AstVisitorBase<StmtVisitor> {
|
||||
public:
|
||||
#define ABSTRACT_STMT(CLASS, PARENT) \
|
||||
void visit##CLASS##Stmt(swift::CLASS##Stmt* E) { \
|
||||
return static_cast<CrtpSubclass*>(this)->visit##PARENT(E); \
|
||||
}
|
||||
#define STMT(CLASS, PARENT) ABSTRACT_STMT(CLASS, PARENT)
|
||||
#include "swift/AST/StmtNodes.def"
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
class StmtVisitor : public detail::PatchedStmtVisitor<StmtVisitor> {
|
||||
public:
|
||||
// SwiftDispatcher should outlive the StmtVisitor
|
||||
StmtVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {}
|
||||
|
||||
template <typename E>
|
||||
void visitStmt(E* stmt) {
|
||||
dispatcher.TBD<swift::Stmt>(stmt, "Stmt");
|
||||
}
|
||||
|
||||
private:
|
||||
SwiftDispatcher& dispatcher;
|
||||
using AstVisitorBase<StmtVisitor>::AstVisitorBase;
|
||||
};
|
||||
|
||||
} // namespace codeql
|
||||
|
|
|
@ -0,0 +1,12 @@
|
|||
#pragma once
|
||||
|
||||
#include "swift/extractor/visitors/VisitorBase.h"
|
||||
|
||||
namespace codeql {
|
||||
|
||||
class TypeReprVisitor : public AstVisitorBase<TypeReprVisitor> {
|
||||
public:
|
||||
using AstVisitorBase<TypeReprVisitor>::AstVisitorBase;
|
||||
};
|
||||
|
||||
} // namespace codeql
|
|
@ -1,22 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "swift/extractor/SwiftDispatcher.h"
|
||||
#include <swift/AST/TypeVisitor.h>
|
||||
|
||||
#include "swift/extractor/visitors/VisitorBase.h"
|
||||
namespace codeql {
|
||||
|
||||
class TypeVisitor : public swift::TypeVisitor<TypeVisitor> {
|
||||
class TypeVisitor : public TypeVisitorBase<TypeVisitor> {
|
||||
public:
|
||||
// SwiftDispatcher should outlive the TypeVisitor
|
||||
TypeVisitor(SwiftDispatcher& dispatcher) : dispatcher(dispatcher) {}
|
||||
|
||||
template <typename E>
|
||||
void visitType(E* type) {
|
||||
dispatcher.TBD<swift::TypeBase>(type, "Type");
|
||||
}
|
||||
|
||||
private:
|
||||
SwiftDispatcher& dispatcher;
|
||||
using TypeVisitorBase<TypeVisitor>::TypeVisitorBase;
|
||||
};
|
||||
|
||||
} // namespace codeql
|
||||
|
|
|
@ -0,0 +1,63 @@
|
|||
#pragma once
|
||||
|
||||
#include <swift/AST/ASTVisitor.h>
|
||||
#include <swift/AST/TypeVisitor.h>
|
||||
|
||||
#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 <typename CrtpSubclass>
|
||||
class AstVisitorBase : public swift::ASTVisitor<CrtpSubclass>, 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 <typename CrtpSubclass>
|
||||
class TypeVisitorBase : public swift::TypeVisitor<CrtpSubclass>, detail::DispatcherWrapper {
|
||||
public:
|
||||
using DispatcherWrapper::DispatcherWrapper;
|
||||
|
||||
#define TYPE(CLASS, PARENT) DEFAULT(Type, CLASS, PARENT)
|
||||
#include "swift/AST/TypeNodes.def"
|
||||
};
|
||||
|
||||
#undef DEFAULT
|
||||
|
||||
} // namespace codeql
|
|
@ -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
|
||||
|
|
|
@ -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() + ")" }
|
||||
}
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
private import codeql.swift.generated.UnknownAstNode
|
||||
|
||||
class UnknownAstNode extends UnknownAstNodeBase {
|
||||
override string toString() { result = getName() }
|
||||
}
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -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 { }
|
|
@ -13,4 +13,6 @@ class ElementBase extends @element {
|
|||
or
|
||||
result = getResolveStep().resolve()
|
||||
}
|
||||
|
||||
predicate isUnknown() { element_is_unknown(this) }
|
||||
}
|
||||
|
|
|
@ -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) }
|
||||
}
|
|
@ -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 { }
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()) }
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 { }
|
||||
|
|
|
@ -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) }
|
||||
}
|
||||
|
|
Некоторые файлы не были показаны из-за слишком большого количества измененных файлов Показать больше
Загрузка…
Ссылка в новой задаче