CodeQL library for C#
codeql/csharp-all 4.0.1-dev (changelog, source)
Search

Predicate Make::SsaDefReaches::ssaRefRank

Gets the (1-based) rank of the reference to v at the ith node of basic block bb, which has the given reference kind k.

For example, if bb is a basic block with a phi node for v (considered to be at index -1), reads v at node 2, and defines it at node 5, we have:

ssaRefRank(bb, -1, v, SsaDef()) = 1    // phi node
ssaRefRank(bb,  2, v, Read())   = 2    // read at node 2
ssaRefRank(bb,  5, v, SsaDef()) = 3    // definition at node 5

Reads are considered before writes when they happen at the same index.

Import path

import codeql.ssa.Ssa
int ssaRefRank(BasicBlock bb, int i, SourceVariable v, SsaRefKind k)