From dda60abfefce3169b8105cf39c949e896be60fcd Mon Sep 17 00:00:00 2001 From: Mathias Vorreiter Pedersen Date: Tue, 24 May 2022 10:21:04 +0100 Subject: [PATCH] Swift: Add CFG for a couple more expressions. --- .../internal/ControlFlowGraphImpl.qll | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll b/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll index dc7f357be2f..446c1637101 100644 --- a/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll +++ b/swift/ql/lib/codeql/swift/controlflow/internal/ControlFlowGraphImpl.qll @@ -908,6 +908,8 @@ module Exprs { } } + private class TypeTree extends LeafTree instanceof TypeExpr { } + private class DynamicTypeTree extends StandardPostOrderTree instanceof DynamicTypeExpr { final override ControlFlowTree getChildElement(int i) { result = super.getBaseExpr().getFullyConverted() and i = 0 @@ -951,7 +953,13 @@ module Exprs { } } - private class DeclRefExprTree extends LeafTree, DeclRefExpr { } + private class DeclRefExprTree extends LeafTree instanceof DeclRefExpr { } + + private class MemberRefTree extends StandardPostOrderTree instanceof MemberRefExpr { + final override AstNode getChildElement(int i) { + result = super.getBaseExpr().getFullyConverted() and i = 0 + } + } private class ApplyExprTree extends StandardPostOrderTree instanceof ApplyExpr { ApplyExprTree() { @@ -969,6 +977,15 @@ module Exprs { } } + private class DefaultArgumentTree extends LeafTree instanceof DefaultArgumentExpr { } + + private class ForceValueTree extends StandardPostOrderTree instanceof ForceValueExpr { + override AstNode getChildElement(int i) { + i = 0 and + result = super.getSubExpr().getFullyConverted() + } + } + private class LogicalAndTree extends PostOrderTree, LogicalAndExpr { final override predicate propagatesAbnormal(AstNode child) { child = this.getAnOperand().getFullyConverted()