mirror of
https://github.com/github/codeql.git
synced 2025-12-24 04:36:35 +01:00
Merge pull request #9546 from github/alexdenisov/extract-OtherConstructorDeclRefExpr
Swift: extract OtherConstructorDeclRefExpr
This commit is contained in:
@@ -471,6 +471,7 @@ OptionalEvaluationExpr:
|
||||
sub_expr: Expr
|
||||
|
||||
OtherConstructorDeclRefExpr:
|
||||
constructor_decl: ConstructorDecl
|
||||
_extends: Expr
|
||||
|
||||
OverloadSetRefExpr:
|
||||
|
||||
@@ -518,13 +518,21 @@ class ExprVisitor : public AstVisitorBase<ExprVisitor> {
|
||||
auto label = dispatcher_.assignNewLabel(expr);
|
||||
assert(expr->getBase() && "KeyPathApplicationExpr has getBase()");
|
||||
assert(expr->getKeyPath() && "KeyPathApplicationExpr has getKeyPath()");
|
||||
|
||||
|
||||
auto baseLabel = dispatcher_.fetchLabel(expr->getBase());
|
||||
auto keyPathLabel = dispatcher_.fetchLabel(expr->getKeyPath());
|
||||
|
||||
dispatcher_.emit(KeyPathApplicationExprsTrap{label, baseLabel, keyPathLabel});
|
||||
}
|
||||
|
||||
void visitOtherConstructorDeclRefExpr(swift::OtherConstructorDeclRefExpr* expr) {
|
||||
auto label = dispatcher_.assignNewLabel(expr);
|
||||
assert(expr->getDecl() && "OtherConstructorDeclRefExpr has getDecl()");
|
||||
|
||||
auto ctorLabel = dispatcher_.fetchLabel(expr->getDecl());
|
||||
dispatcher_.emit(OtherConstructorDeclRefExprsTrap{label, ctorLabel});
|
||||
}
|
||||
|
||||
private:
|
||||
TrapLabel<ArgumentTag> emitArgument(const swift::Argument& arg) {
|
||||
auto argLabel = dispatcher_.createLabel<ArgumentTag>();
|
||||
|
||||
@@ -1292,6 +1292,10 @@ module Exprs {
|
||||
DeclRefExprLValueTree() { isLValue(ast) }
|
||||
}
|
||||
|
||||
class OtherConstructorDeclRefTree extends AstLeafTree {
|
||||
override OtherConstructorDeclRefExpr ast;
|
||||
}
|
||||
|
||||
abstract class DeclRefExprRValueTree extends AstControlFlowTree {
|
||||
override DeclRefExpr ast;
|
||||
|
||||
|
||||
@@ -1,6 +1,14 @@
|
||||
// generated by codegen/codegen.py
|
||||
import codeql.swift.elements.decl.ConstructorDecl
|
||||
import codeql.swift.elements.expr.Expr
|
||||
|
||||
class OtherConstructorDeclRefExprBase extends @other_constructor_decl_ref_expr, Expr {
|
||||
override string getAPrimaryQlClass() { result = "OtherConstructorDeclRefExpr" }
|
||||
|
||||
ConstructorDecl getConstructorDecl() {
|
||||
exists(ConstructorDecl x |
|
||||
other_constructor_decl_ref_exprs(this, x) and
|
||||
result = x.resolve()
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -975,7 +975,8 @@ optional_evaluation_exprs(
|
||||
);
|
||||
|
||||
other_constructor_decl_ref_exprs(
|
||||
unique int id: @other_constructor_decl_ref_expr
|
||||
unique int id: @other_constructor_decl_ref_expr,
|
||||
int constructor_decl: @constructor_decl ref
|
||||
);
|
||||
|
||||
@overload_set_ref_expr =
|
||||
|
||||
@@ -162,7 +162,6 @@
|
||||
| expressions.swift:79:5:79:11 | call to ... |
|
||||
| expressions.swift:79:5:79:21 | call to ... |
|
||||
| expressions.swift:79:5:79:21 | self = ... |
|
||||
| expressions.swift:79:11:79:11 | TBD (OtherConstructorDeclRefExpr) |
|
||||
| expressions.swift:79:11:79:11 | call to ... |
|
||||
| expressions.swift:79:19:79:19 | 22 |
|
||||
| expressions.swift:83:15:83:15 | Derived.Type |
|
||||
|
||||
@@ -4944,7 +4944,6 @@ cfg.swift:
|
||||
|
||||
# 378| init
|
||||
#-----| -> call to ...
|
||||
#-----| -> TBD (OtherConstructorDeclRefExpr)
|
||||
|
||||
# 379| super
|
||||
#-----| -> call to ...
|
||||
@@ -4961,9 +4960,6 @@ cfg.swift:
|
||||
# 379| call to ...
|
||||
#-----| -> super
|
||||
|
||||
# 379| TBD (OtherConstructorDeclRefExpr)
|
||||
#-----| -> super
|
||||
|
||||
# 379| 0
|
||||
#-----| -> call to ...
|
||||
|
||||
|
||||
@@ -566,7 +566,6 @@
|
||||
| expressions.swift:78:3:80:3 | init | ConstructorDecl | expressions.swift:78:10:80:3 | { ... } | BraceStmt |
|
||||
| expressions.swift:78:10:80:3 | { ... } | BraceStmt | expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr |
|
||||
| expressions.swift:78:10:80:3 | { ... } | BraceStmt | expressions.swift:80:3:80:3 | return | ReturnStmt |
|
||||
| expressions.swift:79:5:79:11 | call to ... | DotSyntaxCallExpr | expressions.swift:79:11:79:11 | TBD (OtherConstructorDeclRefExpr) | OtherConstructorDeclRefExpr |
|
||||
| expressions.swift:79:5:79:11 | call to ... | DotSyntaxCallExpr | expressions.swift:79:11:79:11 | call to ... | OtherConstructorDeclRefExpr |
|
||||
| expressions.swift:79:5:79:21 | call to ... | CallExpr | expressions.swift:79:5:79:11 | call to ... | DotSyntaxCallExpr |
|
||||
| expressions.swift:79:5:79:21 | self = ... | RebindSelfInConstructorExpr | expressions.swift:78:3:78:3 | self | ParamDecl |
|
||||
|
||||
Reference in New Issue
Block a user