mirror of
https://github.com/github/codeql.git
synced 2026-04-19 14:04:09 +02:00
22 lines
650 B
Plaintext
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)
|
|
}
|