Skip to content

Commit

Permalink
Dataflow: Improve qldoc on the type system.
Browse files Browse the repository at this point in the history
  • Loading branch information
aschackmull committed Oct 27, 2023
1 parent a5bfeb6 commit 776e352
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions shared/dataflow/codeql/dataflow/DataFlow.qll
Original file line number Diff line number Diff line change
Expand Up @@ -91,16 +91,39 @@ signature module InputSig {
*/
OutNode getAnOutNode(DataFlowCall call, ReturnKind kind);

/**
* A type for a data flow node.
*
* This may or may not coincide with any type system existing for the source
* language, but should minimally include unique types for individual closure
* expressions (typically lambdas).
*/
class DataFlowType {
/** Gets a textual representation of this element. */
string toString();
}

string ppReprType(DataFlowType t);

/**
* Holds if `t1` and `t2` are compatible types.
*
* This predicate must be symmetric and reflexive.
*
* This predicate is used in the following way: If the data flow library
* tracks an object from node `n1` to `n2` using solely value-preserving
* steps, then it will check that the types of `n1` and `n2` are compatible.
* If they are not, then flow will be blocked.
*/
bindingset[t1, t2]
predicate compatibleTypes(DataFlowType t1, DataFlowType t2);

/**
* Holds if `t1` is strictly stronger than `t2`. That is, `t1` is a strict
* subtype of `t2`.
*
* This predicate must be transitive and imply `compatibleTypes(t1, t2)`.
*/
predicate typeStrongerThan(DataFlowType t1, DataFlowType t2);

class Content {
Expand Down Expand Up @@ -199,6 +222,12 @@ signature module InputSig {

/**
* Holds if the value of `node2` is given by `node1`.
*
* This predicate is combined with type information in the following way: If
* the data flow library is able to compute an improved type for `node1` then
* it will also conclude that this type applies to `node2`. Vice versa, if
* `node2` must be visited along a flow path, then any type known for `node2`
* must also apply to `node1`.
*/
predicate localMustFlowStep(Node node1, Node node2);

Expand Down

0 comments on commit 776e352

Please sign in to comment.