File tree Expand file tree Collapse file tree 8 files changed +24
-8
lines changed
Expand file tree Collapse file tree 8 files changed +24
-8
lines changed Original file line number Diff line number Diff line change @@ -471,6 +471,7 @@ OptionalEvaluationExpr:
471471 sub_expr : Expr
472472
473473OtherConstructorDeclRefExpr :
474+ constructor_decl : ConstructorDecl
474475 _extends : Expr
475476
476477OverloadSetRefExpr :
Original file line number Diff line number Diff line change @@ -518,13 +518,21 @@ class ExprVisitor : public AstVisitorBase<ExprVisitor> {
518518 auto label = dispatcher_.assignNewLabel (expr);
519519 assert (expr->getBase () && " KeyPathApplicationExpr has getBase()" );
520520 assert (expr->getKeyPath () && " KeyPathApplicationExpr has getKeyPath()" );
521-
521+
522522 auto baseLabel = dispatcher_.fetchLabel (expr->getBase ());
523523 auto keyPathLabel = dispatcher_.fetchLabel (expr->getKeyPath ());
524524
525525 dispatcher_.emit (KeyPathApplicationExprsTrap{label, baseLabel, keyPathLabel});
526526 }
527527
528+ void visitOtherConstructorDeclRefExpr (swift::OtherConstructorDeclRefExpr* expr) {
529+ auto label = dispatcher_.assignNewLabel (expr);
530+ assert (expr->getDecl () && " OtherConstructorDeclRefExpr has getDecl()" );
531+
532+ auto ctorLabel = dispatcher_.fetchLabel (expr->getDecl ());
533+ dispatcher_.emit (OtherConstructorDeclRefExprsTrap{label, ctorLabel});
534+ }
535+
528536 private:
529537 TrapLabel<ArgumentTag> emitArgument (const swift::Argument& arg) {
530538 auto argLabel = dispatcher_.createLabel <ArgumentTag>();
Original file line number Diff line number Diff line change @@ -1292,6 +1292,10 @@ module Exprs {
12921292 DeclRefExprLValueTree ( ) { isLValue ( ast ) }
12931293 }
12941294
1295+ class OtherConstructorDeclRefTree extends AstLeafTree {
1296+ override OtherConstructorDeclRefExpr ast ;
1297+ }
1298+
12951299 abstract class DeclRefExprRValueTree extends AstControlFlowTree {
12961300 override DeclRefExpr ast ;
12971301
Original file line number Diff line number Diff line change 11// generated by codegen/codegen.py
2+ import codeql.swift.elements.decl.ConstructorDecl
23import codeql.swift.elements.expr.Expr
34
45class OtherConstructorDeclRefExprBase extends @other_constructor_decl_ref_expr, Expr {
56 override string getAPrimaryQlClass ( ) { result = "OtherConstructorDeclRefExpr" }
7+
8+ ConstructorDecl getConstructorDecl ( ) {
9+ exists ( ConstructorDecl x |
10+ other_constructor_decl_ref_exprs ( this , x ) and
11+ result = x .resolve ( )
12+ )
13+ }
614}
Original file line number Diff line number Diff line change @@ -975,7 +975,8 @@ optional_evaluation_exprs(
975975);
976976
977977other_constructor_decl_ref_exprs(
978- unique int id: @other_constructor_decl_ref_expr
978+ unique int id: @other_constructor_decl_ref_expr,
979+ int constructor_decl: @constructor_decl ref
979980);
980981
981982@overload_set_ref_expr =
Original file line number Diff line number Diff line change 162162| expressions.swift:79:5:79:11 | call to ... |
163163| expressions.swift:79:5:79:21 | call to ... |
164164| expressions.swift:79:5:79:21 | self = ... |
165- | expressions.swift:79:11:79:11 | TBD (OtherConstructorDeclRefExpr) |
166165| expressions.swift:79:11:79:11 | call to ... |
167166| expressions.swift:79:19:79:19 | 22 |
168167| expressions.swift:83:15:83:15 | Derived.Type |
Original file line number Diff line number Diff line change @@ -4944,7 +4944,6 @@ cfg.swift:
49444944
49454945# 378| init
49464946#-----| -> call to ...
4947- #-----| -> TBD (OtherConstructorDeclRefExpr)
49484947
49494948# 379| super
49504949#-----| -> call to ...
@@ -4961,9 +4960,6 @@ cfg.swift:
49614960# 379| call to ...
49624961#-----| -> super
49634962
4964- # 379| TBD (OtherConstructorDeclRefExpr)
4965- #-----| -> super
4966-
49674963# 379| 0
49684964#-----| -> call to ...
49694965
Original file line number Diff line number Diff line change 566566| expressions.swift:78:3:80:3 | init | ConstructorDecl | expressions.swift:78:10:80:3 | { ... } | BraceStmt |
567567| expressions.swift:78:10:80:3 | { ... } | BraceStmt | expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr |
568568| expressions.swift:78:10:80:3 | { ... } | BraceStmt | expressions.swift:80:3:80:3 | return | ReturnStmt |
569- | expressions.swift:79:5:79:11 | call to ... | DotSyntaxCallExpr | expressions.swift:79:11:79:11 | TBD (OtherConstructorDeclRefExpr) | OtherConstructorDeclRefExpr |
570569| expressions.swift:79:5:79:11 | call to ... | DotSyntaxCallExpr | expressions.swift:79:11:79:11 | call to ... | OtherConstructorDeclRefExpr |
571570| expressions.swift:79:5:79:21 | call to ... | CallExpr | expressions.swift:79:5:79:11 | call to ... | DotSyntaxCallExpr |
572571| expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr | expressions.swift:78:3:78:3 | self | ParamDecl |
You can’t perform that action at this time.
0 commit comments