Files
codeql/swift/codegen/schema.yml
Paolo Tranquilli 2fc88d5f8e Swift: add module to Decl and remove forward traps
Add module context to all declarations. As keeping the `std::variant`s
required slightly more work for this, and we intended to remove them
any way, this is done in this change.

For background, we put those in as we were not extracting all modules at
the time, so we were missing some DB ids that we put back in by adding
the "defining" traps not only in the trap file related to the defining
module but also to the one where the declaration was used. Since then
we fixed module extraction, so this should not be needed any more.
2022-08-23 16:53:07 +02:00

1213 lines
19 KiB
YAML

# add dbscheme files to be added verbatim
_includes:
- prefix.dbscheme
# organize generated class files in subdirectories according to these regexp rules
# a class can override this specifying `_dir`
_directories:
decl: Decl$|Context$
pattern: Pattern$
type: Type(Repr)?$
expr: Expr$
stmt: Stmt$
Element:
is_unknown:
type: predicate
_pragma: cpp_skip # this is emitted using trap entries directly
_pragma: qltest_skip
File:
name: string
_pragma: qltest_collapse_hierarchy
DbFile:
_extends: File
UnknownFile:
_extends: File
_synth:
on: {}
Locatable:
location:
type: Location?
_pragma: cpp_skip # this is emitted using trap entries directly
_pragma: qltest_skip
Location:
file: File
start_line: int
start_column: int
end_line: int
end_column: int
_pragma: [qltest_skip, qltest_collapse_hierarchy]
DbLocation:
_extends: Location
UnknownLocation:
_extends: Location
_synth:
on: {}
Comment:
_extends: Locatable
text: string
Type:
name: string
canonical_type: Type
IterableDeclContext:
members: Decl*
ExtensionDecl:
extended_type_decl: NominalTypeDecl
_extends:
- GenericContext
- IterableDeclContext
- Decl
NominalTypeDecl:
_extends:
- IterableDeclContext
- GenericTypeDecl
type: Type
AstNode:
_extends: Locatable
Callable:
_children:
params: ParamDecl*
body: BraceStmt?
ConditionElement:
_extends: Locatable
_children:
boolean: Expr?
pattern: Pattern?
initializer: Expr?
_dir: stmt
AnyFunctionType:
_extends: Type
result: Type
param_types: Type*
param_labels: string*
is_throwing: predicate
is_async: predicate
AnyGenericType:
_extends: Type
parent: Type?
declaration: Decl
AnyMetatypeType:
_extends: Type
BuiltinType:
_extends: Type
_pragma: qltest_collapse_hierarchy
DependentMemberType:
_extends: Type
baseType: Type
associated_type_decl: AssociatedTypeDecl
DynamicSelfType:
_extends: Type
static_self_type: Type
ErrorType:
_extends: Type
InOutType:
_extends: Type
object_type: Type
LValueType:
_extends: Type
object_type: Type
ModuleType:
_extends: Type
module: ModuleDecl
PlaceholderType:
_extends: Type
ProtocolCompositionType:
_extends: Type
members: Type*
ExistentialType:
_extends: Type
constraint: Type
ReferenceStorageType:
_extends: Type
referent_type: Type
SilBlockStorageType:
_extends: Type
SilBoxType:
_extends: Type
SilFunctionType:
_extends: Type
SilTokenType:
_extends: Type
SubstitutableType:
_extends: Type
SugarType:
_extends: Type
TupleType:
_extends: Type
types: Type*
names: string*
TypeVariableType:
_extends: Type
UnresolvedType:
_extends: Type
ClassDecl:
_extends: NominalTypeDecl
EnumDecl:
_extends: NominalTypeDecl
ProtocolDecl:
_extends: NominalTypeDecl
StructDecl:
_extends: NominalTypeDecl
Decl:
_extends: AstNode
module: ModuleDecl
Expr:
_extends: AstNode
type: Type?
Pattern:
_extends: AstNode
Stmt:
_extends: AstNode
TypeRepr:
_extends: AstNode
type: Type? # type can be absent on unresolved entities
FunctionType:
_extends: AnyFunctionType
GenericFunctionType:
_extends: AnyFunctionType
generic_params: GenericTypeParamType*
NominalOrBoundGenericNominalType:
_extends: AnyGenericType
UnboundGenericType:
_extends: AnyGenericType
ExistentialMetatypeType:
_extends: AnyMetatypeType
MetatypeType:
_extends: AnyMetatypeType
AnyBuiltinIntegerType:
_extends: BuiltinType
BuiltinBridgeObjectType:
_extends: BuiltinType
BuiltinDefaultActorStorageType:
_extends: BuiltinType
BuiltinExecutorType:
_extends: BuiltinType
BuiltinFloatType:
_extends: BuiltinType
BuiltinJobType:
_extends: BuiltinType
BuiltinNativeObjectType:
_extends: BuiltinType
BuiltinRawPointerType:
_extends: BuiltinType
BuiltinRawUnsafeContinuationType:
_extends: BuiltinType
BuiltinUnsafeValueBufferType:
_extends: BuiltinType
BuiltinVectorType:
_extends: BuiltinType
UnmanagedStorageType:
_extends: ReferenceStorageType
UnownedStorageType:
_extends: ReferenceStorageType
WeakStorageType:
_extends: ReferenceStorageType
ArchetypeType:
_extends: SubstitutableType
interface_type: Type
superclass: Type?
protocols: ProtocolDecl*
GenericTypeParamType:
_extends: SubstitutableType
ParenType:
_extends: SugarType
type: Type
SyntaxSugarType:
_extends: SugarType
TypeAliasType:
_extends: SugarType
decl: TypeAliasDecl
EnumCaseDecl:
_extends: Decl
_children:
elements: EnumElementDecl*
IfConfigDecl:
_extends: Decl
_children:
clauses: IfConfigClause*
IfConfigClause:
_extends: Locatable
_children:
condition: Expr?
elements: AstNode*
is_active: predicate
_dir: decl
ImportDecl:
_extends: Decl
is_exported: predicate
imported_module: ModuleDecl
declarations: ValueDecl*
MissingMemberDecl:
_extends: Decl
OperatorDecl:
_extends: Decl
name: string
PatternBindingDecl:
_extends: Decl
_children:
inits: Expr?*
patterns: Pattern*
PoundDiagnosticDecl:
_extends: Decl
PrecedenceGroupDecl:
_extends: Decl
TopLevelCodeDecl:
_extends: Decl
_children:
body: BraceStmt
ValueDecl:
_extends: Decl
interface_type: Type
AbstractClosureExpr:
_extends:
- Expr
- Callable
AnyTryExpr:
_extends: Expr
_children:
sub_expr: Expr
AppliedPropertyWrapperExpr:
_extends: Expr
Argument:
_extends: Locatable
label: string
_children:
expr: Expr
_dir: expr
ApplyExpr:
_extends: Expr
_children:
function: Expr
arguments: Argument*
ArrowExpr:
_extends: Expr
AssignExpr:
_extends: Expr
_children:
dest: Expr
source: Expr
BindOptionalExpr:
_extends: Expr
_children:
sub_expr: Expr
CaptureListExpr:
_extends: Expr
_children:
binding_decls: PatternBindingDecl*
closure_body: ClosureExpr
CodeCompletionExpr:
_extends: Expr
CollectionExpr:
_extends: Expr
DeclRefExpr:
_extends: Expr
decl: Decl
replacement_types: Type*
has_direct_to_storage_semantics: predicate
has_direct_to_implementation_semantics: predicate
has_ordinary_semantics: predicate
DefaultArgumentExpr:
_extends: Expr
param_decl: ParamDecl
param_index: int
caller_side_default: Expr?
DiscardAssignmentExpr:
_extends: Expr
DotSyntaxBaseIgnoredExpr:
_extends: Expr
_children:
qualifier: Expr
sub_expr: Expr
DynamicTypeExpr:
_extends: Expr
_children:
base: Expr
EditorPlaceholderExpr:
_extends: Expr
EnumIsCaseExpr:
_extends: Expr
_children:
sub_expr: Expr
element: EnumElementDecl
ErrorExpr:
_extends: Expr
_pragma: qltest_skip # unexpected emission
ExplicitCastExpr:
_extends: Expr
_children:
sub_expr: Expr
ForceValueExpr:
_extends: Expr
_children:
sub_expr: Expr
IdentityExpr:
_extends: Expr
_children:
sub_expr: Expr
IfExpr:
_extends: Expr
_children:
condition: Expr
then_expr: Expr
else_expr: Expr
ImplicitConversionExpr:
_extends: Expr
_children:
sub_expr: Expr
InOutExpr:
_extends: Expr
_children:
sub_expr: Expr
KeyPathApplicationExpr:
_extends: Expr
_children:
base: Expr
key_path: Expr
KeyPathDotExpr:
_extends: Expr
KeyPathExpr:
_extends: Expr
_children:
root: TypeRepr?
parsed_path: Expr?
LazyInitializerExpr:
_extends: Expr
_children:
sub_expr: Expr
LiteralExpr:
_extends: Expr
LookupExpr:
_extends: Expr
_children:
base: Expr
member: Decl?
MakeTemporarilyEscapableExpr:
_extends: Expr
_children:
escaping_closure: OpaqueValueExpr
nonescaping_closure: Expr
sub_expr: Expr
ObjCSelectorExpr:
_extends: Expr
_children:
sub_expr: Expr
method: AbstractFunctionDecl
_pragma: qltest_skip # to be tested in integration tests
OneWayExpr:
_extends: Expr
_children:
sub_expr: Expr
OpaqueValueExpr:
_extends: Expr
OpenExistentialExpr:
_extends: Expr
_children:
sub_expr: Expr
existential: Expr
opaque_expr: OpaqueValueExpr
OptionalEvaluationExpr:
_extends: Expr
_children:
sub_expr: Expr
OtherConstructorDeclRefExpr:
constructor_decl: ConstructorDecl
_extends: Expr
OverloadSetRefExpr:
_extends: Expr
PropertyWrapperValuePlaceholderExpr:
_extends: Expr
RebindSelfInConstructorExpr:
_extends: Expr
_children:
sub_expr: Expr
self: VarDecl
SequenceExpr:
_extends: Expr
_children:
elements: Expr*
_pragma: qltest_skip # we should really never extract these, as these should be resolved to trees of operations
SuperRefExpr:
_extends: Expr
self: VarDecl
TapExpr:
_extends: Expr
_children:
sub_expr: Expr?
body: BraceStmt
var: VarDecl
TupleElementExpr:
_extends: Expr
_children:
sub_expr: Expr
index: int
TupleExpr:
_extends: Expr
_children:
elements: Expr*
TypeExpr:
_extends: Expr
_children:
type_repr: TypeRepr?
UnresolvedDeclRefExpr:
_extends: Expr
name: string?
UnresolvedDotExpr:
_extends: Expr
_children:
base: Expr
name: string
UnresolvedMemberExpr:
_extends: Expr
name: string
_pragma: qltest_skip # we should really never extract these
UnresolvedPatternExpr:
_extends: Expr
_children:
sub_pattern: Pattern
UnresolvedSpecializeExpr:
_extends: Expr
_pragma: qltest_skip # we should really never extract these
VarargExpansionExpr:
_extends: Expr
_children:
sub_expr: Expr
AnyPattern:
_extends: Pattern
BindingPattern:
_extends: Pattern
_children:
sub_pattern: Pattern
BoolPattern:
_extends: Pattern
value: boolean
EnumElementPattern:
_extends: Pattern
element: EnumElementDecl
_children:
sub_pattern: Pattern?
ExprPattern:
_extends: Pattern
_children:
sub_expr: Expr
IsPattern:
_extends: Pattern
_children:
cast_type_repr: TypeRepr?
sub_pattern: Pattern?
NamedPattern:
_extends: Pattern
name: string
OptionalSomePattern:
_extends: Pattern
_children:
sub_pattern: Pattern
ParenPattern:
_extends: Pattern
_children:
sub_pattern: Pattern
TuplePattern:
_extends: Pattern
_children:
elements: Pattern*
TypedPattern:
_extends: Pattern
_children:
sub_pattern: Pattern
type_repr: TypeRepr?
BraceStmt:
_extends: Stmt
_children:
elements: AstNode*
BreakStmt:
_extends: Stmt
target_name: string?
target: Stmt?
CaseStmt:
_extends: Stmt
_children:
body: Stmt
labels: CaseLabelItem*
variables: VarDecl*
CaseLabelItem:
_extends: AstNode
_children:
pattern: Pattern
guard: Expr?
_dir: stmt
ContinueStmt:
_extends: Stmt
target_name: string?
target: Stmt?
DeferStmt:
_extends: Stmt
_children:
body: BraceStmt
FailStmt:
_extends: Stmt
FallthroughStmt:
_extends: Stmt
fallthrough_source: CaseStmt
fallthrough_dest: CaseStmt
LabeledStmt:
_extends: Stmt
label: string?
PoundAssertStmt:
_extends: Stmt
ReturnStmt:
_extends: Stmt
_children:
result: Expr?
ThrowStmt:
_extends: Stmt
_children:
sub_expr: Expr
YieldStmt:
_extends: Stmt
_children:
results: Expr*
BoundGenericType:
_extends: NominalOrBoundGenericNominalType
arg_types: Type*
NominalType:
_extends: NominalOrBoundGenericNominalType
BuiltinIntegerLiteralType:
_extends: AnyBuiltinIntegerType
BuiltinIntegerType:
_extends: AnyBuiltinIntegerType
_pragma: qltest_uncollapse_hierarchy
width: int?
NestedArchetypeType:
_extends: ArchetypeType
parent: ArchetypeType
associated_type_declaration: AssociatedTypeDecl
SequenceArchetypeType:
_extends: ArchetypeType
OpaqueTypeArchetypeType:
_extends: ArchetypeType
OpenedArchetypeType:
_extends: ArchetypeType
PrimaryArchetypeType:
_extends: ArchetypeType
DictionaryType:
_extends: SyntaxSugarType
key_type: Type
value_type: Type
UnarySyntaxSugarType:
_extends: SyntaxSugarType
base_type: Type
InfixOperatorDecl:
_extends: OperatorDecl
precedence_group: PrecedenceGroupDecl?
PostfixOperatorDecl:
_extends: OperatorDecl
PrefixOperatorDecl:
_extends: OperatorDecl
AbstractFunctionDecl:
_extends:
- GenericContext
- ValueDecl
- Callable
name: string
AbstractStorageDecl:
_extends: ValueDecl
_children:
accessor_decls: AccessorDecl*
EnumElementDecl:
_extends: ValueDecl
name: string
_children:
params: ParamDecl*
TypeDecl:
_extends: ValueDecl
name: string
base_types: Type*
AutoClosureExpr:
_extends: AbstractClosureExpr
ClosureExpr:
_extends: AbstractClosureExpr
ForceTryExpr:
_extends: AnyTryExpr
OptionalTryExpr:
_extends: AnyTryExpr
TryExpr:
_extends: AnyTryExpr
#MethodCallExpr:
# _extends: ApplyExpr
# _synth:
# from: CallExpr
# qualifier: Expr
BinaryExpr:
_extends: ApplyExpr
CallExpr:
_extends: ApplyExpr
PostfixUnaryExpr:
_extends: ApplyExpr
PrefixUnaryExpr:
_extends: ApplyExpr
SelfApplyExpr:
_extends: ApplyExpr
_children:
base: Expr
ArrayExpr:
_extends: CollectionExpr
_children:
elements: Expr*
DictionaryExpr:
_extends: CollectionExpr
_children:
elements: Expr*
CheckedCastExpr:
_extends: ExplicitCastExpr
CoerceExpr:
_extends: ExplicitCastExpr
AwaitExpr:
_extends: IdentityExpr
DotSelfExpr:
_extends: IdentityExpr
ParenExpr:
_extends: IdentityExpr
UnresolvedMemberChainResultExpr:
_extends: IdentityExpr
AnyHashableErasureExpr:
_extends: ImplicitConversionExpr
ArchetypeToSuperExpr:
_extends: ImplicitConversionExpr
ArrayToPointerExpr:
_extends: ImplicitConversionExpr
BridgeFromObjCExpr:
_extends: ImplicitConversionExpr
_pragma: qltest_skip # to be tested in integration tests
BridgeToObjCExpr:
_extends: ImplicitConversionExpr
_pragma: qltest_skip # to be tested in integration tests
ClassMetatypeToObjectExpr:
_extends: ImplicitConversionExpr
CollectionUpcastConversionExpr:
_extends: ImplicitConversionExpr
ConditionalBridgeFromObjCExpr:
_extends: ImplicitConversionExpr
_pragma: qltest_skip # to be tested in integration tests
CovariantFunctionConversionExpr:
_extends: ImplicitConversionExpr
CovariantReturnConversionExpr:
_extends: ImplicitConversionExpr
DerivedToBaseExpr:
_extends: ImplicitConversionExpr
DestructureTupleExpr:
_extends: ImplicitConversionExpr
DifferentiableFunctionExpr:
_extends: ImplicitConversionExpr
DifferentiableFunctionExtractOriginalExpr:
_extends: ImplicitConversionExpr
ErasureExpr:
_extends: ImplicitConversionExpr
ExistentialMetatypeToObjectExpr:
_extends: ImplicitConversionExpr
ForeignObjectConversionExpr:
_extends: ImplicitConversionExpr
FunctionConversionExpr:
_extends: ImplicitConversionExpr
InOutToPointerExpr:
_extends: ImplicitConversionExpr
InjectIntoOptionalExpr:
_extends: ImplicitConversionExpr
LinearFunctionExpr:
_extends: ImplicitConversionExpr
LinearFunctionExtractOriginalExpr:
_extends: ImplicitConversionExpr
LinearToDifferentiableFunctionExpr:
_extends: ImplicitConversionExpr
LoadExpr:
_extends: ImplicitConversionExpr
MetatypeConversionExpr:
_extends: ImplicitConversionExpr
PointerToPointerExpr:
_extends: ImplicitConversionExpr
ProtocolMetatypeToObjectExpr:
_extends: ImplicitConversionExpr
StringToPointerExpr:
_extends: ImplicitConversionExpr
UnderlyingToOpaqueExpr:
_extends: ImplicitConversionExpr
UnevaluatedInstanceExpr:
_extends: ImplicitConversionExpr
UnresolvedTypeConversionExpr:
_extends: ImplicitConversionExpr
BuiltinLiteralExpr:
_extends: LiteralExpr
InterpolatedStringLiteralExpr:
_extends: LiteralExpr
interpolation_expr: OpaqueValueExpr?
_children:
interpolation_count_expr: Expr?
literal_capacity_expr: Expr?
appending_expr: TapExpr?
RegexLiteralExpr:
_extends: LiteralExpr
NilLiteralExpr:
_extends: LiteralExpr
ObjectLiteralExpr:
_extends: LiteralExpr
DynamicLookupExpr:
_extends: LookupExpr
MemberRefExpr:
_extends: LookupExpr
has_direct_to_storage_semantics: predicate
has_direct_to_implementation_semantics: predicate
has_ordinary_semantics: predicate
MethodRefExpr:
_extends: LookupExpr
_synth:
from: DotSyntaxCallExpr
SubscriptExpr:
_extends:
- LookupExpr
_children:
arguments: Argument*
has_direct_to_storage_semantics: predicate
has_direct_to_implementation_semantics: predicate
has_ordinary_semantics: predicate
OverloadedDeclRefExpr:
_extends: OverloadSetRefExpr
DoCatchStmt:
_extends: LabeledStmt
_children:
body: Stmt
catches: CaseStmt*
DoStmt:
_extends: LabeledStmt
_children:
body: BraceStmt
ForEachStmt:
_extends: LabeledStmt
_children:
pattern: Pattern
sequence: Expr
where: Expr?
body: BraceStmt
LabeledConditionalStmt:
_extends: LabeledStmt
_children:
condition: StmtCondition
StmtCondition:
_extends: AstNode
_children:
elements: ConditionElement*
_dir: stmt
RepeatWhileStmt:
_extends: LabeledStmt
_children:
condition: Expr
body: Stmt
SwitchStmt:
_extends: LabeledStmt
_children:
expr: Expr
cases: CaseStmt*
BoundGenericClassType:
_extends: BoundGenericType
BoundGenericEnumType:
_extends: BoundGenericType
BoundGenericStructType:
_extends: BoundGenericType
ClassType:
_extends: NominalType
EnumType:
_extends: NominalType
ProtocolType:
_extends: NominalType
StructType:
_extends: NominalType
ArraySliceType:
_extends: UnarySyntaxSugarType
OptionalType:
_extends: UnarySyntaxSugarType
VariadicSequenceType:
_extends: UnarySyntaxSugarType
ConstructorDecl:
_extends: AbstractFunctionDecl
DestructorDecl:
_extends: AbstractFunctionDecl
FuncDecl:
_extends: AbstractFunctionDecl
SubscriptDecl:
_extends:
- AbstractStorageDecl
- GenericContext
_children:
params: ParamDecl*
element_type: Type
VarDecl:
_extends: AbstractStorageDecl
name: string
type: Type
attached_property_wrapper_type: Type?
parent_pattern: Pattern?
parent_initializer: Expr?
AbstractTypeParamDecl:
_extends: TypeDecl
GenericContext:
generic_type_params: GenericTypeParamDecl*
GenericTypeDecl:
_extends:
- GenericContext
- TypeDecl
ModuleDecl:
_extends: TypeDecl
is_builtin_module: predicate
is_system_module: predicate
ConstructorRefCallExpr:
_extends: SelfApplyExpr
DotSyntaxCallExpr:
_extends: SelfApplyExpr
ConditionalCheckedCastExpr:
_extends: CheckedCastExpr
ForcedCheckedCastExpr:
_extends: CheckedCastExpr
IsExpr:
_extends: CheckedCastExpr
BooleanLiteralExpr:
_extends: BuiltinLiteralExpr
value: boolean
MagicIdentifierLiteralExpr:
_extends: BuiltinLiteralExpr
kind: string
NumberLiteralExpr:
_extends: BuiltinLiteralExpr
StringLiteralExpr:
_extends: BuiltinLiteralExpr
value: string
DynamicMemberRefExpr:
_extends: DynamicLookupExpr
DynamicSubscriptExpr:
_extends: DynamicLookupExpr
GuardStmt:
_extends: LabeledConditionalStmt
_children:
body: BraceStmt
IfStmt:
_extends: LabeledConditionalStmt
_children:
then: Stmt
else: Stmt?
WhileStmt:
_extends: LabeledConditionalStmt
_children:
body: Stmt
AccessorDecl:
_extends: FuncDecl
is_getter: predicate
is_setter: predicate
is_will_set: predicate
is_did_set: predicate
ConcreteFuncDecl:
_extends: FuncDecl
ConcreteVarDecl:
_extends: VarDecl
introducer_int: int
ParamDecl:
_extends: VarDecl
is_inout: predicate
AssociatedTypeDecl:
_extends: AbstractTypeParamDecl
GenericTypeParamDecl:
_extends: AbstractTypeParamDecl
OpaqueTypeDecl:
_extends: GenericTypeDecl
TypeAliasDecl:
_extends: GenericTypeDecl
FloatLiteralExpr:
_extends: NumberLiteralExpr
string_value: string
IntegerLiteralExpr:
_extends: NumberLiteralExpr
string_value: string