CodeQL library for Swift
codeql/swift-all 2.0.4-dev (changelog, source)
Search

Module MakeImplCommon::TypeFlow

Given a call graph for a set of flow paths, this module calculates the type flow between parameter and argument nodes in the cases where it is possible for a type to first be weakened and then strengthened again. When the stronger types at the end-points of such a type flow path are incompatible, the relevant call edges can be excluded as impossible.

The predicates relevantCallEdgeIn and relevantCallEdgeOut give the graph to be explored prior to the recursion, and the other three predicates are calculated in mutual recursion with the output of this module, which is given in typeFlowValidEdgeIn and typeFlowValidEdgeOut.

Import path

import codeql.dataflow.internal.DataFlowImplCommon

Predicates

getStrongestType

Gets the strongest of the two types t1 and t2. If neither type is stronger then compatibility is checked and t1 is returned.

typeFlowStats
typeFlowValidEdgeIn

Holds if the edge call-to-c is valid in the in-going direction in the call context cc.

typeFlowValidEdgeOut

Holds if the edge call-to-c is valid in the out-going direction.

Parameters