mirror of
https://github.com/github/codeql.git
synced 2025-12-17 01:03:14 +01:00
(Refactor) Make lookThroughImplicitFieldRead public
This commit is contained in:
@@ -1588,4 +1588,9 @@ module IR {
|
|||||||
* in a field/method access, element access, or slice expression.
|
* in a field/method access, element access, or slice expression.
|
||||||
*/
|
*/
|
||||||
EvalImplicitDerefInstruction implicitDerefInstruction(Expr e) { result = MkImplicitDeref(e) }
|
EvalImplicitDerefInstruction implicitDerefInstruction(Expr e) { result = MkImplicitDeref(e) }
|
||||||
|
|
||||||
|
/** Gets the base of `insn`, if `insn` is an implicit field read. */
|
||||||
|
Instruction lookThroughImplicitFieldRead(Instruction insn) {
|
||||||
|
result = insn.(ImplicitFieldReadInstruction).getBaseInstruction()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -384,17 +384,13 @@ module SourceSinkInterpretationInput implements
|
|||||||
}
|
}
|
||||||
|
|
||||||
private DataFlow::Node skipImplicitFieldReads(DataFlow::Node n) {
|
private DataFlow::Node skipImplicitFieldReads(DataFlow::Node n) {
|
||||||
not exists(lookThroughImplicitFieldRead(n)) and result = n
|
not exists(IR::lookThroughImplicitFieldRead(n.asInstruction())) and result = n
|
||||||
or
|
or
|
||||||
result = skipImplicitFieldReads(lookThroughImplicitFieldRead(n))
|
exists(DataFlow::Node mid |
|
||||||
}
|
mid.asInstruction() = IR::lookThroughImplicitFieldRead(n.asInstruction())
|
||||||
|
|
|
||||||
private DataFlow::Node lookThroughImplicitFieldRead(DataFlow::Node n) {
|
result = skipImplicitFieldReads(mid)
|
||||||
result.asInstruction() =
|
)
|
||||||
n.(DataFlow::InstructionNode)
|
|
||||||
.asInstruction()
|
|
||||||
.(IR::ImplicitFieldReadInstruction)
|
|
||||||
.getBaseInstruction()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Provides additional sink specification logic. */
|
/** Provides additional sink specification logic. */
|
||||||
|
|||||||
Reference in New Issue
Block a user