Files
codeql/csharp/ql/test/library-tests/dataflow/ssa/SSAPhiRead.ql
2025-03-04 12:24:22 +01:00

22 lines
650 B
Plaintext

import csharp
import semmle.code.csharp.dataflow.internal.SsaImpl
import Impl::TestAdjacentRefs as RefTest
query predicate phiReadNode(RefTest::Ref phi, Ssa::SourceVariable v) {
phi.isPhiRead() and phi.getSourceVariable() = v
}
query predicate phiReadNodeFirstRead(RefTest::Ref phi, Ssa::SourceVariable v, ControlFlow::Node read) {
exists(RefTest::Ref r, ControlFlow::BasicBlock bb, int i |
phi.isPhiRead() and
RefTest::adjacentRefRead(phi, r) and
r.accessAt(bb, i, v) and
read = bb.getNode(i)
)
}
query predicate phiReadInput(RefTest::Ref phi, RefTest::Ref inp) {
phi.isPhiRead() and
RefTest::adjacentRefPhi(inp, phi)
}