Skip to content

Commit 7c5fef3

Browse files
authored
Merge pull request github#13257 from smowton/smowton/hotfix/useless-assignment-to-field-exclude-method-receivers
Hotfix: Go: exclude method receivers from dead-store-of-field query
2 parents a14f7dd + 99c2119 commit 7c5fef3

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

go/ql/src/RedundantCode/DeadStoreOfField.ql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,9 @@ predicate escapes(DataFlow::Node nd) {
3838
// if `nd` is passed to a function, then it escapes
3939
nd = any(DataFlow::CallNode c).getASyntacticArgument()
4040
or
41+
// if `nd` is the receiver of a function, then it escapes
42+
nd = any(DataFlow::MethodCallNode c).getReceiver()
43+
or
4144
// if `nd` has its address taken, then it escapes
4245
exists(AddressExpr ae | nd.asExpr() = ae.getOperand())
4346
or

0 commit comments

Comments
 (0)