Skip to content

Commit 9941e46

Browse files
committed
Include first step from SsaVariableCapture
1 parent c1de2e5 commit 9941e46

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

go/ql/lib/semmle/go/dataflow/SSA.qll

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -154,6 +154,8 @@ class SsaDefinition extends TSsaDefinition {
154154
abstract predicate hasLocationInfo(
155155
string filepath, int startline, int startcolumn, int endline, int endcolumn
156156
);
157+
158+
IR::Instruction getAFirstUse() { firstUse(this, result) }
157159
}
158160

159161
/**
@@ -187,8 +189,6 @@ class SsaExplicitDefinition extends SsaDefinition, TExplicitDef {
187189
) {
188190
this.getInstruction().hasLocationInfo(filepath, startline, startcolumn, endline, endcolumn)
189191
}
190-
191-
IR::Instruction getAFirstUse() { firstUse(this, result) }
192192
}
193193

194194
/** Provides a helper predicate for working with explicit SSA definitions. */

go/ql/lib/semmle/go/dataflow/internal/DataFlowPrivate.qll

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,8 @@ predicate basicLocalFlowStep(Node nodeFrom, Node nodeTo) {
8282
)
8383
or
8484
// SSA defn -> first SSA use
85-
exists(SsaExplicitDefinition pred, IR::Instruction succ | succ = pred.getAFirstUse() |
85+
exists(SsaDefinition pred, IR::Instruction succ | succ = pred.getAFirstUse() |
86+
(pred instanceof SsaExplicitDefinition or pred instanceof SsaVariableCapture) and
8687
nodeFrom = ssaNode(pred.getVariable()) and
8788
nodeTo = instructionNode(succ)
8889
)

0 commit comments

Comments
 (0)