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

Member predicate VariableRead::getANextRead

Gets a next read of the same underlying assignable. That is, a read that can be reached from this read without passing through any other reads, and which is guaranteed to read the same value. 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 read of i on line 6 is next to the read on line 4.
  • The reads of i on lines 7 and 8 are next to the read on line 6.
  • The read of this.Field on line 11 is next to the read on line 10.
VariableRead getANextRead()