Swift: Autogenerate and accept test changes.

This commit is contained in:
Mathias Vorreiter Pedersen
2022-06-14 20:39:18 +01:00
parent 4595a9cf0b
commit 6c96f71d0c
4 changed files with 31 additions and 1 deletions

View File

@@ -18,6 +18,8 @@ Element getAnImmediateChild(Element e) {
(
none()
or
abstract_closure_expr_params(e, _, x)
or
abstract_function_decl_bodies(e, x)
or
abstract_function_decl_params(e, _, x)

View File

@@ -1,4 +1,16 @@
// generated by codegen/codegen.py
import codeql.swift.elements.expr.Expr
import codeql.swift.elements.decl.ParamDecl
class AbstractClosureExprBase extends @abstract_closure_expr, Expr { }
class AbstractClosureExprBase extends @abstract_closure_expr, Expr {
ParamDecl getParam(int index) {
exists(ParamDecl x |
abstract_closure_expr_params(this, index, x) and
result = x.resolve()
)
}
ParamDecl getAParam() { result = getParam(_) }
int getNumberOfParams() { result = count(getAParam()) }
}

View File

@@ -659,6 +659,13 @@ value_decls(
| @closure_expr
;
#keyset[id, index]
abstract_closure_expr_params(
int id: @abstract_closure_expr ref,
int index: int ref,
int param: @param_decl ref
);
@any_try_expr =
@force_try_expr
| @optional_try_expr

View File

@@ -463,6 +463,8 @@
| expressions.swift:41:1:43:1 | { ... } | TopLevelCodeDecl | expressions.swift:41:1:43:1 | { ... } | BraceStmt |
| expressions.swift:41:10:43:1 | { ... } | BraceStmt | expressions.swift:42:5:42:16 | return ... | ReturnStmt |
| expressions.swift:41:10:43:1 | { ... } | ClosureExpr | expressions.swift:41:10:43:1 | { ... } | BraceStmt |
| expressions.swift:41:10:43:1 | { ... } | ClosureExpr | expressions.swift:41:13:41:16 | x | ParamDecl |
| expressions.swift:41:10:43:1 | { ... } | ClosureExpr | expressions.swift:41:21:41:24 | y | ParamDecl |
| expressions.swift:42:5:42:16 | return ... | ReturnStmt | expressions.swift:42:12:42:16 | ... call to + ... | BinaryExpr |
| expressions.swift:42:12:42:16 | ... call to + ... | BinaryExpr | expressions.swift:42:14:42:14 | call to + | DotSyntaxCallExpr |
| expressions.swift:42:14:42:14 | Int.Type | TypeExpr | expressions.swift:42:14:42:14 | FixedTypeRepr | FixedTypeRepr |
@@ -472,6 +474,8 @@
| expressions.swift:44:1:46:1 | { ... } | TopLevelCodeDecl | expressions.swift:44:1:46:1 | { ... } | BraceStmt |
| expressions.swift:44:10:46:1 | { ... } | BraceStmt | expressions.swift:45:5:45:16 | return ... | ReturnStmt |
| expressions.swift:44:10:46:1 | { ... } | ClosureExpr | expressions.swift:44:10:46:1 | { ... } | BraceStmt |
| expressions.swift:44:10:46:1 | { ... } | ClosureExpr | expressions.swift:44:12:44:12 | x | ParamDecl |
| expressions.swift:44:10:46:1 | { ... } | ClosureExpr | expressions.swift:44:15:44:15 | y | ParamDecl |
| expressions.swift:45:5:45:16 | return ... | ReturnStmt | expressions.swift:45:12:45:16 | ... call to + ... | BinaryExpr |
| expressions.swift:45:12:45:16 | ... call to + ... | BinaryExpr | expressions.swift:45:14:45:14 | call to + | DotSyntaxCallExpr |
| expressions.swift:45:14:45:14 | Int.Type | TypeExpr | expressions.swift:45:14:45:14 | FixedTypeRepr | FixedTypeRepr |
@@ -480,6 +484,8 @@
| expressions.swift:47:1:47:27 | { ... } | BraceStmt | expressions.swift:47:1:47:27 | call to closured | CallExpr |
| expressions.swift:47:1:47:27 | { ... } | TopLevelCodeDecl | expressions.swift:47:1:47:27 | { ... } | BraceStmt |
| expressions.swift:47:10:47:27 | { ... } | BraceStmt | expressions.swift:47:12:47:24 | return ... | ReturnStmt |
| expressions.swift:47:10:47:27 | { ... } | ClosureExpr | expressions.swift:47:10:47:10 | $0 | ParamDecl |
| expressions.swift:47:10:47:27 | { ... } | ClosureExpr | expressions.swift:47:10:47:10 | $1 | ParamDecl |
| expressions.swift:47:10:47:27 | { ... } | ClosureExpr | expressions.swift:47:10:47:27 | { ... } | BraceStmt |
| expressions.swift:47:12:47:24 | return ... | ReturnStmt | expressions.swift:47:19:47:24 | ... call to + ... | BinaryExpr |
| expressions.swift:47:19:47:24 | ... call to + ... | BinaryExpr | expressions.swift:47:22:47:22 | call to + | DotSyntaxCallExpr |
@@ -489,6 +495,8 @@
| expressions.swift:48:1:48:20 | { ... } | BraceStmt | expressions.swift:48:1:48:20 | call to closured | CallExpr |
| expressions.swift:48:1:48:20 | { ... } | TopLevelCodeDecl | expressions.swift:48:1:48:20 | { ... } | BraceStmt |
| expressions.swift:48:10:48:20 | { ... } | BraceStmt | expressions.swift:48:12:48:17 | return ... | ReturnStmt |
| expressions.swift:48:10:48:20 | { ... } | ClosureExpr | expressions.swift:48:10:48:10 | $0 | ParamDecl |
| expressions.swift:48:10:48:20 | { ... } | ClosureExpr | expressions.swift:48:10:48:10 | $1 | ParamDecl |
| expressions.swift:48:10:48:20 | { ... } | ClosureExpr | expressions.swift:48:10:48:20 | { ... } | BraceStmt |
| expressions.swift:48:12:48:17 | ... call to + ... | BinaryExpr | expressions.swift:48:15:48:15 | call to + | DotSyntaxCallExpr |
| expressions.swift:48:12:48:17 | return ... | ReturnStmt | expressions.swift:48:12:48:17 | ... call to + ... | BinaryExpr |
@@ -523,6 +531,7 @@
| expressions.swift:60:23:60:23 | (Int) ... | LoadExpr | expressions.swift:60:23:60:23 | myNumber | DeclRefExpr |
| expressions.swift:60:33:60:63 | ((UnsafePointer<Int>) throws -> ()) ... | FunctionConversionExpr | expressions.swift:60:33:60:63 | { ... } | ClosureExpr |
| expressions.swift:60:33:60:63 | { ... } | BraceStmt | expressions.swift:60:35:60:61 | return ... | ReturnStmt |
| expressions.swift:60:33:60:63 | { ... } | ClosureExpr | expressions.swift:60:33:60:33 | $0 | ParamDecl |
| expressions.swift:60:33:60:63 | { ... } | ClosureExpr | expressions.swift:60:33:60:63 | { ... } | BraceStmt |
| expressions.swift:60:35:60:61 | call to unsafeFunction | CallExpr | expressions.swift:60:35:60:35 | unsafeFunction | DeclRefExpr |
| expressions.swift:60:35:60:61 | return ... | ReturnStmt | expressions.swift:60:35:60:61 | call to unsafeFunction | CallExpr |