mirror of
https://github.com/github/codeql.git
synced 2025-12-16 16:53:25 +01:00
Include first step from SsaVariableCapture
Without this change the test go/ql/test/query-tests/InconsistentCode/UnhandledCloseWritableHandle/UnhandledCloseWritableHandle.qlref was failing.
This commit is contained in:
@@ -166,6 +166,13 @@ class SsaDefinition extends TSsaDefinition {
|
||||
) {
|
||||
this.getLocation().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets the first instruction that the value of this `SsaDefinition` can
|
||||
* reach without passing through any other instructions, but possibly through
|
||||
* phi nodes.
|
||||
*/
|
||||
IR::Instruction getAFirstUse() { firstUse(this, result) }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -197,13 +204,6 @@ class SsaExplicitDefinition extends SsaDefinition, TExplicitDef {
|
||||
override string prettyPrintDef() { result = "definition of " + this.getSourceVariable() }
|
||||
|
||||
override Location getLocation() { result = this.getInstruction().getLocation() }
|
||||
|
||||
/**
|
||||
* Gets the first instruction that the value of this `SsaDefinition` can
|
||||
* reach without passing through any other instructions, but possibly through
|
||||
* phi nodes.
|
||||
*/
|
||||
IR::Instruction getAFirstUse() { firstUse(this, result) }
|
||||
}
|
||||
|
||||
/** Provides a helper predicate for working with explicit SSA definitions. */
|
||||
|
||||
@@ -83,7 +83,8 @@ predicate basicLocalFlowStep(Node nodeFrom, Node nodeTo) {
|
||||
)
|
||||
or
|
||||
// SSA defn -> first SSA use
|
||||
exists(SsaExplicitDefinition pred, IR::Instruction succ | succ = pred.getAFirstUse() |
|
||||
exists(SsaDefinition pred, IR::Instruction succ | succ = pred.getAFirstUse() |
|
||||
(pred instanceof SsaExplicitDefinition or pred instanceof SsaVariableCapture) and
|
||||
nodeFrom = ssaNode(pred.getVariable()) and
|
||||
nodeTo = instructionNode(succ)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user