Skip to content

Commit 031f453

Browse files
committed
Swift: CFG for Copy/Consume expressions
1 parent 002f2a0 commit 031f453

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed

swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1444,6 +1444,24 @@ module Exprs {
14441444
}
14451445
}
14461446

1447+
/** Control-flow for Move Semantics. See the QLDoc for `CopyExpr` for details. */
1448+
private class CopyExprTree extends AstStandardPostOrderTree {
1449+
override CopyExpr ast;
1450+
1451+
final override ControlFlowElement getChildElement(int i) {
1452+
i = 0 and result.asAstNode() = ast.getSubExpr().getFullyUnresolved()
1453+
}
1454+
}
1455+
1456+
/** Control-flow for Move Semantics. See the QLDoc for `ConsumeExpr` for details. */
1457+
private class ConsumeExprTree extends AstStandardPostOrderTree {
1458+
override ConsumeExpr ast;
1459+
1460+
final override ControlFlowElement getChildElement(int i) {
1461+
i = 0 and result.asAstNode() = ast.getSubExpr().getFullyUnresolved()
1462+
}
1463+
}
1464+
14471465
private class OpaqueValueExprTree extends AstLeafTree {
14481466
override OpaqueValueExpr ast;
14491467
}

0 commit comments

Comments
 (0)