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

Member predicate BasicBlock::dominates

Holds if this basic block dominates basic block bb.

That is, all paths reaching basic block bb from some entry point basic block must go through this basic block.


int M(string s) {
  if (s == null)
    throw new ArgumentNullException(nameof(s));
  return s.Length;

The basic block starting on line 2 dominates the basic block on line 4 (all paths from the entry point of M to return s.Length; must go through the null check).

This predicate is reflexive, so for example if (s == null) dominates itself.

predicate dominates(BasicBlock bb)