Skip to content

Commit 8d2bd66

Browse files
authored
Merge pull request github#8861 from MathiasVP/update-schema
Swift: Update `schema.yml` and regenerate files
2 parents d5fcb43 + 8869038 commit 8d2bd66

19 files changed

+292
-26
lines changed

swift/codegen/schema.yml

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@ Locatable:
2323

2424
Location:
2525
file: File
26-
begin_line: int
27-
begin_column: int
26+
start_line: int
27+
start_column: int
2828
end_line: int
2929
end_column: int
3030

@@ -312,9 +312,12 @@ AssignExpr:
312312

313313
BindOptionalExpr:
314314
_extends: Expr
315+
sub_expr: Expr
315316

316317
CaptureListExpr:
317318
_extends: Expr
319+
binding_decls: PatternBindingDecl*
320+
closure_body: ClosureExpr
318321

319322
CodeCompletionExpr:
320323
_extends: Expr
@@ -338,15 +341,21 @@ DiscardAssignmentExpr:
338341

339342
DotSyntaxBaseIgnoredExpr:
340343
_extends: Expr
344+
qualifier: Expr
345+
sub_expr: Expr
341346

342347
DynamicTypeExpr:
343348
_extends: Expr
349+
base_expr: Expr
344350

345351
EditorPlaceholderExpr:
346352
_extends: Expr
347353

348354
EnumIsCaseExpr:
349355
_extends: Expr
356+
sub_expr: Expr
357+
type_repr: TypeRepr
358+
element: EnumElementDecl
350359

351360
ErrorExpr:
352361
_extends: Expr
@@ -365,6 +374,9 @@ IdentityExpr:
365374

366375
IfExpr:
367376
_extends: Expr
377+
condition: Expr
378+
then_expr: Expr
379+
else_expr: Expr
368380

369381
ImplicitConversionExpr:
370382
_extends: Expr
@@ -387,6 +399,7 @@ KeyPathExpr:
387399

388400
LazyInitializerExpr:
389401
_extends: Expr
402+
sub_expr: Expr
390403

391404
LiteralExpr:
392405
_extends: Expr
@@ -396,21 +409,31 @@ LookupExpr:
396409

397410
MakeTemporarilyEscapableExpr:
398411
_extends: Expr
412+
escaping_closure: OpaqueValueExpr
413+
nonescaping_closure: Expr
414+
sub_expr: Expr
399415

400416
ObjCSelectorExpr:
401417
_extends: Expr
418+
sub_expr: Expr
419+
method: AbstractFunctionDecl
402420

403421
OneWayExpr:
404422
_extends: Expr
423+
sub_expr: Expr
405424

406425
OpaqueValueExpr:
407426
_extends: Expr
408427

409428
OpenExistentialExpr:
410429
_extends: Expr
430+
sub_expr: Expr
431+
existential: Expr
432+
opaque_expr: OpaqueValueExpr
411433

412434
OptionalEvaluationExpr:
413435
_extends: Expr
436+
sub_expr: Expr
414437

415438
OtherConstructorDeclRefExpr:
416439
_extends: Expr
@@ -423,12 +446,15 @@ PropertyWrapperValuePlaceholderExpr:
423446

424447
RebindSelfInConstructorExpr:
425448
_extends: Expr
449+
sub_expr: Expr
450+
self: VarDecl
426451

427452
SequenceExpr:
428453
_extends: Expr
429454

430455
SuperRefExpr:
431456
_extends: Expr
457+
self: VarDecl
432458

433459
TapExpr:
434460
_extends: Expr
@@ -438,14 +464,16 @@ TapExpr:
438464

439465
TupleElementExpr:
440466
_extends: Expr
467+
sub_expr: Expr
468+
index: int
441469

442470
TupleExpr:
443471
_extends: Expr
444472
elements: Expr*
445473

446474
TypeExpr:
447475
_extends: Expr
448-
type_repr: UnknownAstNode?
476+
type_repr: TypeRepr?
449477

450478
UnresolvedDeclRefExpr:
451479
_extends: Expr

swift/ql/lib/codeql/swift/generated/Location.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,9 @@ class LocationBase extends @location, Element {
1212
)
1313
}
1414

15-
int getBeginLine() { locations(this, _, result, _, _, _) }
15+
int getStartLine() { locations(this, _, result, _, _, _) }
1616

17-
int getBeginColumn() { locations(this, _, _, result, _, _) }
17+
int getStartColumn() { locations(this, _, _, result, _, _) }
1818

1919
int getEndLine() { locations(this, _, _, _, result, _) }
2020

swift/ql/lib/codeql/swift/generated/expr/BindOptionalExpr.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@ import codeql.swift.elements.expr.Expr
33

