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

Member predicate Ssa::Definition::getALastReadAtNode

Gets a last read of the source variable underlying this SSA definition at control flow node cfn. That is, a read that can reach the end of the enclosing callable, or another SSA definition for the source variable, without passing through any other read. Example:

int Field;

void SetField(int i) {
  this.Field = i;
  Use(this.Field);
  if (i > 0)
    this.Field = i - 1;
  else if (i < 0)
    SetField(1);
  Use(this.Field);
  Use(this.Field);
}
  • The reads of i on lines 7 and 8 are the last reads for the implicit parameter definition on line 3.
  • The read of this.Field on line 5 is a last read of the definition on line 4.
  • The read of this.Field on line 11 is a last read of the phi node between lines 9 and 10.
AssignableRead getALastReadAtNode(Node cfn)