CodeQL library for Rust
codeql/rust-all 0.2.5-dev (changelog, source)
Search

Member predicate Ssa::Definition::getAFirstRead

Gets a first control flow node that reads the value of this SSA definition. That is, a read that can be reached from this definition without passing through other reads.

Example:

fn phi(b : bool) {              // defines b_0
     let mut x = 1;             // defines x_0
     println!("{}", x);         // first read of x_0
     println!("{}", x + 1);

     if b {                     // first read of b_0
         x = 2;                 // defines x_1
         println!("{}", x);     // first read of x_1
         println!("{}", x + 1);
     } else {
         x = 3;                 // defines x_2
         println!("{}", x);     // first read of x_2
         println!("{}", x + 1);
     }
                                // defines x_3 = phi(x_1, x_2)
     println!("{}", x);         // first read of x_3
}
Expr getAFirstRead()