44
class BindOptionalExprBase extends @bind_optional_expr, Expr {
55
override string toString() { result = "BindOptionalExpr" }
6+
7+
Expr getSubExpr() {
8+
exists(Expr x |
9+
bind_optional_exprs(this, x) and
10+
result = x.resolve()
11+
)
12+
}
613
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,26 @@
11
// generated by codegen/codegen.py
2+
import codeql.swift.elements.expr.ClosureExpr
23
import codeql.swift.elements.expr.Expr
4+
import codeql.swift.elements.decl.PatternBindingDecl
35

46
class CaptureListExprBase extends @capture_list_expr, Expr {
57
override string toString() { result = "CaptureListExpr" }
8+
9+
PatternBindingDecl getBindingDecl(int index) {
10+
exists(PatternBindingDecl x |
11+
capture_list_expr_binding_decls(this, index, x) and
12+
result = x.resolve()
13+
)
14+
}
15+
16+
PatternBindingDecl getABindingDecl() { result = getBindingDecl(_) }
17+
18+
int getNumberOfBindingDecls() { result = count(getABindingDecl()) }
19+
20+
ClosureExpr getClosureBody() {
21+
exists(ClosureExpr x |
22+
capture_list_exprs(this, x) and
23+
result = x.resolve()
24+
)
25+
}
626
}

swift/ql/lib/codeql/swift/generated/expr/DotSyntaxBaseIgnoredExpr.qll

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,18 @@ import codeql.swift.elements.expr.Expr
33

44
class DotSyntaxBaseIgnoredExprBase extends @dot_syntax_base_ignored_expr, Expr {
55
override string toString() { result = "DotSyntaxBaseIgnoredExpr" }
6+
7+
Expr getQualifier() {
8+
exists(Expr x |
9+
dot_syntax_base_ignored_exprs(this, x, _) and
10+
result = x.resolve()
11+
)
12+
}
13+
14+
Expr getSubExpr() {
15+
exists(Expr x |
16+
dot_syntax_base_ignored_exprs(this, _, x) and
17+
result = x.resolve()
18+
)
19+
}
620
}

swift/ql/lib/codeql/swift/generated/expr/DynamicTypeExpr.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@ import codeql.swift.elements.expr.Expr
33

44
class DynamicTypeExprBase extends @dynamic_type_expr, Expr {
55
override string toString() { result = "DynamicTypeExpr" }
6+
7+
Expr getBaseExpr() {
8+
exists(Expr x |
9+
dynamic_type_exprs(this, x) and
10+
result = x.resolve()
11+
)
12+
}
613
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,29 @@
11
// generated by codegen/codegen.py
2+
import codeql.swift.elements.decl.EnumElementDecl
23
import codeql.swift.elements.expr.Expr
4+
import codeql.swift.elements.typerepr.TypeRepr
35

46
class EnumIsCaseExprBase extends @enum_is_case_expr, Expr {
57
override string toString() { result = "EnumIsCaseExpr" }
8+
9+
Expr getSubExpr() {
10+
exists(Expr x |
11+
enum_is_case_exprs(this, x, _, _) and
12+
result = x.resolve()
13+
)
14+
}
15+
16+
TypeRepr getTypeRepr() {
17+
exists(TypeRepr x |
18+
enum_is_case_exprs(this, _, x, _) and
19+
result = x.resolve()
20+
)
21+
}
22+
23+
EnumElementDecl getElement() {
24+
exists(EnumElementDecl x |
25+
enum_is_case_exprs(this, _, _, x) and
26+
result = x.resolve()
27+
)
28+
}
629
}

swift/ql/lib/codeql/swift/generated/expr/IfExpr.qll

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,25 @@ import codeql.swift.elements.expr.Expr
33

44
class IfExprBase extends @if_expr, Expr {
55
override string toString() { result = "IfExpr" }
6+
7+
Expr getCondition() {
8+
exists(Expr x |
9+
if_exprs(this, x, _, _) and
10+
result = x.resolve()
11+
)
12+
}
13+
14+
Expr getThenExpr() {
15+
exists(Expr x |
16+
if_exprs(this, _, x, _) and
17+
result = x.resolve()
18+
)
19+
}
20+
21+
Expr getElseExpr() {
22+
exists(Expr x |
23+
if_exprs(this, _, _, x) and
24+
result = x.resolve()
25+
)
26+
}
627
}

swift/ql/lib/codeql/swift/generated/expr/LazyInitializerExpr.qll

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,11 @@ import codeql.swift.elements.expr.Expr
33

44
class LazyInitializerExprBase extends @lazy_initializer_expr, Expr {
55
override string toString() { result = "LazyInitializerExpr" }
6+
7+
Expr getSubExpr() {
8+
exists(Expr x |
9+
lazy_initializer_exprs(this, x) and
10+
result = x.resolve()
11+
)
12+
}
613
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,28 @@
11
// generated by codegen/codegen.py
22
import codeql.swift.elements.expr.Expr
3+
import codeql.swift.elements.expr.OpaqueValueExpr
34

45
class MakeTemporarilyEscapableExprBase extends @make_temporarily_escapable_expr, Expr {
56
override string toString() { result = "MakeTemporarilyEscapableExpr" }
7+
8+
OpaqueValueExpr getEscapingClosure() {
9+
exists(OpaqueValueExpr x |
10+
make_temporarily_escapable_exprs(this, x, _, _) and
11+
result = x.resolve()
12+
)
13+
}
14+
15+
Expr getNonescapingClosure() {
16+
exists(Expr x |
17+
make_temporarily_escapable_exprs(this, _, x, _) and
18+
result = x.resolve()
19+
)
20+
}
21+
22+
Expr getSubExpr() {
23+
exists(Expr x |
24+
make_temporarily_escapable_exprs(this, _, _, x) and
25+
result = x.resolve()
26+
)
27+
}
628
}

0 commit comments

Comments
 (0)