CodeQL library for Java/Kotlin
codeql/java-all 0.9.2-dev (changelog, source)
Search

Predicate TrackedVariablesImpl::trackField

Holds if f is a field that is interesting as a basis for SSA.

  • A field that is read twice is interesting as we want to know whether the reads refer to the same value.
  • A field that is both written and read is interesting as we want to know whether the read might get the written value.
  • A field that is read in a loop is interesting as we want to know whether the value is the same in different iterations (that is, whether the SSA definition can be placed outside the loop).
  • A volatile field is never interesting, since all reads must reread from memory and we are forced to assume that the value can change at any point.

Import path

import semmle.code.java.dataflow.SSA
predicate trackField(SsaSourceField f)